Skip to main content
State is data that persists across multiple runs within a session, enabling agents, teams, and workflows to maintain context and remember information. Common use cases include managing user-specific data like shopping lists, todo lists, preferences, or any information that needs to persist across interactions. State is managed through session_state, which can be accessed and updated in tools, then automatically persisted to your database.

How State Works

State in Agno follows this pattern:
  1. Initialize - Set default session_state when creating agents, teams, or workflows
  2. Access - Tools access state via run_context.session_state
  3. Update - Modifications are automatically persisted to the database
  4. Load - Subsequent runs in the same session retrieve the stored state

Basic Example

Here’s a simple agent that maintains a shopping list:

Learn more

Agent State

Store and update session state on a single agent.

Team State

Share state across a team and its members.

Workflow State

Pass state between workflow steps via run_context.

Developer Resources