Skip to content

.NET: Update AsAIFunction to pass AdditionalProperties from parent agent to child agent #3217

@westey-m

Description

@westey-m

If a user is exposing an Agent as a FunctionTool to another agent, they currently don't have a lot of options for easily passing any data down to the child agent on a per run basis.

If we update AsAIFunction to pass the current AdditionalProperties from the FunctionInvokingChatClient.CurrentContext to the child agent, this allows us to easily pass additional values. Since these additional properties are also propagated across process boundaries when using A2A, it enables some valuable scenarios, e.g.:
Let's say we have Agent A that consumes Agent B as a tool.
Agent B is an A2AAgent (proxy) which communicates with a remote A2AService.
The A2A service hosts a ChatClientAgent that users a custom function tool

Passing AdditionalProperties in AsAIFunction closes the gap around passing AdditionalProperties from AgentA.RunAsync all the way to the custom function tool on the remote host (This should be tested once developed)
AsAIFunction can access the AdditionalProperties from AgentA and pass it to AgentB. A2AAgents already serialize AdditionalProperties and send them over the wire as A2A Metadata. The A2A Host code already turns the metadata back into additional properties and these are already available to any custom functions via FunctionInvokingChatClient.CurrentContext.

#2694

CC @moetarhinikaseya

Metadata

Metadata

Assignees

Labels

.NETagentsIssues related to single agents

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions