Agentchat_fastapi sample not saving history / state in json. #7027
Unanswered
Akashprasad123
asked this question in
Q&A
Replies: 1 comment
-
The state cannot be saved when the team is running: see https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/human-in-the-loop.html for explanation. To save state, we need to use a different way to performan human-in-the-loop. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
What is the doc issue?
Description
I cloned the AutoGen docs example for building a WebSocket-based chat server with Team and RoundRobinGroupChat. The code references team_state.json and team_history.json for persisting state/history, but:
These files are never created automatically.
Even if I manually create empty JSON files, they are never updated while chatting.
When restarting the server, the conversation state is not restored.
After debugging with logging, I found that the code only saves state/history after the async for message in stream loop ends.
However, with RoundRobinGroupChat, the stream never naturally ends — instead it pauses with a UserInputRequestedEvent waiting for input.
This means the save block is never reached, and persistence is effectively broken.
Steps to Reproduce
Clone the docs repo and run the WebSocket server example
Start a chat session and send a message.
Observe that team_state.json and team_history.json are not created or updated.
Restart server → history is lost.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Link to the doc page, if applicable
https://github.com/microsoft/autogen/tree/main/python/samples/agentchat_fastapi
Beta Was this translation helpful? Give feedback.
All reactions