| Flag | Behavior |
|---|---|
session_state={...} | Initial state. Persisted to agno_sessions per (user_id, session_id). |
enable_agentic_state=True | Agent gets update_session_state tool. Can mutate the dict directly. |
add_session_state_to_context=True | State gets injected into the system prompt every turn. |
Session state vs memory vs dependencies
| Type | Scope | Mutability | Persistence |
|---|---|---|---|
session_state | One (user_id, session_id) | Mutable, agent updates | Yes, in agno_sessions |
| Memory | Per user_id across sessions | Mutable, agent or extractor updates | Yes, in agno_memories |
| Knowledge | Global (filterable) | Mutable, you load/upsert | Yes, in agno_knowledge |
| Dependencies | One run | Read-only | No, ephemeral |
CRUD via tools
The Taskboard agent ships its own CRUD tools instead of relying onupdate_session_state directly. This gives the model cleaner intent labels and lets you validate updates:
session_state gets injected into tool functions automatically (same way RunContext does for Injector). Mutations persist.
When to use session state
| Use case | Use |
|---|---|
| Working list the user is editing (tasks, items, choices) | session_state |
| Multi-turn form filling | session_state |
| Per-conversation scratchpad | session_state |
| Cross-session preferences | Memory or user profile |
| Per-request config (tenant, flags) | Dependencies |
See it in action
session_state. The next turn sees the updated state in context. Refreshing the chat page reloads the state from agno_sessions.
Source: agents/taskboard/agent.py