Stateful agents maintain conversational history and state across interactions using sessions. The ACP SDK leverages this concept by maintaining a descriptor for each session and storing its contents at resource servers. This allows agents to access the complete history of interactions within a session, provided that the same session is used consistently across runs.Documentation Index
Fetch the complete documentation index at: https://agentcommunicationprotocol.dev/llms.txt
Use this file to discover all available pages before exploring further.
ACP Client Sessions
The ACP SDK provides a convenient way to maintain session through thesession() context manager. When using a session, the SDK automatically handles session ID management, ensuring that all runs within the session share the same ID.
This makes it easy to build stateful conversations where agents can reference previous interactions:
session.py
ACP Server sessions
When building ACP agent, thecontext argument contains a session instance containing session’s ID, history and latest state from all the previous runs in the same session.
stateful_agent.py