v6

latestOpenAPI 3.0.0raw.githubusercontent.com2025-11-063111.9 KB

Run an Agent

Run an agent on a task or message.
A new session can be created by omitting the session query parameter, or an existing session can be continued by specifying the session ID in the session query parameter.
The request body includes the message, optional system prompt, mode, MCP server configuration, optional rules and whether the response should be streamed.
The response is a streaming response and returns a sequence of events representing the agent’s thoughts and responses.

post/

Query parameters

sessionstring

The session ID to continue the agent session conversation. If not provided, a new session will be created.

Request body

messagestring required

The task or message to run the agent with.

mode'flash' | 'fast' | 'max'

The agent mode. Allowed values are flash, fast or max. Defaults to fast if not supplied.

systemstring

A system prompt to provide system information to the agent.

rulesstring[]

A list of constraints that the agent must follow.

backgroundboolean

Whether to run the agent asynchronously on the server. When set to true, use callback parameter to receive events.

streaming_tokensboolean

Whether to stream the agent messages token by token.

Response

Streamed agent response. Clients should consume the response as a text/event‑stream.

All 3 operations