Makeup of a Standard Agent
In order to create a Standard Agent, you define the following:- Models: defines an LLM provider (currently supports OpenRouter and OpenAI) and model and fallbacks.
- Tools: a typescript function that can be called by an agent. This is where most business integration logic lives.
- Prompts: a prompt defines what the LLM will receive on any given turn of a conversation, including the system message, the available tools, the message history, and more.
- Agents: an agent defines the structure and behavior of a conversation, including the type of conversation (AI-Human or Dual-AI), the initial prompt to use, limits on the number of turns, and what ends one side’s turns and yields the conversation to the other side.
Threads
To actually run an agent, you create a new thread specifying which agent you want to use. In other words you can think of a thread as an instance of an agent. Each thread is backed by a single Cloudflare DurableObject instance (defined in yourwrangler.jsonc file as DurableThread). Each thread has its own SQLite database that stores the message history of that thread, the execution state of the agent, and detailed logs of the agent’s execution.
To create a thread, you can use the ’+ New Thread’ button in the AgentBuilder UI, or you can submit an HTTP request:
id is a cryptographically unique identifier for a given conversation. Keeping track of this id in your client code is important as it allows you to communicate directly with the thread’s DurableObject instance.
Parent/Child Threads (Subagents)
When a prompt delegates to adual_ai subagent, AgentBuilder creates a child thread linked to its parent:
- child thread has isolated SQLite/messages/filesystem
- parent tracks child state in a resumable registry
- communication uses queued messages and lifecycle tools
- attachments are copied across filesystems and rewritten to destination-local paths
Messages
Both user provided content and model responses are called “messages” and are stored in the DurableThread database. The message history can be retrieved at via HTTP request:@standardagents/react package.
Next Steps
React Package
Build UIs with @standardagents/react
API Reference
Read the API reference