semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: Bug: ChatCompletionAgent without Description hangs indefinitely

Open andrewabest opened this issue 4 months ago • 7 comments

Describe the bug When used in an Orchestration (tested with Parallel and Sequential), a ChatCompletionAgent without a description will hang indefinitely or time out (if timeout specified) without a response.

Log output when hung:

trce: Microsoft.SemanticKernel.Agents.Orchestration.Sequential.SequentialOrchestration[0]
      REGISTER SequentialOrchestration Start: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2/default
info: Microsoft.SemanticKernel.Agents.Orchestration.Sequential.SequentialOrchestration[0]
      REGISTER ACTOR SequentialOrchestration MEMBER #2: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2_Agent_2
info: Microsoft.SemanticKernel.Agents.Orchestration.Sequential.SequentialOrchestration[0]
      REGISTER ACTOR SequentialOrchestration MEMBER #1: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2_Agent_1
trce: Microsoft.SemanticKernel.Agents.Orchestration.Sequential.SequentialOrchestration[0]
      REGISTER SequentialOrchestration Complete: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2/default
info: Microsoft.SemanticKernel.Agents.Orchestration.Sequential.SequentialOrchestration[0]
      INVOKE SequentialOrchestration: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2/default
trce: Microsoft.SemanticKernel.Agents.Orchestration.Sequential.SequentialOrchestration[0]
      YIELD SequentialOrchestration: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2/default
info: Microsoft.SemanticKernel.Agents.Orchestration.AgentOrchestration.RequestActor[0]
      INIT SequentialOrchestration: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2_Boot/default
info: Microsoft.SemanticKernel.Agents.Orchestration.AgentOrchestration.RequestActor[0]
      START SequentialOrchestration: SequentialOrchestration_5b2f6297ec9549a98ebb7c47cb21e1e2_Boot/default

To Reproduce Use https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/GettingStartedWithAgents/Orchestration/Step01_Concurrent.cs and remove the description from one or both of the agents.

Expected behavior If description is a required field of ChatCompletionAgent, it should either ideally be a non-nullable constructor parameter, or at the very least a clear exception should be thrown upon invocation if description has not been provided.

Platform

  • Language: C#
  • Source: NuGet package 1.62.0
  • AI model: o4-mini
  • IDE: repro in LinqPad
  • OS: repro on Mac

andrewabest avatar Aug 22 '25 05:08 andrewabest

I get the same issue even if I have the Description

ScottyTarvan avatar Aug 23 '25 07:08 ScottyTarvan

Same for me, even with Description. AzureOpenAI agent worked when I set Description, but ChatCompletionClient doesn't. I used SequentialOrchestrator

zeksdev avatar Aug 23 '25 11:08 zeksdev

To me, it seems that some exception is hiddenly caught that causes the orchestration to hang forever. I played around with various IChatCompletionServices registered for Dependency Injection.

In general, orchestration works with 'OpenAIChatCompletion' and also with 'GoogleAIGeminiChatCompletion' (only tested with handoff). However, it seems that if you make any mistake that is discovered only at runtime, the orchestration gets stuck. For example, I used the wrong API key and there was no error, no log output, nothing: The 'await orchestrationResult.GetValueAsync(..)'-call is just stuck forever.

nx-s avatar Aug 24 '25 10:08 nx-s

I agree description should be validated early. Looking...

crickman avatar Aug 27 '25 16:08 crickman

Agreed, same here hangs on starting without description.

MichaelSurgeon avatar Sep 17 '25 13:09 MichaelSurgeon

Confirmed hang without description; successfully tested ChatCompletionAgent with a populated Description.

cwatson-sidub avatar Sep 20 '25 18:09 cwatson-sidub

Damn, it was the field decription the issue, how come they don't document that clearly ? Or do they ? Thanks guys I was able to solve my Orchestration (for now)

kacisse avatar Oct 23 '25 07:10 kacisse