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
- 200
- 202
- 400
- 401
- 404
- 502
The settled generation — returned only with wait=true or, as a Server-Sent Events stream, with stream: true.
Accepted — the default. The generation is running in the background; poll the returned generation_id.
The request was malformed or failed validation.
Missing or invalid credentials.
The resource does not exist (existence is not leaked).
The upstream runtime could not complete the operation.