Skip to main content

Create an agent mode response

POST /api/2.0/genie/agents/{agent_id}/responses

Sends a question to a Genie agent and streams the response over Server-Sent Events (SSE).

API scopes: genie

Path parameters

agent_idstringRequiredpath

The ID of the Genie agent.

Request body

inputarray of objectRequired

Exactly one message item with role: "user" containing the question.

Show child attributesHide child attributes
typestringRequired

Item type. Use message.

Values: message

rolestringRequired

Message role. Use user.

Values: user

contentarray of objectRequired

Message content. Each item is {"type": "input_text", "text": "..."}.

conversation_idstring

Existing conversation to continue. Omit to start a new one.

Default: null

Response events

Every event contains a monotonically increasing sequence_number. The stream ends with response.completed on success or response.failed on failure. The server-side timeout is 30 minutes.

response.createdevent

Sent once when the stream opens. data.response is a Response with status: "in_progress" and empty output.

response.output_item.addedevent

A new output item appears and might still be in progress. data.item is an output item.

response.output_item.updatedevent

An existing item's content changed. It has the same shape as response.output_item.added.

response.output_item.doneevent

An item reached its final state. It has the same shape as response.output_item.added.

response.completedevent

Terminal success. data.response is the final Response with all output items.

response.failedevent

Terminal failure. data.response.status is "failed" and includes an error object.

Response

The response uses the text/event-stream content type.

objectstring

Always "response".

Values: response

idstring

Unique response ID.

modelstring

Always "genie-agent".

Values: genie-agent

statusstring

The response status.

Values: in_progress, completed, failed

outputarray of object

Output items produced by this response. Each item is polymorphic on type.

Show child attributesHide child attributes
reasoningobject

The agent's reasoning. Contains reasoning_text content items and a status.

function_callobject

An SQL query the agent runs. Contains call_id, the name "execute_sql", and arguments encoded as a JSON string. It is paired with function_call_output by call_id.

function_call_outputobject

The query result. Its ID is always {call_id}_output; when completed, output contains the query title followed by a Markdown table.

messageobject

A user question, assistant report, or system error. Assistant content contains output_text chunks; table chunks include metadata for columns, preview rows, total row count, status, and SQL.

conversation_idstring

The conversation this response belongs to. Reuse it to list items or send follow-up questions.

created_atinteger

Unix epoch time in seconds.

errorobject

Present when status is "failed".

Errors

HTTP statusError codeDescription
400INVALID_PARAMETER_VALUEA path parameter is missing, or input is not exactly one message item with role: "user".
404FEATURE_DISABLEDThe workspace is not enrolled or the preview toggle is off.
403PERMISSION_DENIEDThe caller lacks CAN QUERY on the Genie agent.
404NOT_FOUNDThe Genie agent or conversation does not exist.
409RESOURCE_CONFLICTA response is already being generated for this conversation.
429RATE_LIMIT_EXCEEDEDThe per-workspace rate limit of five requests per minute was exceeded.
500INTERNAL_ERRORAn unexpected server error occurred.