Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net Agents New Feature: I want the "Agents as plugins" to be able to access the main agent thread - if I want #11438

Open
joslat opened this issue Apr 8, 2025 · 1 comment · May be fixed by #11443
Assignees
Labels
agents function_calling .NET Issue or Pull requests regarding .NET code

Comments

@joslat
Copy link
Contributor

joslat commented Apr 8, 2025


name: Feature request
about: Suggest an idea for this project


I want the "Agents as plugins" to be able to access the main agent thread - if I want

I do not see the agent wrapped in the plugin function being invoked with the main agent/chat thread…
see

var response = agent.InvokeAsync(new ChatMessageContent(AuthorRole.User, queryString), null, options, cancellationToken);

(at the moment we are handling null, so a new thread is created always when invoking the agent as function...)

IMHO having this would be very convenient, so it can participate, and read the conversation thread… otherwise we have to manually pass all the context to it in order to function properly.

@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Apr 8, 2025
@github-actions github-actions bot changed the title .NET Agents New Feature: I want the "Agents as plugins" to be able to access the main agent thread - if I want .Net Agents New Feature: I want the "Agents as plugins" to be able to access the main agent thread - if I want Apr 8, 2025
@crickman
Copy link
Contributor

crickman commented Apr 8, 2025

Up-voting, this analysis by @joslat.

The null parameter for the AgentThread effectivly exposes the agent-as-a-tool as equivelent to KernelFunctionFromPrompt.

There's a couple way of looking at how to manage the context of the agent-as-a-tool:

  1. Provide access to the outer conversation or thread. While injects the full context of the outer conversation, it introduces the following considerations:

    • How is this managed across different agent modalities. That is, it is entirely possible that outer agent AzureAIAgent and the agent-as-a-tool is ChatCompletionAgent. There two different agent modalities require different AgentThread instances.
    • Is the agent-as-a-tool allowed to update the outer thread? If both the outer agent and agent-as-a-tool are AzureAIAgent types, and the same thread-id is utilized by the tool, then (in the absence of any special handling) the tool response will be added to the thread. I believe this is undesired when using agent-as-a-tool.
  2. The inner agent-as-a-tool maintains its own inner (of forked) thread that retains context when the agent-as-a-tool is invoked multiple times for the same conversation. This retains context for the inner agent-as-a-tool without mutating the outer conversation / thread.

Finally, there could feasibly be a mode where the developer desires the agent to not retain an context other than the input queryString.

Note: We should also take care to align both Python and .NET with whatever decision point is made for this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents function_calling .NET Issue or Pull requests regarding .NET code
Projects
Status: No status
4 participants