-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Description
When mapping a workflow as an agent with AsAgent(), the underlying workflow ignores the agentrunoptions.
agent-framework/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs
Lines 123 to 139 in 6255abd
| protected override async | |
| IAsyncEnumerable<AgentResponseUpdate> RunCoreStreamingAsync( | |
| IEnumerable<ChatMessage> messages, | |
| AgentSession? session = null, | |
| AgentRunOptions? options = null, | |
| [EnumeratorCancellation] CancellationToken cancellationToken = default) | |
| { | |
| await this.ValidateWorkflowAsync().ConfigureAwait(false); | |
| WorkflowSession workflowSession = await this.UpdateSessionAsync(messages, session, cancellationToken).ConfigureAwait(false); | |
| await foreach (AgentResponseUpdate update in workflowSession.InvokeStageAsync(cancellationToken) | |
| .ConfigureAwait(false) | |
| .WithCancellation(cancellationToken)) | |
| { | |
| yield return update; | |
| } | |
| } |
Currently the AgentRunOptions are not passed to the underlying agents when the WorkflowHostAgent calls them. This means that any options set in AgentRunOptions or any other information that might be included (for example, if they are ChatClientAgentOptions with a ChatOptions and custom AdditionalProperties) can't be accessed.
Ideally the options would flow through InvokeStageAsync https://github.com/microsoft/agent-framework/blob/main/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowSession.cs#L153 and will be included in the TurnToken https://github.com/microsoft/agent-framework/blob/main/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowSession.cs#L167 so that they can be accessed by the underlying agents.
Code Sample
Language/SDK
.NET