Skip to content

Commit 43e0dc4

Browse files
authored
.Net: Agents - CopilotStudioAgent not invoking AgentInvokeOptions.OnIntermediateMessage for non-streaming (#12589)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Response always empty when using `CopilotStudioAgent` with any `AgentOrchestration` ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Ability to use any `Agent` with an `AgentOrchestration` relies upon the ability to recieve messages via the callback. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
1 parent 23b86fe commit 43e0dc4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dotnet/src/Agents/Copilot/CopilotStudioAgent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public override async IAsyncEnumerable<AgentResponseItem<ChatMessageContent>> In
6666
await foreach (ChatMessageContent result in invokeResults.ConfigureAwait(false))
6767
{
6868
await this.NotifyThreadOfNewMessage(agentThread, result, cancellationToken).ConfigureAwait(false);
69+
70+
if (options?.OnIntermediateMessage is not null)
71+
{
72+
await options.OnIntermediateMessage(result).ConfigureAwait(false);
73+
}
74+
6975
yield return new(result, agentThread);
7076
}
7177
}

0 commit comments

Comments
 (0)