Build stateful agents
Stateful Agents automatically maintain persistent conversation context across multiple interactions without requiring external database configuration. Each conversation is assigned a unique run ID that preserves the complete interaction history, including user messages, agent responses, and MCP server calls.
Overview
By default, all Toolhouse agents are stateful and start with a clear context. New POST agent call to https://agents.toolhouse.ai/{YOUR_AGENT_ID}
will start a new interaction between the agent and the user. Each call will return an X-Toolhouse-Run-ID
header that will identify the state ID. You can of this X-Toolhouse-Run-ID
as a session ID:
From now on, you can reference the Run ID in a PUT call to keep adding user messages to the conversation:
At any point, you can get the full history of the conversation through a GET request:
Resources
Last updated