-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Hi,
I am trying to build Deep Research Agent using AGUI and CopilotKit. I would like to do below steps -
- Break the objective into 3-4 short steps for the UI to display
This is working using useCoAgentStateRender with DelegatingAIAgent as above.
- For Each Steps It will call
perform_researchtool. <-- This steps also works fine. Here is my tool definition -
[Description("Perform a research task and track progress.")]
static async IAsyncEnumerable<AgentRunResponseUpdate> PerformResearch([Description("The research query")] string query)
{
var agentState = new AgentStateSnapshot { Searches = [] };
agentState.Searches.Add(new SearchInfo { Query = query, Status= "InProgress"});
byte[] stateBytes = JsonSerializer.SerializeToUtf8Bytes(
agentState);
// Emit state snapshot as DataContent
yield return new AgentRunResponseUpdate
{
Contents = [new DataContent(stateBytes, "application/json")]
};
// Simulate initial research phase
var research_content = $" Research Overview: Actual content......";
agentState.Searches.Add(new SearchInfo { Query = query, Status= "Done" });
stateBytes = JsonSerializer.SerializeToUtf8Bytes(
agentState);
yield return new AgentRunResponseUpdate
{
Contents = [new DataContent(stateBytes, "application/json")]
};
yield return new AgentRunResponseUpdate
{
Contents = [new TextContent(research_content)]
};
}
Above snippet has few problem
- Unable to access existing state
- all three outputs are returning together at once it seems
- all three outputs are returning as
TEXT_MESSAGE_CONTENTso not invokinguseCoAgentStateRenderand it is getting treated as Tool's actual output.
My question -
- How do I get existing Agent State in Tool?
- How do I return intermediate state seperatly.
- How do I stream these intermediate state as
STATE_SNAPSHOT
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
No status