Skip to main content

Run an agent generation

POST 

/v1/projects/:project_id/agents/:agent_id/generations

Sends messages to the agent, resolves its tools, and runs the model loop.

Background by default: this returns 202 immediately with a generation_id, and the turn runs on. Poll GET /v1/projects/{project_id}/generations/{generation_id} until its status leaves in_progress.

Pass ?wait=true to block instead and receive the turn itself — the final text when status is completed (plus object when the agent has an output schema), or the pending tool_calls when status is requires_action.

With stream: true the response is a Server-Sent Events stream (Content-Type text/event-stream) proxied from the runtime. A stream holds the request open by definition, so it always waits; combining it with an explicit wait=false is a 400.

Request

Responses

The settled generation — returned only with wait=true or, as a Server-Sent Events stream, with stream: true.