Skip to content

How to implement state save and load for a custom agent built using core inheriting Routed Agent #6005

Answered by cvarun94
cvarun94 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Eric!
Thank you for your response.

I went through the source code, context docs and also the doc you had referenced. For the benefit of others I am writing my understanding of states, context and how to implement them, pls correct me if wrong.

Concept

  1. Based on my understanding the state of an agent is the context of the agent (LLM context to be precise), and must be any of the ChatCompletionContext (Unbounded, Buffered etc.)
  2. In core, when writing an Agent class inheriting the RoutedAgent, we must have the save_state method where to save the context we must return a AssistantAgentState dump.
  3. Similarly the base agent class must have a load_state, where we must first validate the state a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cvarun94
Comment options

Answer selected by cvarun94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants