v53

latestOpenAPI 3.0.3raw.githubusercontent.com2026-08-076771,7565.2 MB
agent builder

Send chat message (streaming)

Spaces method and path for this operation:

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/converse/async</span></div>

Refer to Spaces for more information.

Send a message to an agent and receive real-time streaming events. This asynchronous endpoint provides live updates as the agent processes your request, allowing you to see intermediate steps and progress. Use this for interactive experiences where you want to monitor the agent's thinking process.

Event types

The endpoint emits Server-Sent Events (SSE) with the following custom event types:

conversation_id_set

Sets the conversation ID.

Schema:

{
  "conversation_id": "uuid"
}

conversation_created

Fires when a new conversation is persisted and assigned an ID.

Schema:

{
  "conversation_id": "uuid",
  "title": "conversation title"
}

conversation_updated

Fires when a conversation is updated.

Schema:

{
  "conversation_id": "uuid",
  "title": "updated conversation title"
}

reasoning

Handles reasoning-related data.

Schema:

{
  "reasoning": "plain text reasoning content",
  "transient": false
}

tool_call

Triggers when a tool is invoked.

Schema:

{
  "tool_call_id": "uuid",
  "tool_id": "tool_name",
  "params": {}
}

tool_progress

Reports progress of a running tool.

Schema:

{
  "tool_call_id": "uuid",
  "message": "progress message"
}

tool_result

Returns results from a completed tool call.

Schema:

{
  "tool_call_id": "uuid",
  "tool_id": "tool_name",
  "results": []
}

Note: results is an array of ToolResult objects.


message_chunk

Streams partial text chunks.

Schema:

{
  "message_id": "uuid",
  "text_chunk": "partial text"
}

message_complete

Indicates message stream is finished.

Schema:

{
  "message_id": "uuid",
  "message_content": "full text content of the message"
}

thinking_complete

Marks the end of the thinking/reasoning phase.

Schema:

{
  "time_to_first_token": 0
}

Note: time_to_first_token is in milliseconds.


round_complete

Marks end of one conversation round.

Schema:

{
  "round": {}
}

Note: round contains the full round json object.


Event flow

A typical conversation round emits events in this sequence:

  1. reasoning (potentially multiple, some transient)
  2. tool_call (if tools are used)
  3. tool_progress (zero or more progress updates)
  4. tool_result (when tool completes)
  5. thinking_complete
  6. message_chunk (multiple, as text streams)
  7. message_complete
  8. round_complete

<br/><br/>[Required authorization] Route required privileges: agentBuilder:read.

post/api/agent_builder/converse/async

Headers

kbn-xsrfstring required
Example:true

A required header to protect against CSRF attacks

Request body

_execution_mode'local' | 'task_manager'

define how to execute the agent (local execution or via task_manager)

action'regenerate'

The action to perform. "regenerate" re-executes the last round with the original input. Requires conversation_id.

agent_idstring

The ID of the agent to chat with. Defaults to the default Elastic AI agent.

connector_idstring nullable

Optional connector ID for the agent to use for model routing. Mutually exclusive with inference_id; omit or use only one.

conversation_idstring

Optional existing conversation ID to continue a previous conversation.

execution_idstring

Optional client-generated execution ID. Provide it to address this execution later (for example, to abort it). Must be unique; defaults to a server-generated ID.

inference_idstring nullable

Optional inference endpoint ID for model routing (public alias for the same internal identifier as connector_id). Mutually exclusive with connector_id.

inputstring

The user input message to send to the agent.

promptsobject

Use this field to respond to a confirmation, authorization, or ask_user_question prompt. Send an allow boolean to answer a confirmation prompt, an authorized boolean to answer an authorization prompt, or an answers array (one entry per question) to answer an ask_user_question prompt.

Response

Indicates a successful response