AgentBuilderClient¶
Client for the Kibana Agent Builder API.
Agent Builder lets you create and manage AI agents, tools, skills and plugins, chat with agents (with conversation persistence and attachments), and expose agents through the A2A and MCP protocols.
The core Agent Builder APIs (agents, tools, conversations, converse, A2A, MCP) are generally available since Kibana 9.2.0. The attachments, consumption, skills and plugins APIs are in technical preview. Chat-related operations (converse, A2A tasks, MCP tool calls) require a configured LLM connector.
Agent Builder resources are space-scoped: every method accepts an optional
space_id to target a specific space.
- class kibana._sync.client.agent_builder.AgentBuilderClient(client, default_space_id=None, validate_spaces=True)[source]¶
Bases:
NamespaceClientClient for the Kibana Agent Builder API.
Agent Builder lets you create and manage AI agents, tools, skills and plugins, chat with agents (with conversation persistence and attachments), and expose agents through the A2A and MCP protocols.
The core Agent Builder APIs (agents, tools, conversations, converse, A2A, MCP) are generally available since Kibana 9.2.0. The attachments, consumption, skills and plugins APIs are in technical preview (added in 9.2.0-9.4.0). Chat-related operations (converse, A2A tasks, MCP tool calls) require a configured LLM connector.
Agent Builder resources are space-scoped: every method accepts an optional
space_idto target a specific space (Nonetargets the default space or the space the client is scoped to).Example
>>> from kibana import Kibana >>> client = Kibana("http://localhost:5601", api_key="...") >>> >>> # Create an ES|QL tool and an agent that can use it >>> client.agent_builder.create_tool( ... id="my_ns.lookup", ... type="esql", ... description="Look up documents", ... configuration={"query": "FROM my-index | LIMIT 10", "params": {}}, ... ) >>> client.agent_builder.create_agent( ... id="my-agent", ... name="My Agent", ... description="Searches my data", ... configuration={"tools": [{"tool_ids": ["my_ns.lookup"]}]}, ... ) >>> >>> # Chat with it (requires an LLM connector) >>> reply = client.agent_builder.converse( ... input="What data do I have?", agent_id="my-agent" ... ) >>> print(reply.body["response"]["message"])
Tools and Agents
from kibana import Kibana client = Kibana("http://localhost:5601", api_key="your_api_key") # Create an ES|QL tool client.agent_builder.create_tool( id="my_ns.lookup", type="esql", description="Look up documents", configuration={"query": "FROM my-index | LIMIT 10", "params": {}}, ) # Create an agent that can use it client.agent_builder.create_agent( id="my-agent", name="My Agent", description="Searches my data", configuration={"tools": [{"tool_ids": ["my_ns.lookup"]}]}, ) # List agents and tools agents = client.agent_builder.list_agents() tools = client.agent_builder.list_tools() for agent in agents.body["results"]: print(agent["id"], agent["name"])
Chatting with Agents
Chat requires a configured LLM connector:
reply = client.agent_builder.converse( input="What data do I have?", agent_id="my-agent", ) print(reply.body["response"]["message"]) # Continue an existing conversation reply = client.agent_builder.converse( input="Show me more.", agent_id="my-agent", conversation_id=reply.body["conversation_id"], ) # Browse persisted conversations conversations = client.agent_builder.list_conversations( agent_id="my-agent" )
Executing Tools Directly
result = client.agent_builder.execute_tool( tool_id="my_ns.lookup", tool_params={}, )
A2A and MCP Protocols
# Fetch the A2A agent card for an agent card = client.agent_builder.get_a2a_card(agent_id="my-agent") # Send a JSON-RPC request to the MCP server endpoint response = client.agent_builder.send_mcp_request( payload={ "jsonrpc": "2.0", "id": 1, "method": "tools/list", } )
Cleaning Up
client.agent_builder.delete_agent(id="my-agent") client.agent_builder.delete_tool(tool_id="my_ns.lookup")
- __init__(client, default_space_id=None, validate_spaces=True)[source]¶
Initialize the AgentBuilderClient.
- Parameters:
Example
>>> agent_builder_client = AgentBuilderClient(kibana_client)
- list_agents(*, space_id=None, validate_spaces=None)[source]¶
List agents.
GET /api/agent_builder/agents. Generally available; added in 9.2.0. Returns all agents visible to the current user, including the built-in Elastic AI agent.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of agent definitions (id,type,name,description,configuration,labels,visibility,readonly…).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> agents = client.agent_builder.list_agents() >>> for agent in agents.body["results"]: ... print(agent["id"], agent["name"])
- create_agent(*, id, name, description, configuration, avatar_color=None, avatar_symbol=None, labels=None, visibility=None, space_id=None, validate_spaces=None)[source]¶
Create an agent.
POST /api/agent_builder/agents. Generally available; added in 9.2.0.- Parameters:
id (str) – Unique identifier for the agent.
name (str) – Display name for the agent.
description (str) – Description of what the agent does.
configuration (dict[str, Any]) – Configuration settings for the agent. Requires a
toolskey (a list of{"tool_ids": [...]}selections) and optionallyinstructions,skill_ids,plugin_ids,workflow_idsandenable_elastic_capabilities.avatar_color (str | None) – Optional hex color code for the agent avatar.
avatar_symbol (str | None) – Optional symbol/initials for the agent avatar.
labels (list[str] | None) – Optional labels for categorizing and organizing agents.
visibility (str | None) – Optional visibility setting:
"public","shared"or"private". Technical preview; added in 9.4.0.space_id (str | None) – Optional space ID to create the agent in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created agent definition.
- Raises:
BadRequestError – If the request body is invalid or the agent ID already exists.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> created = client.agent_builder.create_agent( ... id="search-helper", ... name="Search Helper", ... description="Helps searching content indices", ... configuration={ ... "instructions": "Search indices prefixed content-.", ... "tools": [{"tool_ids": ["platform.core.search"]}], ... }, ... labels=["search"], ... ) >>> print(created.body["id"]) search-helper
- get_agent(*, id, space_id=None, validate_spaces=None)[source]¶
Get an agent by ID.
GET /api/agent_builder/agents/{id}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the agent definition.
- Raises:
NotFoundError – If the agent does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> agent = client.agent_builder.get_agent(id="elastic-ai-agent") >>> print(agent.body["name"]) Elastic AI Agent
- update_agent(*, id, name=None, description=None, configuration=None, avatar_color=None, avatar_symbol=None, labels=None, visibility=None, space_id=None, validate_spaces=None)[source]¶
Update an agent.
PUT /api/agent_builder/agents/{id}. Generally available; added in 9.2.0. Performs a partial update: only the provided fields are changed.- Parameters:
id (str) – The unique identifier of the agent to update.
name (str | None) – Updated display name for the agent.
description (str | None) – Updated description of what the agent does.
configuration (dict[str, Any] | None) – Updated configuration settings for the agent (see
AgentBuilderClient.create_agent()).avatar_color (str | None) – Updated hex color code for the agent avatar.
avatar_symbol (str | None) – Updated symbol/initials for the agent avatar.
labels (list[str] | None) – Updated labels for categorizing and organizing agents.
visibility (str | None) – Updated visibility setting:
"public","shared"or"private". Technical preview; added in 9.4.0.space_id (str | None) – Optional space ID the agent lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated agent definition.
- Raises:
NotFoundError – If the agent does not exist.
BadRequestError – If the request body is invalid or the agent is read-only.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = client.agent_builder.update_agent( ... id="search-helper", description="Updated description" ... ) >>> print(updated.body["description"]) Updated description
- delete_agent(*, id, space_id=None, validate_spaces=None)[source]¶
Delete an agent.
DELETE /api/agent_builder/agents/{id}. Generally available; added in 9.2.0. Built-in (read-only) agents cannot be deleted.- Parameters:
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the agent does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> result = client.agent_builder.delete_agent(id="search-helper") >>> print(result.body["success"]) True
- get_agent_consumption(*, agent_id, has_warnings=None, search=None, search_after=None, size=None, sort_field=None, sort_order=None, usernames=None, space_id=None, validate_spaces=None)[source]¶
Get agent consumption data.
POST /api/agent_builder/agents/{agent_id}/consumption. Technical preview; added in 9.4.0. Returns per-conversation token consumption aggregates for the given agent.- Parameters:
agent_id (str) – The unique identifier of the agent.
has_warnings (bool | None) – Filter to conversations with or without high-token warnings.
search (str | None) – Free-text search filter on conversation title.
search_after (list[Any] | None) – Cursor for pagination. Pass the
search_aftervalue from the previous response.size (int | None) – Number of results per page (1-100, default 25).
sort_field (str | None) – Field to sort results by:
"updated_at","total_tokens"or"round_count"(default"updated_at").sort_order (str | None) – Sort direction:
"asc"or"desc"(default"desc").usernames (list[str] | None) – Filter results to conversations by these usernames.
space_id (str | None) – Optional space ID the agent lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the consumption results and pagination cursor.
- Raises:
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> consumption = client.agent_builder.get_agent_consumption( ... agent_id="elastic-ai-agent", ... size=10, ... sort_field="total_tokens", ... )
- list_tools(*, space_id=None, validate_spaces=None)[source]¶
List tools.
GET /api/agent_builder/tools. Generally available; added in 9.2.0. Returns all tools, including the built-inplatform.*tools.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of tool definitions (id,type,description,tags,configuration,schema,readonly).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> tools = client.agent_builder.list_tools() >>> for tool in tools.body["results"]: ... print(tool["id"], tool["type"])
- create_tool(*, id, type, configuration, description=None, tags=None, space_id=None, validate_spaces=None)[source]¶
Create a tool.
POST /api/agent_builder/tools. Generally available; added in 9.2.0.- Parameters:
id (str) – Unique identifier for the tool. Tool IDs are namespaced with dots (e.g.
"my_namespace.my_tool").type (str) – The type of tool to create:
"esql","index_search","workflow"or"mcp".configuration (dict[str, Any]) – Tool-specific configuration parameters. For an
esqltool:{"query": "FROM idx | LIMIT 10", "params": {}}; for anindex_searchtool:{"pattern": "my-index-*"}.description (str | None) – Description of what the tool does.
tags (list[str] | None) – Optional tags for categorizing and organizing tools.
space_id (str | None) – Optional space ID to create the tool in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created tool definition, including the derived parameter
schema.- Raises:
BadRequestError – If the request body is invalid or the tool ID already exists.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> created = client.agent_builder.create_tool( ... id="my_ns.error_count", ... type="esql", ... description="Count error logs", ... configuration={ ... "query": "FROM logs-* | WHERE level == \"error\" | STATS COUNT(*)", ... "params": {}, ... }, ... ) >>> print(created.body["id"]) my_ns.error_count
- get_tool(*, tool_id, space_id=None, validate_spaces=None)[source]¶
Get a tool by ID.
GET /api/agent_builder/tools/{toolId}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the tool definition.
- Raises:
NotFoundError – If the tool does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> tool = client.agent_builder.get_tool(tool_id="my_ns.error_count") >>> print(tool.body["type"]) esql
- update_tool(*, tool_id, configuration=None, description=None, tags=None, space_id=None, validate_spaces=None)[source]¶
Update a tool.
PUT /api/agent_builder/tools/{toolId}. Generally available; added in 9.2.0. Performs a partial update: only the provided fields are changed. Built-in (read-only) tools cannot be updated.- Parameters:
tool_id (str) – The unique identifier of the tool to update.
configuration (dict[str, Any] | None) – Updated tool-specific configuration parameters.
description (str | None) – Updated description of what the tool does.
tags (list[str] | None) – Updated tags for categorizing and organizing tools.
space_id (str | None) – Optional space ID the tool lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated tool definition.
- Raises:
NotFoundError – If the tool does not exist.
BadRequestError – If the request body is invalid or the tool is read-only.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = client.agent_builder.update_tool( ... tool_id="my_ns.error_count", description="Updated" ... ) >>> print(updated.body["description"]) Updated
- delete_tool(*, tool_id, force=None, space_id=None, validate_spaces=None)[source]¶
Delete a tool.
DELETE /api/agent_builder/tools/{toolId}. Generally available; added in 9.2.0. Built-in (read-only) tools cannot be deleted.- Parameters:
tool_id (str) – The unique identifier of the tool to delete.
force (bool | None) – If
True, removes the tool from agents that use it and then deletes it. IfFalse(default) and any agent uses the tool, the request returns a 409 Conflict with the list of agents.space_id (str | None) – Optional space ID the tool lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the tool does not exist.
ConflictError – If the tool is in use by agents and
forceis not set.AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> result = client.agent_builder.delete_tool( ... tool_id="my_ns.error_count", force=True ... ) >>> print(result.body["success"]) True
- execute_tool(*, tool_id, tool_params, connector_id=None, space_id=None, validate_spaces=None)[source]¶
Run a tool.
POST /api/agent_builder/tools/_execute. Generally available; added in 9.2.0. Executes a tool directly with the given parameters and returns its results. Tools with static configurations (for example an ES|QL tool without parameters) do not require an LLM connector.- Parameters:
tool_id (str) – The ID of the tool to execute.
tool_params (dict[str, Any]) – Parameters to pass to the tool execution. Must match the tool’s parameter
schema(pass{}for tools without parameters).connector_id (str | None) – Optional connector ID for tools that require external integrations.
space_id (str | None) – Optional space ID the tool lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing a
resultslist of typed tool results (for an ES|QL tool: aqueryresult and anesql_resultsresult withcolumnsandvalues).- Raises:
BadRequestError – If the tool does not exist or the parameters do not match the tool schema.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> executed = client.agent_builder.execute_tool( ... tool_id="my_ns.error_count", tool_params={} ... ) >>> for result in executed.body["results"]: ... print(result["type"])
- list_conversations(*, agent_id=None, space_id=None, validate_spaces=None)[source]¶
List conversations.
GET /api/agent_builder/conversations. Generally available; added in 9.2.0. Returns the conversations of the current user, optionally filtered by agent.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of conversations.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> conversations = client.agent_builder.list_conversations( ... agent_id="elastic-ai-agent" ... ) >>> for conversation in conversations.body["results"]: ... print(conversation["id"], conversation["title"])
- get_conversation(*, conversation_id, space_id=None, validate_spaces=None)[source]¶
Get a conversation by ID.
GET /api/agent_builder/conversations/{conversation_id}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the conversation, including its
roundsof user input and agent responses.- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> conversation = client.agent_builder.get_conversation( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16" ... ) >>> print(conversation.body["title"])
- delete_conversation(*, conversation_id, space_id=None, validate_spaces=None)[source]¶
Delete a conversation by ID.
DELETE /api/agent_builder/conversations/{conversation_id}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> client.agent_builder.delete_conversation( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16" ... )
- list_attachments(*, conversation_id, include_deleted=None, space_id=None, validate_spaces=None)[source]¶
List conversation attachments.
GET /api/agent_builder/conversations/{conversation_id}/attachments. Technical preview; added in 9.2.0.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
include_deleted (bool | None) – Whether to include deleted attachments in the list.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the conversation’s attachments.
- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> attachments = client.agent_builder.list_attachments( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... include_deleted=True, ... )
- create_attachment(*, conversation_id, type, data, description=None, hidden=None, id=None, origin=None, space_id=None, validate_spaces=None)[source]¶
Create a conversation attachment.
POST /api/agent_builder/conversations/{conversation_id}/attachments. Technical preview; added in 9.2.0.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
type (str) – The type of the attachment (e.g.
"text","json","esql","visualization").data (Any) – Payload of the attachment (a string for
textattachments, an object forjsonattachments, …).description (str | None) – Human-readable description of the attachment.
hidden (bool | None) – Whether the attachment should be hidden from the user.
id (str | None) – Optional custom ID for the attachment.
origin (str | None) – Origin string (for example, a saved object ID) for by-reference attachments. When provided, the content is resolved once at creation time.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created attachment.
- Raises:
NotFoundError – If the conversation does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> attachment = client.agent_builder.create_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... type="text", ... data="Meeting notes contents", ... description="Meeting notes", ... )
- update_attachment(*, conversation_id, attachment_id, data, description=None, space_id=None, validate_spaces=None)[source]¶
Update a conversation attachment’s content.
PUT /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}. Technical preview; added in 9.2.0. Creates a new version of the attachment with the provided content.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment to update.
data (Any) – The new content for the attachment.
description (str | None) – Optional new description for the attachment.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = client.agent_builder.update_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... data="Updated contents", ... )
- rename_attachment(*, conversation_id, attachment_id, description, space_id=None, validate_spaces=None)[source]¶
Rename a conversation attachment.
PATCH /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}. Technical preview; added in 9.2.0. Updates only the attachment’s description (display name) without creating a new content version.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment to rename.
description (str) – The new description/name for the attachment.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the renamed attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> renamed = client.agent_builder.rename_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... description="Updated attachment name", ... )
- delete_attachment(*, conversation_id, attachment_id, permanent=None, space_id=None, validate_spaces=None)[source]¶
Delete a conversation attachment.
DELETE /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}. Technical preview; added in 9.2.0. By default the attachment is soft-deleted and can be restored withAgentBuilderClient.restore_attachment().- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment to delete.
permanent (bool | None) – If
True, permanently removes the attachment (only for unreferenced attachments).space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse acknowledging the deletion.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> client.agent_builder.delete_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... )
- restore_attachment(*, conversation_id, attachment_id, space_id=None, validate_spaces=None)[source]¶
Restore a soft-deleted conversation attachment.
POST /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}/_restore. Technical preview; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the restored attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> restored = client.agent_builder.restore_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... )
- update_attachment_origin(*, conversation_id, attachment_id, origin, space_id=None, validate_spaces=None)[source]¶
Update a conversation attachment’s origin.
PUT /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}/origin. Technical preview; added in 9.4.0. Links the attachment to an origin (for example a saved object) so its staleness can be tracked.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment.
origin (str) – The origin string (e.g. a saved object ID for visualizations and dashboards).
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = client.agent_builder.update_attachment_origin( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... origin="abc123", ... )
- check_stale_attachments(*, conversation_id, space_id=None, validate_spaces=None)[source]¶
Check attachment staleness for a conversation.
GET /api/agent_builder/conversations/{conversation_id}/attachments/stale. Technical preview; added in 9.4.0. For origin-backed attachments, reports whether the stored content is out of date with respect to its origin; stale entries include the resolved data for resync.- Parameters:
- Returns:
ObjectApiResponse containing an
attachmentslist of{"id", "is_stale", ...}entries.- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> staleness = client.agent_builder.check_stale_attachments( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16" ... ) >>> for entry in staleness.body["attachments"]: ... print(entry["id"], entry["is_stale"])
- converse(*, input=None, agent_id=None, conversation_id=None, connector_id=None, inference_id=None, attachments=None, browser_api_tools=None, capabilities=None, configuration_overrides=None, prompts=None, action=None, execution_mode=None, space_id=None, validate_spaces=None)[source]¶
Send a chat message to an agent.
POST /api/agent_builder/converse. Generally available; added in 9.2.0. Requires a configured LLM connector. The request blocks until the agent produces its final response; useAgentBuilderClient.converse_async()for a streaming server-sent-events variant.- Parameters:
input (str | None) – The user input message to send to the agent.
agent_id (str | None) – The ID of the agent to chat with. Defaults to the built-in Elastic AI agent (
"elastic-ai-agent").conversation_id (str | None) – Optional existing conversation ID to continue a previous conversation.
connector_id (str | None) – Optional connector ID for the agent to use for model routing. Mutually exclusive with
inference_id.inference_id (str | None) – Optional inference endpoint ID for model routing (public alias for the same internal identifier as
connector_id). Mutually exclusive withconnector_id.attachments (list[dict[str, Any]] | None) – Optional attachments to send with the message, each a dict with a required
typeand eitherdataororigin. Technical preview; added in 9.3.0.browser_api_tools (list[dict[str, Any]] | None) – Optional browser API tools to be registered as LLM tools with a
browser.*namespace; each requiresid,descriptionandschema.capabilities (dict[str, Any] | None) – Controls agent capabilities during conversation, e.g.
{"visualizations": True}.configuration_overrides (dict[str, Any] | None) – Runtime configuration overrides (
instructions,tools) applied for this execution only.prompts (dict[str, Any] | None) – Responses to confirmation prompts, keyed by prompt ID:
{"<prompt_id>": {"allow": True}}.action (str | None) – The action to perform.
"regenerate"re-executes the last round with the original input (requiresconversation_id).execution_mode (str | None) – How to execute the agent:
"local"or"task_manager"(sent as_execution_mode). Experimental; added in 9.4.0.space_id (str | None) – Optional space ID to converse in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
conversation_id, the agentresponse(with its finalmessage), the intermediatestepsandround_complete.- Raises:
BadRequestError – If the request body is invalid.
ApiError – If no (working) LLM connector is available.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> reply = client.agent_builder.converse( ... input="What is Elasticsearch?", ... agent_id="elastic-ai-agent", ... ) >>> print(reply.body["response"]["message"])
- converse_async(*, input=None, agent_id=None, conversation_id=None, connector_id=None, inference_id=None, attachments=None, browser_api_tools=None, capabilities=None, configuration_overrides=None, prompts=None, action=None, execution_mode=None, space_id=None, validate_spaces=None)[source]¶
Send a chat message to an agent (streaming).
POST /api/agent_builder/converse/async. Generally available; added in 9.2.0. Requires a configured LLM connector. The server responds withtext/event-streamserver-sent events; the whole stream is read and the raw SSE text is returned as the response body (aTextApiResponseat runtime). Parse theevent:/data:lines to consume the individual events.- Parameters:
input (str | None) – The user input message to send to the agent.
agent_id (str | None) – The ID of the agent to chat with. Defaults to the built-in Elastic AI agent (
"elastic-ai-agent").conversation_id (str | None) – Optional existing conversation ID to continue a previous conversation.
connector_id (str | None) – Optional connector ID for the agent to use for model routing. Mutually exclusive with
inference_id.inference_id (str | None) – Optional inference endpoint ID for model routing (public alias for the same internal identifier as
connector_id). Mutually exclusive withconnector_id.attachments (list[dict[str, Any]] | None) – Optional attachments to send with the message, each a dict with a required
typeand eitherdataororigin. Technical preview; added in 9.3.0.browser_api_tools (list[dict[str, Any]] | None) – Optional browser API tools to be registered as LLM tools with a
browser.*namespace; each requiresid,descriptionandschema.capabilities (dict[str, Any] | None) – Controls agent capabilities during conversation, e.g.
{"visualizations": True}.configuration_overrides (dict[str, Any] | None) – Runtime configuration overrides (
instructions,tools) applied for this execution only.prompts (dict[str, Any] | None) – Responses to confirmation prompts, keyed by prompt ID:
{"<prompt_id>": {"allow": True}}.action (str | None) – The action to perform.
"regenerate"re-executes the last round with the original input (requiresconversation_id).execution_mode (str | None) – How to execute the agent:
"local"or"task_manager"(sent as_execution_mode). Experimental; added in 9.4.0.space_id (str | None) – Optional space ID to converse in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ApiResponse whose body is the raw server-sent-events text (
event: .../data: {...}blocks).- Raises:
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> stream = client.agent_builder.converse_async( ... input="What is Elasticsearch?" ... ) >>> for block in stream.body.split("\n\n"): ... print(block)
- get_a2a_card(*, agent_id, space_id=None, validate_spaces=None)[source]¶
Get an agent’s A2A (Agent2Agent protocol) card.
GET /api/agent_builder/a2a/{agentId}.json. Technical preview; added in 9.2.0. The card describes the agent’s capabilities, skills and endpoint URL for A2A clients.- Parameters:
- Returns:
ObjectApiResponse containing the A2A agent card (
name,description,url,version,protocolVersion,capabilities,skills…).- Raises:
NotFoundError – If the agent does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> card = client.agent_builder.get_a2a_card( ... agent_id="elastic-ai-agent" ... ) >>> print(card.body["protocolVersion"])
- send_a2a_task(*, agent_id, payload, space_id=None, validate_spaces=None)[source]¶
Send an A2A (Agent2Agent protocol) task to an agent.
POST /api/agent_builder/a2a/{agentId}. Technical preview; added in 9.2.0. This endpoint implements the JSON-RPC A2A protocol; it is primarily intended for A2A SDKs rather than direct REST usage. Task execution requires a configured LLM connector.- Parameters:
agent_id (str) – The unique identifier of the agent.
payload (dict[str, Any]) – The JSON-RPC request payload, e.g.
{"jsonrpc": "2.0", "id": "1", "method": "message/send", "params": {"message": {...}}}.space_id (str | None) – Optional space ID the agent lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the JSON-RPC response.
- Raises:
NotFoundError – If the agent does not exist.
BadRequestError – If the payload is not a valid JSON-RPC request.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> response = client.agent_builder.send_a2a_task( ... agent_id="elastic-ai-agent", ... payload={ ... "jsonrpc": "2.0", ... "id": "task-1", ... "method": "message/send", ... "params": { ... "message": { ... "role": "user", ... "parts": [{"kind": "text", "text": "Hello"}], ... "messageId": "msg-1", ... } ... }, ... }, ... ) >>> print(response.body["result"])
- send_mcp_request(*, payload, namespace=None, space_id=None, validate_spaces=None)[source]¶
Send a request to the MCP (Model Context Protocol) server.
POST /api/agent_builder/mcp. Technical preview; added in 9.2.0. This endpoint implements the streamable-HTTP MCP transport (JSON-RPC); it is primarily intended for MCP clients rather than direct REST usage. The live server requires theAcceptheader to include bothapplication/jsonandtext/event-stream(set automatically). Tool calls that need an LLM require a configured connector;initializeandtools/listwork without one.- Parameters:
payload (dict[str, Any]) – The JSON-RPC request payload, e.g.
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {...}}.namespace (str | None) – Comma-separated list of namespaces to filter tools. Only tools matching the specified namespaces will be returned.
space_id (str | None) – Optional space ID to target.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the JSON-RPC response.
- Raises:
BadRequestError – If the payload is not a valid JSON-RPC request.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> response = client.agent_builder.send_mcp_request( ... payload={ ... "jsonrpc": "2.0", ... "id": 1, ... "method": "initialize", ... "params": { ... "protocolVersion": "2024-11-05", ... "capabilities": {}, ... "clientInfo": {"name": "my-client", "version": "1.0"}, ... }, ... }, ... ) >>> print(response.body["result"]["serverInfo"]["name"]) elastic-mcp-server
- list_skills(*, include_plugins=None, space_id=None, validate_spaces=None)[source]¶
List skills.
GET /api/agent_builder/skills. Technical preview; added in 9.4.0.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of skill definitions (id,name,description,tool_ids,readonly…).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> skills = client.agent_builder.list_skills() >>> for skill in skills.body["results"]: ... print(skill["id"])
- create_skill(*, id, name, description, content, referenced_content=None, tool_ids=None, space_id=None, validate_spaces=None)[source]¶
Create a skill.
POST /api/agent_builder/skills. Technical preview; added in 9.4.0. A skill packages reusable instructions (markdown) and tool references that agents can leverage.- Parameters:
id (str) – Unique identifier for the skill.
name (str) – Human-readable name for the skill.
description (str) – Description of what the skill does.
content (str) – Skill instructions content (markdown).
referenced_content (list[dict[str, Any]] | None) – Optional list of referenced content entries, each with
name,relativePathandcontent.tool_ids (list[str] | None) – Tool IDs from the tool registry that this skill references.
space_id (str | None) – Optional space ID to create the skill in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created skill definition.
- Raises:
BadRequestError – If the request body is invalid or the skill ID already exists.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> created = client.agent_builder.create_skill( ... id="triage-errors", ... name="Triage errors", ... description="How to triage application errors", ... content="# Triage\n1. Check the error rate...", ... tool_ids=["platform.core.search"], ... ) >>> print(created.body["id"]) triage-errors
- get_skill(*, skill_id, space_id=None, validate_spaces=None)[source]¶
Get a skill by ID.
GET /api/agent_builder/skills/{skillId}. Technical preview; added in 9.4.0.- Parameters:
- Returns:
ObjectApiResponse containing the skill definition.
- Raises:
NotFoundError – If the skill does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> skill = client.agent_builder.get_skill(skill_id="triage-errors") >>> print(skill.body["name"]) Triage errors
- update_skill(*, skill_id, name=None, description=None, content=None, referenced_content=None, tool_ids=None, space_id=None, validate_spaces=None)[source]¶
Update a skill.
PUT /api/agent_builder/skills/{skillId}. Technical preview; added in 9.4.0. Performs a partial update: only the provided fields are changed. Built-in (read-only) skills cannot be updated.- Parameters:
skill_id (str) – The unique identifier of the skill to update.
name (str | None) – Updated name for the skill.
description (str | None) – Updated description.
content (str | None) – Updated skill instructions content.
referenced_content (list[dict[str, Any]] | None) – Updated list of referenced content entries, each with
name,relativePathandcontent.tool_ids (list[str] | None) – Updated tool IDs from the tool registry.
space_id (str | None) – Optional space ID the skill lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated skill definition.
- Raises:
NotFoundError – If the skill does not exist.
BadRequestError – If the request body is invalid or the skill is read-only.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = client.agent_builder.update_skill( ... skill_id="triage-errors", description="Updated" ... ) >>> print(updated.body["description"]) Updated
- delete_skill(*, skill_id, force=None, space_id=None, validate_spaces=None)[source]¶
Delete a skill.
DELETE /api/agent_builder/skills/{skillId}. Technical preview; added in 9.4.0. Built-in (read-only) skills cannot be deleted.- Parameters:
skill_id (str) – The unique identifier of the skill to delete.
force (bool | None) – If
True, removes the skill from agents that use it and then deletes it.space_id (str | None) – Optional space ID the skill lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the skill does not exist.
ConflictError – If the skill is in use by agents and
forceis not set.AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> result = client.agent_builder.delete_skill( ... skill_id="triage-errors" ... ) >>> print(result.body["success"]) True
- list_plugins(*, space_id=None, validate_spaces=None)[source]¶
List plugins.
GET /api/agent_builder/plugins. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
- Returns:
ObjectApiResponse containing the installed Agent Builder plugins.
- Raises:
NotFoundError – If the plugins API is not enabled.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> plugins = client.agent_builder.list_plugins()
- get_plugin(*, plugin_id, space_id=None, validate_spaces=None)[source]¶
Get a plugin by ID.
GET /api/agent_builder/plugins/{pluginId}. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
- Returns:
ObjectApiResponse containing the plugin definition.
- Raises:
NotFoundError – If the plugin does not exist or the plugins API is not enabled.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> plugin = client.agent_builder.get_plugin(plugin_id="my-plugin")
- install_plugin(*, url, plugin_name=None, space_id=None, validate_spaces=None)[source]¶
Install a plugin.
POST /api/agent_builder/plugins/install. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
url (str) – URL to install the plugin from (GitHub URL or direct zip URL).
plugin_name (str | None) – Optional name override for the plugin. Defaults to the manifest name.
space_id (str | None) – Optional space ID to install the plugin in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the installed plugin definition.
- Raises:
NotFoundError – If the plugins API is not enabled.
BadRequestError – If the URL or plugin package is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> installed = client.agent_builder.install_plugin( ... url="https://github.com/example/agent-plugin" ... )
- delete_plugin(*, plugin_id, force=None, space_id=None, validate_spaces=None)[source]¶
Delete a plugin.
DELETE /api/agent_builder/plugins/{pluginId}. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
- Returns:
ObjectApiResponse acknowledging the deletion.
- Raises:
NotFoundError – If the plugin does not exist or the plugins API is not enabled.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> client.agent_builder.delete_plugin(plugin_id="my-plugin")
AsyncAgentBuilderClient¶
Asynchronous version of the AgentBuilderClient for use with async/await syntax.
- class kibana._async.client.agent_builder.AsyncAgentBuilderClient(client, default_space_id=None, validate_spaces=True)[source]¶
Bases:
AsyncNamespaceClientAsync client for the Kibana Agent Builder API.
Agent Builder lets you create and manage AI agents, tools, skills and plugins, chat with agents (with conversation persistence and attachments), and expose agents through the A2A and MCP protocols.
The core Agent Builder APIs (agents, tools, conversations, converse, A2A, MCP) are generally available since Kibana 9.2.0. The attachments, consumption, skills and plugins APIs are in technical preview (added in 9.2.0-9.4.0). Chat-related operations (converse, A2A tasks, MCP tool calls) require a configured LLM connector.
Agent Builder resources are space-scoped: every method accepts an optional
space_idto target a specific space (Nonetargets the default space or the space the client is scoped to).Example
>>> from kibana import AsyncKibana >>> client = AsyncKibana("http://localhost:5601", api_key="...") >>> >>> # Create an ES|QL tool and an agent that can use it >>> await client.agent_builder.create_tool( ... id="my_ns.lookup", ... type="esql", ... description="Look up documents", ... configuration={"query": "FROM my-index | LIMIT 10", "params": {}}, ... ) >>> await client.agent_builder.create_agent( ... id="my-agent", ... name="My Agent", ... description="Searches my data", ... configuration={"tools": [{"tool_ids": ["my_ns.lookup"]}]}, ... ) >>> >>> # Chat with it (requires an LLM connector) >>> reply = await client.agent_builder.converse( ... input="What data do I have?", agent_id="my-agent" ... ) >>> print(reply.body["response"]["message"])
Usage
The AsyncAgentBuilderClient provides the same methods as AgentBuilderClient but all methods are async and must be awaited:
from kibana import AsyncKibana import asyncio async def main(): async with AsyncKibana("http://localhost:5601") as client: # List agents and tools concurrently agents, tools = await asyncio.gather( client.agent_builder.list_agents(), client.agent_builder.list_tools(), ) # Chat with an agent (async, requires an LLM connector) reply = await client.agent_builder.converse( input="What data do I have?", agent_id="my-agent", ) asyncio.run(main())
- __init__(client, default_space_id=None, validate_spaces=True)[source]¶
Initialize the AsyncAgentBuilderClient.
- Parameters:
client (AsyncKibana) – The parent AsyncKibana client instance to delegate requests to.
default_space_id (str | None) – Optional default space ID for all operations.
validate_spaces (bool) – Whether to validate space existence before space-scoped operations (default: True).
Example
>>> agent_builder_client = AsyncAgentBuilderClient(async_kibana_client)
- async list_agents(*, space_id=None, validate_spaces=None)[source]¶
List agents.
GET /api/agent_builder/agents. Generally available; added in 9.2.0. Returns all agents visible to the current user, including the built-in Elastic AI agent.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of agent definitions (id,type,name,description,configuration,labels,visibility,readonly…).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> agents = await client.agent_builder.list_agents() >>> for agent in agents.body["results"]: ... print(agent["id"], agent["name"])
- async create_agent(*, id, name, description, configuration, avatar_color=None, avatar_symbol=None, labels=None, visibility=None, space_id=None, validate_spaces=None)[source]¶
Create an agent.
POST /api/agent_builder/agents. Generally available; added in 9.2.0.- Parameters:
id (str) – Unique identifier for the agent.
name (str) – Display name for the agent.
description (str) – Description of what the agent does.
configuration (dict[str, Any]) – Configuration settings for the agent. Requires a
toolskey (a list of{"tool_ids": [...]}selections) and optionallyinstructions,skill_ids,plugin_ids,workflow_idsandenable_elastic_capabilities.avatar_color (str | None) – Optional hex color code for the agent avatar.
avatar_symbol (str | None) – Optional symbol/initials for the agent avatar.
labels (list[str] | None) – Optional labels for categorizing and organizing agents.
visibility (str | None) – Optional visibility setting:
"public","shared"or"private". Technical preview; added in 9.4.0.space_id (str | None) – Optional space ID to create the agent in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created agent definition.
- Raises:
BadRequestError – If the request body is invalid or the agent ID already exists.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> created = await client.agent_builder.create_agent( ... id="search-helper", ... name="Search Helper", ... description="Helps searching content indices", ... configuration={ ... "instructions": "Search indices prefixed content-.", ... "tools": [{"tool_ids": ["platform.core.search"]}], ... }, ... labels=["search"], ... ) >>> print(created.body["id"]) search-helper
- async get_agent(*, id, space_id=None, validate_spaces=None)[source]¶
Get an agent by ID.
GET /api/agent_builder/agents/{id}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the agent definition.
- Raises:
NotFoundError – If the agent does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> agent = await client.agent_builder.get_agent(id="elastic-ai-agent") >>> print(agent.body["name"]) Elastic AI Agent
- async update_agent(*, id, name=None, description=None, configuration=None, avatar_color=None, avatar_symbol=None, labels=None, visibility=None, space_id=None, validate_spaces=None)[source]¶
Update an agent.
PUT /api/agent_builder/agents/{id}. Generally available; added in 9.2.0. Performs a partial update: only the provided fields are changed.- Parameters:
id (str) – The unique identifier of the agent to update.
name (str | None) – Updated display name for the agent.
description (str | None) – Updated description of what the agent does.
configuration (dict[str, Any] | None) – Updated configuration settings for the agent (see
AsyncAgentBuilderClient.create_agent()).avatar_color (str | None) – Updated hex color code for the agent avatar.
avatar_symbol (str | None) – Updated symbol/initials for the agent avatar.
labels (list[str] | None) – Updated labels for categorizing and organizing agents.
visibility (str | None) – Updated visibility setting:
"public","shared"or"private". Technical preview; added in 9.4.0.space_id (str | None) – Optional space ID the agent lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated agent definition.
- Raises:
NotFoundError – If the agent does not exist.
BadRequestError – If the request body is invalid or the agent is read-only.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = await client.agent_builder.update_agent( ... id="search-helper", description="Updated description" ... ) >>> print(updated.body["description"]) Updated description
- async delete_agent(*, id, space_id=None, validate_spaces=None)[source]¶
Delete an agent.
DELETE /api/agent_builder/agents/{id}. Generally available; added in 9.2.0. Built-in (read-only) agents cannot be deleted.- Parameters:
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the agent does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> result = await client.agent_builder.delete_agent(id="search-helper") >>> print(result.body["success"]) True
- async get_agent_consumption(*, agent_id, has_warnings=None, search=None, search_after=None, size=None, sort_field=None, sort_order=None, usernames=None, space_id=None, validate_spaces=None)[source]¶
Get agent consumption data.
POST /api/agent_builder/agents/{agent_id}/consumption. Technical preview; added in 9.4.0. Returns per-conversation token consumption aggregates for the given agent.- Parameters:
agent_id (str) – The unique identifier of the agent.
has_warnings (bool | None) – Filter to conversations with or without high-token warnings.
search (str | None) – Free-text search filter on conversation title.
search_after (list[Any] | None) – Cursor for pagination. Pass the
search_aftervalue from the previous response.size (int | None) – Number of results per page (1-100, default 25).
sort_field (str | None) – Field to sort results by:
"updated_at","total_tokens"or"round_count"(default"updated_at").sort_order (str | None) – Sort direction:
"asc"or"desc"(default"desc").usernames (list[str] | None) – Filter results to conversations by these usernames.
space_id (str | None) – Optional space ID the agent lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the consumption results and pagination cursor.
- Raises:
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> consumption = await client.agent_builder.get_agent_consumption( ... agent_id="elastic-ai-agent", ... size=10, ... sort_field="total_tokens", ... )
- async list_tools(*, space_id=None, validate_spaces=None)[source]¶
List tools.
GET /api/agent_builder/tools. Generally available; added in 9.2.0. Returns all tools, including the built-inplatform.*tools.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of tool definitions (id,type,description,tags,configuration,schema,readonly).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> tools = await client.agent_builder.list_tools() >>> for tool in tools.body["results"]: ... print(tool["id"], tool["type"])
- async create_tool(*, id, type, configuration, description=None, tags=None, space_id=None, validate_spaces=None)[source]¶
Create a tool.
POST /api/agent_builder/tools. Generally available; added in 9.2.0.- Parameters:
id (str) – Unique identifier for the tool. Tool IDs are namespaced with dots (e.g.
"my_namespace.my_tool").type (str) – The type of tool to create:
"esql","index_search","workflow"or"mcp".configuration (dict[str, Any]) – Tool-specific configuration parameters. For an
esqltool:{"query": "FROM idx | LIMIT 10", "params": {}}; for anindex_searchtool:{"pattern": "my-index-*"}.description (str | None) – Description of what the tool does.
tags (list[str] | None) – Optional tags for categorizing and organizing tools.
space_id (str | None) – Optional space ID to create the tool in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created tool definition, including the derived parameter
schema.- Raises:
BadRequestError – If the request body is invalid or the tool ID already exists.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> created = await client.agent_builder.create_tool( ... id="my_ns.error_count", ... type="esql", ... description="Count error logs", ... configuration={ ... "query": "FROM logs-* | WHERE level == \"error\" | STATS COUNT(*)", ... "params": {}, ... }, ... ) >>> print(created.body["id"]) my_ns.error_count
- async get_tool(*, tool_id, space_id=None, validate_spaces=None)[source]¶
Get a tool by ID.
GET /api/agent_builder/tools/{toolId}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the tool definition.
- Raises:
NotFoundError – If the tool does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> tool = await client.agent_builder.get_tool(tool_id="my_ns.error_count") >>> print(tool.body["type"]) esql
- async update_tool(*, tool_id, configuration=None, description=None, tags=None, space_id=None, validate_spaces=None)[source]¶
Update a tool.
PUT /api/agent_builder/tools/{toolId}. Generally available; added in 9.2.0. Performs a partial update: only the provided fields are changed. Built-in (read-only) tools cannot be updated.- Parameters:
tool_id (str) – The unique identifier of the tool to update.
configuration (dict[str, Any] | None) – Updated tool-specific configuration parameters.
description (str | None) – Updated description of what the tool does.
tags (list[str] | None) – Updated tags for categorizing and organizing tools.
space_id (str | None) – Optional space ID the tool lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated tool definition.
- Raises:
NotFoundError – If the tool does not exist.
BadRequestError – If the request body is invalid or the tool is read-only.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = await client.agent_builder.update_tool( ... tool_id="my_ns.error_count", description="Updated" ... ) >>> print(updated.body["description"]) Updated
- async delete_tool(*, tool_id, force=None, space_id=None, validate_spaces=None)[source]¶
Delete a tool.
DELETE /api/agent_builder/tools/{toolId}. Generally available; added in 9.2.0. Built-in (read-only) tools cannot be deleted.- Parameters:
tool_id (str) – The unique identifier of the tool to delete.
force (bool | None) – If
True, removes the tool from agents that use it and then deletes it. IfFalse(default) and any agent uses the tool, the request returns a 409 Conflict with the list of agents.space_id (str | None) – Optional space ID the tool lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the tool does not exist.
ConflictError – If the tool is in use by agents and
forceis not set.AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> result = await client.agent_builder.delete_tool( ... tool_id="my_ns.error_count", force=True ... ) >>> print(result.body["success"]) True
- async execute_tool(*, tool_id, tool_params, connector_id=None, space_id=None, validate_spaces=None)[source]¶
Run a tool.
POST /api/agent_builder/tools/_execute. Generally available; added in 9.2.0. Executes a tool directly with the given parameters and returns its results. Tools with static configurations (for example an ES|QL tool without parameters) do not require an LLM connector.- Parameters:
tool_id (str) – The ID of the tool to execute.
tool_params (dict[str, Any]) – Parameters to pass to the tool execution. Must match the tool’s parameter
schema(pass{}for tools without parameters).connector_id (str | None) – Optional connector ID for tools that require external integrations.
space_id (str | None) – Optional space ID the tool lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing a
resultslist of typed tool results (for an ES|QL tool: aqueryresult and anesql_resultsresult withcolumnsandvalues).- Raises:
BadRequestError – If the tool does not exist or the parameters do not match the tool schema.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> executed = await client.agent_builder.execute_tool( ... tool_id="my_ns.error_count", tool_params={} ... ) >>> for result in executed.body["results"]: ... print(result["type"])
- async list_conversations(*, agent_id=None, space_id=None, validate_spaces=None)[source]¶
List conversations.
GET /api/agent_builder/conversations. Generally available; added in 9.2.0. Returns the conversations of the current user, optionally filtered by agent.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of conversations.- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> conversations = await client.agent_builder.list_conversations( ... agent_id="elastic-ai-agent" ... ) >>> for conversation in conversations.body["results"]: ... print(conversation["id"], conversation["title"])
- async get_conversation(*, conversation_id, space_id=None, validate_spaces=None)[source]¶
Get a conversation by ID.
GET /api/agent_builder/conversations/{conversation_id}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the conversation, including its
roundsof user input and agent responses.- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> conversation = await client.agent_builder.get_conversation( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16" ... ) >>> print(conversation.body["title"])
- async delete_conversation(*, conversation_id, space_id=None, validate_spaces=None)[source]¶
Delete a conversation by ID.
DELETE /api/agent_builder/conversations/{conversation_id}. Generally available; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> await client.agent_builder.delete_conversation( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16" ... )
- async list_attachments(*, conversation_id, include_deleted=None, space_id=None, validate_spaces=None)[source]¶
List conversation attachments.
GET /api/agent_builder/conversations/{conversation_id}/attachments. Technical preview; added in 9.2.0.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
include_deleted (bool | None) – Whether to include deleted attachments in the list.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the conversation’s attachments.
- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> attachments = await client.agent_builder.list_attachments( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... include_deleted=True, ... )
- async create_attachment(*, conversation_id, type, data, description=None, hidden=None, id=None, origin=None, space_id=None, validate_spaces=None)[source]¶
Create a conversation attachment.
POST /api/agent_builder/conversations/{conversation_id}/attachments. Technical preview; added in 9.2.0.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
type (str) – The type of the attachment (e.g.
"text","json","esql","visualization").data (Any) – Payload of the attachment (a string for
textattachments, an object forjsonattachments, …).description (str | None) – Human-readable description of the attachment.
hidden (bool | None) – Whether the attachment should be hidden from the user.
id (str | None) – Optional custom ID for the attachment.
origin (str | None) – Origin string (for example, a saved object ID) for by-reference attachments. When provided, the content is resolved once at creation time.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created attachment.
- Raises:
NotFoundError – If the conversation does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> attachment = await client.agent_builder.create_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... type="text", ... data="Meeting notes contents", ... description="Meeting notes", ... )
- async update_attachment(*, conversation_id, attachment_id, data, description=None, space_id=None, validate_spaces=None)[source]¶
Update a conversation attachment’s content.
PUT /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}. Technical preview; added in 9.2.0. Creates a new version of the attachment with the provided content.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment to update.
data (Any) – The new content for the attachment.
description (str | None) – Optional new description for the attachment.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = await client.agent_builder.update_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... data="Updated contents", ... )
- async rename_attachment(*, conversation_id, attachment_id, description, space_id=None, validate_spaces=None)[source]¶
Rename a conversation attachment.
PATCH /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}. Technical preview; added in 9.2.0. Updates only the attachment’s description (display name) without creating a new content version.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment to rename.
description (str) – The new description/name for the attachment.
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the renamed attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> renamed = await client.agent_builder.rename_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... description="Updated attachment name", ... )
- async delete_attachment(*, conversation_id, attachment_id, permanent=None, space_id=None, validate_spaces=None)[source]¶
Delete a conversation attachment.
DELETE /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}. Technical preview; added in 9.2.0. By default the attachment is soft-deleted and can be restored withAsyncAgentBuilderClient.restore_attachment().- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment to delete.
permanent (bool | None) – If
True, permanently removes the attachment (only for unreferenced attachments).space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse acknowledging the deletion.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> await client.agent_builder.delete_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... )
- async restore_attachment(*, conversation_id, attachment_id, space_id=None, validate_spaces=None)[source]¶
Restore a soft-deleted conversation attachment.
POST /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}/_restore. Technical preview; added in 9.2.0.- Parameters:
- Returns:
ObjectApiResponse containing the restored attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> restored = await client.agent_builder.restore_attachment( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... )
- async update_attachment_origin(*, conversation_id, attachment_id, origin, space_id=None, validate_spaces=None)[source]¶
Update a conversation attachment’s origin.
PUT /api/agent_builder/conversations/{conversation_id}/attachments/{attachment_id}/origin. Technical preview; added in 9.4.0. Links the attachment to an origin (for example a saved object) so its staleness can be tracked.- Parameters:
conversation_id (str) – The unique identifier of the conversation.
attachment_id (str) – The unique identifier of the attachment.
origin (str) – The origin string (e.g. a saved object ID for visualizations and dashboards).
space_id (str | None) – Optional space ID the conversation lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated attachment.
- Raises:
NotFoundError – If the conversation or attachment does not exist.
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = await client.agent_builder.update_attachment_origin( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16", ... attachment_id="att-1", ... origin="abc123", ... )
- async check_stale_attachments(*, conversation_id, space_id=None, validate_spaces=None)[source]¶
Check attachment staleness for a conversation.
GET /api/agent_builder/conversations/{conversation_id}/attachments/stale. Technical preview; added in 9.4.0. For origin-backed attachments, reports whether the stored content is out of date with respect to its origin; stale entries include the resolved data for resync.- Parameters:
- Returns:
ObjectApiResponse containing an
attachmentslist of{"id", "is_stale", ...}entries.- Raises:
NotFoundError – If the conversation does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> staleness = await client.agent_builder.check_stale_attachments( ... conversation_id="696ccd6d-4bff-4b26-a62e-522ccf2dcd16" ... ) >>> for entry in staleness.body["attachments"]: ... print(entry["id"], entry["is_stale"])
- async converse(*, input=None, agent_id=None, conversation_id=None, connector_id=None, inference_id=None, attachments=None, browser_api_tools=None, capabilities=None, configuration_overrides=None, prompts=None, action=None, execution_mode=None, space_id=None, validate_spaces=None)[source]¶
Send a chat message to an agent.
POST /api/agent_builder/converse. Generally available; added in 9.2.0. Requires a configured LLM connector. The request blocks until the agent produces its final response; useAsyncAgentBuilderClient.converse_async()for a streaming server-sent-events variant.- Parameters:
input (str | None) – The user input message to send to the agent.
agent_id (str | None) – The ID of the agent to chat with. Defaults to the built-in Elastic AI agent (
"elastic-ai-agent").conversation_id (str | None) – Optional existing conversation ID to continue a previous conversation.
connector_id (str | None) – Optional connector ID for the agent to use for model routing. Mutually exclusive with
inference_id.inference_id (str | None) – Optional inference endpoint ID for model routing (public alias for the same internal identifier as
connector_id). Mutually exclusive withconnector_id.attachments (list[dict[str, Any]] | None) – Optional attachments to send with the message, each a dict with a required
typeand eitherdataororigin. Technical preview; added in 9.3.0.browser_api_tools (list[dict[str, Any]] | None) – Optional browser API tools to be registered as LLM tools with a
browser.*namespace; each requiresid,descriptionandschema.capabilities (dict[str, Any] | None) – Controls agent capabilities during conversation, e.g.
{"visualizations": True}.configuration_overrides (dict[str, Any] | None) – Runtime configuration overrides (
instructions,tools) applied for this execution only.prompts (dict[str, Any] | None) – Responses to confirmation prompts, keyed by prompt ID:
{"<prompt_id>": {"allow": True}}.action (str | None) – The action to perform.
"regenerate"re-executes the last round with the original input (requiresconversation_id).execution_mode (str | None) – How to execute the agent:
"local"or"task_manager"(sent as_execution_mode). Experimental; added in 9.4.0.space_id (str | None) – Optional space ID to converse in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
conversation_id, the agentresponse(with its finalmessage), the intermediatestepsandround_complete.- Raises:
BadRequestError – If the request body is invalid.
ApiError – If no (working) LLM connector is available.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> reply = await client.agent_builder.converse( ... input="What is Elasticsearch?", ... agent_id="elastic-ai-agent", ... ) >>> print(reply.body["response"]["message"])
- async converse_async(*, input=None, agent_id=None, conversation_id=None, connector_id=None, inference_id=None, attachments=None, browser_api_tools=None, capabilities=None, configuration_overrides=None, prompts=None, action=None, execution_mode=None, space_id=None, validate_spaces=None)[source]¶
Send a chat message to an agent (streaming).
POST /api/agent_builder/converse/async. Generally available; added in 9.2.0. Requires a configured LLM connector. The server responds withtext/event-streamserver-sent events; the whole stream is read and the raw SSE text is returned as the response body (aTextApiResponseat runtime). Parse theevent:/data:lines to consume the individual events.- Parameters:
input (str | None) – The user input message to send to the agent.
agent_id (str | None) – The ID of the agent to chat with. Defaults to the built-in Elastic AI agent (
"elastic-ai-agent").conversation_id (str | None) – Optional existing conversation ID to continue a previous conversation.
connector_id (str | None) – Optional connector ID for the agent to use for model routing. Mutually exclusive with
inference_id.inference_id (str | None) – Optional inference endpoint ID for model routing (public alias for the same internal identifier as
connector_id). Mutually exclusive withconnector_id.attachments (list[dict[str, Any]] | None) – Optional attachments to send with the message, each a dict with a required
typeand eitherdataororigin. Technical preview; added in 9.3.0.browser_api_tools (list[dict[str, Any]] | None) – Optional browser API tools to be registered as LLM tools with a
browser.*namespace; each requiresid,descriptionandschema.capabilities (dict[str, Any] | None) – Controls agent capabilities during conversation, e.g.
{"visualizations": True}.configuration_overrides (dict[str, Any] | None) – Runtime configuration overrides (
instructions,tools) applied for this execution only.prompts (dict[str, Any] | None) – Responses to confirmation prompts, keyed by prompt ID:
{"<prompt_id>": {"allow": True}}.action (str | None) – The action to perform.
"regenerate"re-executes the last round with the original input (requiresconversation_id).execution_mode (str | None) – How to execute the agent:
"local"or"task_manager"(sent as_execution_mode). Experimental; added in 9.4.0.space_id (str | None) – Optional space ID to converse in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ApiResponse whose body is the raw server-sent-events text (
event: .../data: {...}blocks).- Raises:
BadRequestError – If the request body is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> stream = await client.agent_builder.converse_async( ... input="What is Elasticsearch?" ... ) >>> for block in stream.body.split("\n\n"): ... print(block)
- async get_a2a_card(*, agent_id, space_id=None, validate_spaces=None)[source]¶
Get an agent’s A2A (Agent2Agent protocol) card.
GET /api/agent_builder/a2a/{agentId}.json. Technical preview; added in 9.2.0. The card describes the agent’s capabilities, skills and endpoint URL for A2A clients.- Parameters:
- Returns:
ObjectApiResponse containing the A2A agent card (
name,description,url,version,protocolVersion,capabilities,skills…).- Raises:
NotFoundError – If the agent does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> card = await client.agent_builder.get_a2a_card( ... agent_id="elastic-ai-agent" ... ) >>> print(card.body["protocolVersion"])
- async send_a2a_task(*, agent_id, payload, space_id=None, validate_spaces=None)[source]¶
Send an A2A (Agent2Agent protocol) task to an agent.
POST /api/agent_builder/a2a/{agentId}. Technical preview; added in 9.2.0. This endpoint implements the JSON-RPC A2A protocol; it is primarily intended for A2A SDKs rather than direct REST usage. Task execution requires a configured LLM connector.- Parameters:
agent_id (str) – The unique identifier of the agent.
payload (dict[str, Any]) – The JSON-RPC request payload, e.g.
{"jsonrpc": "2.0", "id": "1", "method": "message/send", "params": {"message": {...}}}.space_id (str | None) – Optional space ID the agent lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the JSON-RPC response.
- Raises:
NotFoundError – If the agent does not exist.
BadRequestError – If the payload is not a valid JSON-RPC request.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> response = await client.agent_builder.send_a2a_task( ... agent_id="elastic-ai-agent", ... payload={ ... "jsonrpc": "2.0", ... "id": "task-1", ... "method": "message/send", ... "params": { ... "message": { ... "role": "user", ... "parts": [{"kind": "text", "text": "Hello"}], ... "messageId": "msg-1", ... } ... }, ... }, ... ) >>> print(response.body["result"])
- async send_mcp_request(*, payload, namespace=None, space_id=None, validate_spaces=None)[source]¶
Send a request to the MCP (Model Context Protocol) server.
POST /api/agent_builder/mcp. Technical preview; added in 9.2.0. This endpoint implements the streamable-HTTP MCP transport (JSON-RPC); it is primarily intended for MCP clients rather than direct REST usage. The live server requires theAcceptheader to include bothapplication/jsonandtext/event-stream(set automatically). Tool calls that need an LLM require a configured connector;initializeandtools/listwork without one.- Parameters:
payload (dict[str, Any]) – The JSON-RPC request payload, e.g.
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {...}}.namespace (str | None) – Comma-separated list of namespaces to filter tools. Only tools matching the specified namespaces will be returned.
space_id (str | None) – Optional space ID to target.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the JSON-RPC response.
- Raises:
BadRequestError – If the payload is not a valid JSON-RPC request.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> response = await client.agent_builder.send_mcp_request( ... payload={ ... "jsonrpc": "2.0", ... "id": 1, ... "method": "initialize", ... "params": { ... "protocolVersion": "2024-11-05", ... "capabilities": {}, ... "clientInfo": {"name": "my-client", "version": "1.0"}, ... }, ... }, ... ) >>> print(response.body["result"]["serverInfo"]["name"]) elastic-mcp-server
- async list_skills(*, include_plugins=None, space_id=None, validate_spaces=None)[source]¶
List skills.
GET /api/agent_builder/skills. Technical preview; added in 9.4.0.- Parameters:
- Returns:
ObjectApiResponse containing a
resultslist of skill definitions (id,name,description,tool_ids,readonly…).- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> skills = await client.agent_builder.list_skills() >>> for skill in skills.body["results"]: ... print(skill["id"])
- async create_skill(*, id, name, description, content, referenced_content=None, tool_ids=None, space_id=None, validate_spaces=None)[source]¶
Create a skill.
POST /api/agent_builder/skills. Technical preview; added in 9.4.0. A skill packages reusable instructions (markdown) and tool references that agents can leverage.- Parameters:
id (str) – Unique identifier for the skill.
name (str) – Human-readable name for the skill.
description (str) – Description of what the skill does.
content (str) – Skill instructions content (markdown).
referenced_content (list[dict[str, Any]] | None) – Optional list of referenced content entries, each with
name,relativePathandcontent.tool_ids (list[str] | None) – Tool IDs from the tool registry that this skill references.
space_id (str | None) – Optional space ID to create the skill in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the created skill definition.
- Raises:
BadRequestError – If the request body is invalid or the skill ID already exists.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> created = await client.agent_builder.create_skill( ... id="triage-errors", ... name="Triage errors", ... description="How to triage application errors", ... content="# Triage\n1. Check the error rate...", ... tool_ids=["platform.core.search"], ... ) >>> print(created.body["id"]) triage-errors
- async get_skill(*, skill_id, space_id=None, validate_spaces=None)[source]¶
Get a skill by ID.
GET /api/agent_builder/skills/{skillId}. Technical preview; added in 9.4.0.- Parameters:
- Returns:
ObjectApiResponse containing the skill definition.
- Raises:
NotFoundError – If the skill does not exist.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> skill = await client.agent_builder.get_skill(skill_id="triage-errors") >>> print(skill.body["name"]) Triage errors
- async update_skill(*, skill_id, name=None, description=None, content=None, referenced_content=None, tool_ids=None, space_id=None, validate_spaces=None)[source]¶
Update a skill.
PUT /api/agent_builder/skills/{skillId}. Technical preview; added in 9.4.0. Performs a partial update: only the provided fields are changed. Built-in (read-only) skills cannot be updated.- Parameters:
skill_id (str) – The unique identifier of the skill to update.
name (str | None) – Updated name for the skill.
description (str | None) – Updated description.
content (str | None) – Updated skill instructions content.
referenced_content (list[dict[str, Any]] | None) – Updated list of referenced content entries, each with
name,relativePathandcontent.tool_ids (list[str] | None) – Updated tool IDs from the tool registry.
space_id (str | None) – Optional space ID the skill lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the updated skill definition.
- Raises:
NotFoundError – If the skill does not exist.
BadRequestError – If the request body is invalid or the skill is read-only.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> updated = await client.agent_builder.update_skill( ... skill_id="triage-errors", description="Updated" ... ) >>> print(updated.body["description"]) Updated
- async delete_skill(*, skill_id, force=None, space_id=None, validate_spaces=None)[source]¶
Delete a skill.
DELETE /api/agent_builder/skills/{skillId}. Technical preview; added in 9.4.0. Built-in (read-only) skills cannot be deleted.- Parameters:
skill_id (str) – The unique identifier of the skill to delete.
force (bool | None) – If
True, removes the skill from agents that use it and then deletes it.space_id (str | None) – Optional space ID the skill lives in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing
{"success": true}on success.- Raises:
NotFoundError – If the skill does not exist.
ConflictError – If the skill is in use by agents and
forceis not set.AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> result = await client.agent_builder.delete_skill( ... skill_id="triage-errors" ... ) >>> print(result.body["success"]) True
- async list_plugins(*, space_id=None, validate_spaces=None)[source]¶
List plugins.
GET /api/agent_builder/plugins. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
- Returns:
ObjectApiResponse containing the installed Agent Builder plugins.
- Raises:
NotFoundError – If the plugins API is not enabled.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> plugins = await client.agent_builder.list_plugins()
- async get_plugin(*, plugin_id, space_id=None, validate_spaces=None)[source]¶
Get a plugin by ID.
GET /api/agent_builder/plugins/{pluginId}. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
- Returns:
ObjectApiResponse containing the plugin definition.
- Raises:
NotFoundError – If the plugin does not exist or the plugins API is not enabled.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> plugin = await client.agent_builder.get_plugin(plugin_id="my-plugin")
- async install_plugin(*, url, plugin_name=None, space_id=None, validate_spaces=None)[source]¶
Install a plugin.
POST /api/agent_builder/plugins/install. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
url (str) – URL to install the plugin from (GitHub URL or direct zip URL).
plugin_name (str | None) – Optional name override for the plugin. Defaults to the manifest name.
space_id (str | None) – Optional space ID to install the plugin in.
validate_spaces (bool | None) – Override space validation setting for this operation.
- Returns:
ObjectApiResponse containing the installed plugin definition.
- Raises:
NotFoundError – If the plugins API is not enabled.
BadRequestError – If the URL or plugin package is invalid.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> installed = await client.agent_builder.install_plugin( ... url="https://github.com/example/agent-plugin" ... )
- async delete_plugin(*, plugin_id, force=None, space_id=None, validate_spaces=None)[source]¶
Delete a plugin.
DELETE /api/agent_builder/plugins/{pluginId}. Technical preview; added in 9.4.0. NOTE: on a default Kibana 9.4.3 configuration the plugins API is not enabled and responds with 404 (it is gated behind a feature flag).- Parameters:
- Returns:
ObjectApiResponse acknowledging the deletion.
- Raises:
NotFoundError – If the plugin does not exist or the plugins API is not enabled.
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges.
- Return type:
Example
>>> await client.agent_builder.delete_plugin(plugin_id="my-plugin")