Create Thread
/api/threadsCreates a new conversation thread with the specified agent.
agent_idstringrequiredThe name of the agent to use for this thread. Must match an agent defined in agents/agents/.
The runtime determines the thread owner from the authenticated caller. Creation does not start an execution. Send a message to start a run.
dataobjectPersistent invocation arguments for ThreadState.arguments and prompt variables.
Non-empty arguments are validated against the agent side A prompt's requiredSchema.
Invalid arguments return 400.
Omitted, null, or empty arguments skip schema validation.
env_typesobjectEnvironment display types by key.
Use text for values that can appear in prompts and output.
Other values use secret.
Keys without a matching env value are ignored.
propertiesobjectInitial thread properties. The runtime reserves its invocation-argument property.
initial_messages is accepted for compatibility but is not stored.
Use the send-message endpoint to add messages.
tagsarrayOptional array of string tags for categorizing and filtering threads.
envobjectOptional thread environment values. Every value must be a string.
Errors
A request is rejected with 400, and no thread is created, when:
- the body is not a JSON object
agent_idis absent or is not a stringtagsis present and is not an array of stringsenvis present and is not an object whose values are all strings
null counts as present for tags and env. An empty tags array and an empty env object are valid.
A string agent_id returns 404 unless it is the id of an agent that GET /api/agents lists for the caller without a filter.
Those are the project's agents and the entry agents of installed packages, including agents with primary: false.
An agent of a package that is not one of its entry agents returns the same 404 as a name that matches no agent, and no thread is created.
threadIdstringrequiredUnique thread identifier (UUID)
agent_idstringrequiredThe agent name associated with this thread
messagestringConfirmation text. The Standard Agent Specification defines threadId and agent_id for this response. message is a runtime addition that the specification permits, and a client can ignore it.
A successful request returns 200.