Learn about state in agents.
session_state
. The Agent updates the session_state
in tool calls and exposes them to the Model via the system message.Agent
’s session_state
parameter with a dictionary of state variables.session_state
dictionary in tool calls or other functions.session_state
with the LLM via the system message by referencing the state variables in description
and instructions
.session_state
to the agent on agent.run()
, effectively overriding any state that was set on Agent initialization.session_state
is stored with Agent sessions and is persisted in your database. Meaning, it is available across execution cycles. This also means when switching sessions between calls to agent.run()
, the state is loaded and available.session_state
variable is automatically passed to the tool as an
argument. Any updates to it is automatically reflected in the shared state.Team
. See
Teams for more information.db
parameter for state to be
persisted across runs.enable_agentic_state
parameter to True
.
add_session_state_to_context=True
to make the session
state available to the agent’s context.{key}
syntax, Agno substitutes the values for you.session_id
to the agent on agent.run()
, it will switch to the session with the given session_id
and load any state that was set on that session.
This is useful when you want to continue a session for a specific user.