Generate a response
POST/v1/projects/:project_id/agents/:agent_id/sessions/:session_id/generate
Runs the agent over the session's accumulated messages.
Background by default: this returns 202 immediately and the turn runs on. The reply lands in the transcript, so poll GET /v1/projects/{project_id}/agents/{agent_id}/sessions/{session_id}/messages for the assistant message, or read the session for its status.
Pass ?wait=true to block instead and receive the turn itself: status is completed with the assistant message, or requires_action with the pending required_action tool calls.
model overrides the agent's default model for this turn only.
Request
Responses
- 200
- 202
- 400
- 401
- 404
- 409
- 410
- 502
The settled turn — the agent's reply or a requires_action turn. Returned only with wait=true.
Accepted — the default. The turn is running in the background; its reply will appear in the session transcript.
The request was malformed or failed validation.
Missing or invalid credentials.
The resource does not exist (existence is not leaked).
The request conflicts with the current state of the resource.
The session has expired due to inactivity.
The upstream runtime could not complete the operation.