Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AgentChat agents and teams can be rolled back to snapshots of states #4100

Closed
ekzhu opened this issue Nov 8, 2024 · 0 comments · Fixed by #4436
Closed

AgentChat agents and teams can be rolled back to snapshots of states #4100

ekzhu opened this issue Nov 8, 2024 · 0 comments · Fixed by #4436
Assignees
Milestone

Comments

@ekzhu
Copy link
Collaborator

ekzhu commented Nov 8, 2024

What feature would you like to be added?

ChatAgent has a method save_state() that exports the internal state of the agent, and a load_state() method to bring the agent back to an existing state.

agent = AssistantAgent(...)
state = await agent.save_state()
# The state can be used to bring the agent back to an existing state. 
await agent.load_state(state)

Same with team

team = RoundRobinGroupChat(...)
state = await team.save_state()
# The team itself can be brought back to a previous state
await team.load_state(state)

Same with termination condition

termiantion = MaxMessageTermination(12)
state = await termination.save_state()
# Bring the termination condition state back.
await termination.load_state(state)

The team's state can optionally include all the participant agents' state recursively, and with that you don't need to update the agents separately.

What this doesn't solve: It is not a replacement for a complete serialization because you still need to construct the agent and team instances, and you still need to know the parameters you need to configure. The save_state and load_state methods should be used in conjunction with #4007 to perform complete serialization and deserialization.

Why is this needed?

In web services, it's desirable to not have persistent in-memory state. So, when user is idle the state is kept off the heap to allow more scaling. This requires the agents and teams to be able to save its state and rehydrate from a previous state snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants