Agent Orchestration - how to provide chat history? #13059
Unanswered
adrianzailic
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Si lo pudieras traducir al español con gusto te resuelvo
El mié, 3 de sept de 2025 07:28, Adrian Zailic ***@***.***>
escribió:
… Hello,
Is there any way to pass the previous chat history to the Agent
Orchestration when invoking it?
My use case is that I have a REST API with a chat completion endpoint that
uses the Semantic Kernel Agent Orchestration to reply to the user’s prompt.
The problem is that I want to support scenarios where the task is spread
across multiple prompts, as in the example below:
User: What transactions do we have about X?
Assistant: The Data Retrieval agent replies with a list of transactions.
User: Tell me more about the second one.
In this scenario, the chat history is crucial. It would be stored in the
frontend app and sent with each request to my chat completion endpoint.
I would have a list of agents and would like to use the Handoff
Orchestration to route the prompt to the correct agent. However, it seems
there is no way to provide the entire chat history within an orchestration:
string task = "Tell me more about the second one.";
var result = await orchestration.InvokeAsync(task, runtime);
Here I can only provide a single string, not the entire chat history.
I tried creating a longer prompt that includes both the chat history and
the current user prompt, like this:
*Based on the previous conversation {list of conversations}, answer the
current request/prompt: {task}*
But this approach is never as effective as providing the actual chat
history.
On the other hand, if I do the triage separately in a chat completion call
and then invoke the selected agent directly, I can pass the entire chat
history:
selectedAgent.InvokeAsync(chatHistory, cancellationToken)
Could you please help me understand if this is possible within an
orchestration, or if it’s not yet supported by the framework?
—
Reply to this email directly, view it on GitHub
<#13059>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6UAQV7WXKN6XZXI4IG5DRL3Q3UHFAVCNFSM6AAAAACFQT3U3GVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYHAZTKNZVHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
You gotta provide a callback and build it yourself: ChatHistory history = [];
ValueTask responseCallback(ChatMessageContent response)
{
history.Add(response);
return ValueTask.CompletedTask;
} Then, instanciate your orchestrator: MagenticOrchestration orchestration = new MagenticOrchestration(
manager,
researchAgent,
coderAgent)
{
ResponseCallback = responseCallback,
}; That will populate the chat history you provide. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Is there any way to pass the previous chat history to the Agent Orchestration when invoking it?
My use case is that I have a REST API with a chat completion endpoint that uses the Semantic Kernel Agent Orchestration to reply to the user’s prompt. The problem is that I want to support scenarios where the task is spread across multiple prompts, as in the example below:
User: What transactions do we have about X?
Assistant: The Data Retrieval agent replies with a list of transactions.
User: Tell me more about the second one.
In this scenario, the chat history is crucial. It would be stored in the frontend app and sent with each request to my chat completion endpoint.
I would have a list of agents and would like to use the Handoff Orchestration to route the prompt to the correct agent. However, it seems there is no way to provide the entire chat history within an orchestration:
Here I can only provide a single string, not the entire chat history.
I tried creating a longer prompt that includes both the chat history and the current user prompt, like this:
But this approach is never as effective as providing the actual chat history.
On the other hand, if I do the triage separately in a chat completion call and then invoke the selected agent directly, I can pass the entire chat history:
Could you please help me understand if this is possible within an orchestration, or if it’s not yet supported by the framework?
Beta Was this translation helpful? Give feedback.
All reactions