.Net: Agents Different behavior using Agent Delegation pattern vs single agent
Hey, thanks for you support.
I would like to discuss with you about the Agent Delegation pattern sample at link.
I set up an Agent using the Agents package from SK and Assistant API to have a multi-turn conversation with the user, request some fields and perform some actions using a plugin. It works fine, and always maintain context of the fields needed to complete and execute the plugin kernel function.
Then i moved to the Agent Delegation set up like this:
- a proxy agent (as from the example[ToolAgent])
- the first agent as mentioned above [Agent_A]
- a second simple agent to test out. [Agent_B]
I am noticing that with the delegation pattern, the context is not maintained very well. It appears that the ToolAgent interferes with the normal behavior of the specialized agent (for example Agent_A). It's impossible to complete a normal flow with the Agent_B. I expect the same behavior to be there, regardless of the delegation pattern.
Is there any point where I can take action to improve this behavior?. I have already tried to change in various way the assistant instructions (both ToolAgent and Agent_A) but i don't notice any improvement.
Is there any difference in context/thread handling when using the delegation pattern? I couldn't find any information about it, but i suppose that the ToolAgent uses a thread for each of the agents.
Thanks in advance.
Hi @zimeo99 - Thank you for taking the time to share your experience.
I am also fustrated by this limitation. I played with several approachs for sharing context/history, but was unable to achieve satisfactory results.
In addition, the is no visibility into the inner conversation. I haven't been pleased with this behavior.
We are in the process of adopting an new agent framework that has been informed by our experience here. In this new framework, both the history/context and visibility problems have been solved. We hope to a draft MVP in main next week and I'd really appreciate your feedback as it develops over the next weeks.
This is the initial cut for the abstractions, but evolving quickly (look for draft PR's): https://github.com/microsoft/semantic-kernel/pull/5705
I aim to have the "agent-as-a-plugin" concept available next week along with a concrete chat ("nexus") class. I suspect this is when you'll be interested to take a peek.
To answer your question directly and the thread handling specific, "agent-as-a-plugin" creates and deletes a thread for a single interaction:
https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/Experimental/Agents/Internal/Agent.cs#L225
Thank you for the information. I am glad that this is not a problem noticed only by us and that there will be updates in the agent framework. For the latter, will there be a release of a new nuget package? Or is it possible to try some samples already? Thanks again for the support
(Late Follow-Up) The new framework has been published along with samples:
https://www.nuget.org/packages/Microsoft.SemanticKernel.Agents.Abstractions/1.14.1-alpha https://www.nuget.org/packages/Microsoft.SemanticKernel.Agents.Core/1.14.1-alpha https://www.nuget.org/packages/Microsoft.SemanticKernel.Agents.OpenAI/1.14.1-alpha
https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/GettingStartedWithAgents https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/Concepts/Agents
I don't believe we're going to invest in addressing this issue as it lies outside of the current agent framework.