npx skills add ...
npx skills add elastic/agent-skills --skill kibana-agent-builder
Create and manage Agent Builder agents and custom tools in Kibana. Use when asked to create, update, delete, test, or inspect agents or tools in Agent Builder.
npx skills add elastic/agent-skills --skill kibana-agent-builder
Create, update, delete, inspect, and chat with Agent Builder agents. Create, update, delete, list, and test custom tools (ES|QL, index search, workflow). If the user provided a name, use $ARGUMENTS as the default agent name.
Set these environment variables before running any script:
| Variable | Required | Description |
|---|---|---|
KIBANA_URL | Yes | Kibana base URL (e.g., https://my-deployment.kb.us-east-1.aws.elastic.cloud) |
KIBANA_API_KEY | No | API key for authentication (preferred) |
KIBANA_USERNAME | No | Username for basic auth (falls back to ELASTICSEARCH_USERNAME) |
KIBANA_PASSWORD | No | Password for basic auth (falls back to ELASTICSEARCH_PASSWORD) |
KIBANA_SPACE_ID | No | Kibana space ID (omit for default space) |
KIBANA_INSECURE | No | Set to true to skip TLS verification |
Provide either KIBANA_API_KEY or KIBANA_USERNAME + KIBANA_PASSWORD.
If the script reports a connection error, stop and tell the user to verify their KIBANA_URL and authentication
environment variables.
Review the list of available tools. Tools prefixed with platform.core. are built-in. Other tools are custom or
connector-provided.
This helps avoid name conflicts and shows what is already configured.
Using $ARGUMENTS as the default name, confirm or collect from the user:
$ARGUMENTS.Present the available tools from Step 1 and ask the user which ones to include. Suggest a reasonable default based on the agent's purpose. Let the user add or remove tools from the suggested list.
Where:
--name is required--tool-ids is a comma-separated list of tool IDs from Step 4--description defaults to the name if omitted--instructions can be omitted if the user did not provide anyShow the user the newly created agent entry. If it appears, report success. If not, show any error output from Step 5.
All flags except --id are optional — only provided fields are updated. The agent's id and name are immutable.
API constraint: PUT only accepts
description,configuration, andtags. Includingid,name, ortypecauses a 400 error.
Always confirm with the user before deleting. Deletion is permanent.
Uses the streaming endpoint POST /api/agent_builder/converse/async with agent_id and input in the request body.
Output shows [Reasoning], [Tool Call], [Tool Result], and [Response] as events arrive. Pass --conversation-id
to continue an existing conversation.
Note: This command may take 30-60 seconds as the agent reasons and calls tools. Use a longer timeout (e.g., 120s or 180s) when running via Bash.
Custom tools extend what agents can do beyond the built-in platform tools.
Pre-defined, parameterized ES|QL queries. Use when you need guaranteed query correctness, enforced business rules, analytics aggregations, or fine-grained data access control.
Parameter syntax: Use ?param_name in the query. Define each parameter with type and description only. Valid
types: string, integer, float, boolean, date, array.
Scope the built-in search capability to a specific index pattern. The LLM decides how to query; you control which indices are accessible.
Connect an agent to an Elastic Workflow — a YAML-defined multi-step automation. Use when the agent needs to take action beyond data retrieval (send notifications, create tickets, call external APIs).
Parameters are auto-detected from the workflow's inputs section.
Read these before creating tools — violations cause 400 errors.
id, type, description, configuration, and tags are accepted. name is not a
valid field — omit it entirely.params is always required for ES|QL tools, even when empty — use "params": {}.type and description are accepted per parameter. default and optional are not valid
and cause 400 errors. Hard-code sensible defaults in the query instead."pattern", not "index". Using "index" causes a validation error.description, configuration, and tags are accepted. Including id or type causes a
400 error — these fields are immutable after creation.For index search tools:
For workflow tools:
Only description, configuration, and tags can be updated. id and type are immutable.
Executes the tool via POST /api/agent_builder/tools/_execute and displays column names and row counts for ES|QL
results.
platform.core.search, platform.core.list_indices, and a custom esql-sales-data toolesql-sales-data, platform.core.search, platform.core.list_indices--name "sales-helper" --tool-ids "esql-sales-data,platform.core.search,platform.core.list_indices"get-agent --id "sales-helper" to see current configupdate-agent --id "sales-helper" --instructions "Focus on APAC sales data. Use esql-sales-data for queries."get-agent --id "sales-helper" to confirm new instructionschat --id "sales-helper" --message "What are the top revenue products?"Consult the elasticsearch-esql skill for ES|QL syntax
Create tool:
Test: test-tool --id "billing_complaint_summary" --params '{"days": 30}'
Read these for detailed guidance:
references/architecture-guide.md — Core concepts, built-in tools, context engineering, best practices, token
optimization, REST API endpoints, MCP/A2A integration, permissionsreferences/use-cases.md — Full playbooks for Customer Feedback Analysis, Marketing Campaign Analysis, and Contract
Analysis agentsFor ES|QL syntax, functions, operators, and parameter rules, use the elasticsearch-esql skill. For workflow YAML
structure, trigger types, step types, and agent-workflow patterns, use the kibana-workflows skill.
list-tools before creating an agent so the user can choose from real, available tools.list-agents before and after creation to detect conflicts and verify success.list-tools.KIBANA_SPACE_ID before running the script.delete-agent or delete-tool — deletion is permanent.| LIMIT N in ES|QL queries to prevent context window overflow.customer-feedback-* not *).KEEP to return only needed columns and reduce token consumption.test-tool before assigning to an agent."params": {}.node skills/kibana/agent-builder/scripts/agent-builder.js get-agent --id "<agent_id>"node skills/kibana/agent-builder/scripts/agent-builder.js update-agent \
--id "<agent_id>" \
--description "<new_description>" \
--instructions "<new_instructions>" \
--tool-ids "<tool_id_1>,<tool_id_2>"node skills/kibana/agent-builder/scripts/agent-builder.js delete-agent --id "<agent_id>"node skills/kibana/agent-builder/scripts/agent-builder.js chat \
--id "<agent_id>" \
--message "<user_message>"{
"id": "campaign_revenue_by_region",
"type": "esql",
"description": "Calculates confirmed revenue for a region by quarter.",
"configuration": {
"query": "FROM finance-orders-* | WHERE order_status == \"completed\" AND region == ?region | STATS total_revenue = SUM(amount) BY quarter | LIMIT 10",
"params": {
"region": {
"type": "string",
"description": "Region code, e.g. 'US', 'EU', 'APAC'"
}
}
}
}{
"id": "customer_feedback_search",
"type": "index_search",
"description": "Searches customer feedback and support tickets.",
"configuration": {
"pattern": "customer-feedback-*"
}
}{
"id": "investigate-alert-workflow",
"type": "workflow",
"description": "Triggers automated alert investigation.",
"configuration": {
"workflow_id": "security-alert-investigation"
}
}node skills/kibana/agent-builder/scripts/agent-builder.js list-custom-toolsnode skills/kibana/agent-builder/scripts/agent-builder.js get-tool --id "<tool_id>"node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "esql" \
--description "<description>" \
--query "<esql_query>" \
--params '{"region": {"type": "string", "description": "Region code"}}'node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "index_search" \
--description "<description>" \
--pattern "my-index-*"node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "workflow" \
--description "<description>" \
--workflow-id "my-workflow-name"node skills/kibana/agent-builder/scripts/agent-builder.js update-tool \
--id "<tool_id>" \
--description "<new_description>" \
--query "<new_query>"node skills/kibana/agent-builder/scripts/agent-builder.js delete-tool --id "<tool_id>"node skills/kibana/agent-builder/scripts/agent-builder.js test-tool \
--id "<tool_id>" \
--params '{"region": "US"}'User: /kibana-agent-builder sales-helperUser: Update the sales-helper agent to focus on the APAC regionUser: Ask sales-helper what the top revenue products areUser: Create a tool that shows billing complaints by category for the last N days