Type to search.

Send chat message (streaming)

Base URL
https://{kibana_url}
  • POST /api/agent_builder/converse/async
  • POST /s/{space_id}/api/agent_builder/converse/async
Auth The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Generally available since 9.2 This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

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.

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

conversation_id_set

Sets the conversation ID.

Schema:

JSON
{
  "conversation_id": "uuid"
}

conversation_created

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

Schema:

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

conversation_updated

Fires when a conversation is updated.

Schema:

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

reasoning

Handles reasoning-related data.

Schema:

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

tool_call

Triggers when a tool is invoked.

Schema:

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

tool_progress

Reports progress of a running tool.

Schema:

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

tool_result

Returns results from a completed tool call.

Schema:

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

results is an array of ToolResult objects.


message_chunk

Streams partial text chunks.

Schema:

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

message_complete

Indicates message stream is finished.

Schema:

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

thinking_complete

Marks the end of the thinking/reasoning phase.

Schema:

JSON
{
  "time_to_first_token": 0
}
Note

time_to_first_token is in milliseconds.


round_complete

Marks end of one conversation round.

Schema:

JSON
{
  "round": {}
}
Note

round contains the full round json object.


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

Required privileges

Privileges agentBuilder:read

Path parameters

space_id string optional

An identifier for the space. If space_id is not provided in the URL, the default space is used. Refer to Spaces for more information.

Header parameters

kbn-xsrf string required

A required header to protect against CSRF attacks

Request body

_execution_mode enum The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Experimental since 9.4 This functionality is experimental and is not ready for production usage. Experimental features may change or be removed at any time. Elastic will work to fix any issues, but experimental features are not subject to the support SLA of official GA features. Specific Support terms apply. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

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

Values: local task_manager
action enum deprecated

Deprecated and ignored. The "regenerate" action has been removed; the field is still accepted for backward compatibility.

Values: regenerate
agent_id string · default: elastic-ai-agent

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

connector_id string nullable

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

conversation_id string · max length: 256

Optional existing conversation ID to continue a previous conversation.

execution_id string

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_id string nullable

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

input string · max length: 100000

The user input message to send to the agent.

project_routing string · max length: 2048

Cross-project search routing expression resolved from the header project picker, applied to the run's searches. Serverless (CPS) only; ignored elsewhere.

prompts map string to anyOf

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.

read_only boolean The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

When true, the created conversation is presented as read-only in the UI: its history is shown but no message input is offered. This carries no authorization meaning — the conversation can still be continued through the API. This setting is ignored when continuing an existing conversation.

reasoning_level enum The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Reasoning effort level for the LLM. One of: none, minimal, low, medium, high, xhigh. Support depends on the underlying model and provider.

Values: none minimal low medium high xhigh

Response

200

Indicates a successful response

text/event-stream