Agent mode: Create a response
POST
Sends a question to a Genie agent and streams the response over Server-Sent Events (SSE).
Omit conversation_id to start a conversation, or provide it to continue an
existing agent-mode conversation. Disconnecting the stream does not cancel the
response; use the cancel response endpoint to stop it.
If the agent has MCP connectors, see MCP connectors for tool calls, tool approvals, and sign-in prompts.
API scopes: genie
Path parameters
- agent_idstringRequiredpath
The ID of the Genie agent.
Request body
- inputarray of objectRequired
Exactly one
messageitem withrole: "user"containing the question, orelicitation_responseitems that answer a prompt. See Answering a prompt.Show child attributesHide child attributes
- typestringRequired
Item type. Use
message.message
- rolestringRequired
Message role. Use
user.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. Required when answering a prompt.
- execution_modestringBeta
The agent mode option for a new conversation. Flash prioritizes response speed on simple tasks. Set
FLASHto use Flash, which must be available for the workspace. Omit the field or setSTANDARDto use standard agent mode.The option is set when the conversation is created and applies to every turn. On a follow-up, omit the field or repeat the conversation's option; a different value fails with
BAD_REQUEST. To switch options, start a new conversation.STANDARDFLASH
- enable_vizboolean
Set to
trueto request visualization generation when visualizations are available and appropriate for the response.
Response events
Every event contains a monotonically increasing sequence_number. The stream
ends with response.completed on success, response.incomplete when the turn is
waiting for the caller, or response.failed on failure. The server-side timeout
is 30 minutes.
- response.createdevent
Sent once when the stream opens.
data.responseis aResponsewithstatus: "in_progress"and emptyoutput.
- response.output_item.addedevent
A new output item appears and might still be in progress.
data.itemis 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.responseis the finalResponsewith all output items.
- response.incompleteevent
Terminal pause. The turn is waiting for the caller, and
data.response.statusis"incomplete". See Prompts.
- response.failedevent
Terminal failure.
data.response.statusis"failed"and includes anerrorobject.
Response
The response uses the text/event-stream content type.
- objectstring
Always
"response".response
- idstring
Unique response ID.
- modelstring
Always
"genie-agent".genie-agent
- statusstring
The response status.
incompletemeans the turn is waiting for the caller. See Prompts.in_progresscompletedincompletefailed
- 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_textcontent 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 withfunction_call_outputbycall_id.
- function_call_outputobject
The query result. Its ID is always
{call_id}_output; when completed,outputcontains the query title followed by a Markdown table.
- messageobject
A user question, assistant report, or system error. Assistant content contains
output_textchunks; table chunks include metadata for columns, preview rows, total row count, status, and SQL.
- mcp_callobject
A call to an MCP connector tool. Contains an opaque
id(ga_mc_…),server_label(the connector),name(the tool),arguments(a JSON string), andstatus. When the call waited for a tool approval,approval_request_idis theidof thatelicitationitem. The connector's output is not returned. See Tool calls.
- elicitationobject
A prompt that waits for the caller. Contains an opaque
id(ga_el_…),elicitation_type(tool_call_approvaloroauth_login), andmessage. A tool approval also containsserver_label,name,display_name, andarguments, where present. A sign-in prompt also containsserver_label(the connector),display_name, andurl, the Databricks sign-in page for the connector. See Prompts.
- 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
statusis"failed".
MCP connectors
This section applies when the agent has MCP connectors attached and a user calls the API. A request from a service principal runs without the agent's MCP connectors.
Tool calls
Each call to an MCP connector tool appears as an mcp_call output item. The
connector's output is not returned. Tools that the connector marks as read-only
run right away. Other tools wait for a tool approval, unless the tool was
approved for the conversation with scope: "session".
An mcp_call has one of these status values:
in_progress: the call is waiting for a tool approval or is running.completed: the call ran.failed: the call returned an error.incomplete: the user declined the call, or the call never ran because its turn failed or was cancelled.
A call's response.output_item.done event is sent when the call finishes and
carries its final status. Before a turn's terminal event, each call that is still
open gets its .done event. A call that waits for a tool approval stays
in_progress and includes its approval_request_id. A call that never ran is
incomplete.
Prompts
A prompt is an elicitation output item that waits for the caller. Its
elicitation_type is one of:
tool_call_approval: the agent wants to run a tool that needs approval. The turn ends withresponse.incomplete, and the responsestatusisincomplete. A new user message is rejected until the approval is answered.oauth_login: the user must sign in to a connector. The prompt is the last item of a turn that ends withresponse.completed. Open the prompt'surlto sign in, then send the question again or answer the prompt withaccept.
Answering a prompt
To answer, send a request with the same conversation_id and, in input, one or
more elicitation_response items in place of a user message. Only the
conversation owner can answer.
Answers must match the prompts of the conversation's latest turn:
- Tool approvals (
tool_call_approval): answer every pending approval on the turn in one request, using exactly the pendingelicitation_idvalues. - Sign-in prompts (
oauth_login): any subset of the turn's sign-in prompts can be answered in one request. - A tool-approval answer and a sign-in answer cannot be sent in the same request.
A tool-approval answer resumes the paused turn, and the response streams the rest of it. Sign-in answers behave as follows:
acceptre-runs the user message that started the prompt's turn as a new turn. The response streams that turn.declineandcancelrun nothing. The response is a completed response with an emptyoutput, and it is not stored in the conversation.accepton a prompt whose turn has no user message to re-run, such as a turn that resumed a tool approval, behaves likedecline.
- typestringRequired
Item type. Use
elicitation_response.elicitation_response
- elicitation_idstringRequired
The
idof theelicitationitem being answered.
- actionstringRequired
For a tool approval,
acceptruns the call anddeclineorcancelstops it.cancelis handled asdecline. For a sign-in prompt, see the rules above.acceptdeclinecancel
- scopestring
Required with
accepton a tool approval.onceapproves this call only.sessionapproves the tool for the rest of the conversation.alwaysis accepted and treated assession. Not used for sign-in prompts.oncesession
- reasonstring
Optional free-text reason for the answer.
Prompt answer errors
| HTTP status | Error code | Description |
|---|---|---|
400 | INVALID_PARAMETER_VALUE | A prompt answer has no conversation_id: conversation_id is required to answer an elicitation. |
400 | INVALID_PARAMETER_VALUE | A new message is sent while a tool approval is pending: This conversation has a pending tool approval. Please respond with an elicitation_response before sending a new message. |
400 | INVALID_PARAMETER_VALUE | The answer's elicitation_id values do not match the pending prompts. The message lists the expected and received ids. |
400 | INVALID_PARAMETER_VALUE | The answered prompt is no longer pending, for example because it was already answered: The answered elicitation is no longer pending: it may have expired or already been answered. |
400 | INVALID_PARAMETER_VALUE | action is not accept, decline, or cancel, or scope is not once, session, or always. |
400 | INVALID_PARAMETER_VALUE | action is accept on a tool approval without a scope: action=accept requires a scope (elicitation_id=…). |
400 | INVALID_PARAMETER_VALUE | A tool-approval answer and a sign-in answer are sent in one request: Answer the tool approval and the sign-in prompt in separate requests. |
400 | INVALID_PARAMETER_VALUE | The same elicitation_id appears more than once in one request. |
403 | PERMISSION_DENIED | The caller is not the conversation owner. |
Errors
| HTTP status | Error code | Description |
|---|---|---|
400 | INVALID_PARAMETER_VALUE | A path parameter is missing, or input is not exactly one message item with role: "user". |
400 | INVALID_PARAMETER_VALUE | A prompt answer is invalid. See Prompt answer errors. |
400 | BAD_REQUEST | execution_mode is not STANDARD or FLASH, or a follow-up sets a different execution_mode than the conversation was created with. |
404 | FEATURE_DISABLED | The workspace is not enrolled or the preview toggle is off, or execution_mode is FLASH and Flash is not available for the workspace. |
403 | PERMISSION_DENIED | The caller lacks CAN QUERY on the Genie agent. |
404 | NOT_FOUND | The Genie agent or conversation does not exist. |
409 | RESOURCE_CONFLICT | A response is already being generated for this conversation. |
429 | RATE_LIMIT_EXCEEDED | The request was rate limited due to detected non-organic usage patterns or resource limitations. |
500 | INTERNAL_ERROR | An unexpected server error occurred. |