kibana-agent-builder
elastic/agent-skills
Create and manage Agent Builder agents and custom tools in Kibana
What is kibana-agent-builder?
Build, update, delete, and test agents in Kibana's Agent Builder, along with custom tools (ES|QL queries, index searches, workflows). Use this when you need to create intelligent agents that can reason, call tools, and interact with Elasticsearch data.
- Create agents with custom system instructions and selected tools
- Update agent descriptions, instructions, and tool assignments
- Delete agents and manage their lifecycle
- Chat with agents and test their reasoning and tool calls
- Create ES|QL tools with parameterized queries for controlled data access
- Create index search tools scoped to specific index patterns
How to install kibana-agent-builder
npx skills add https://github.com/elastic/agent-skills --skill kibana-agent-builder- Kibana instance with Agent Builder enabled
- KIBANA_URL environment variable set
- Authentication via KIBANA_API_KEY or KIBANA_USERNAME + KIBANA_PASSWORD
- Node.js runtime to execute agent-builder.js scripts
How to use kibana-agent-builder
- 1.Set required environment variables (KIBANA_URL, KIBANA_API_KEY or credentials)
- 2.List available tools with list-tools to understand what can be assigned
- 3.List existing agents with list-agents to avoid naming conflicts
- 4.Gather agent details: name, description, system instructions, and desired tools
- 5.Select tools from the available list and create the agent with create-agent
- 6.Verify creation by listing agents again
- 7.Test the agent by chatting with it using the chat command
- 8.Update agent configuration with update-agent if needed
Use cases
- Build a customer support agent that searches feedback tickets and triggers investigation workflows
- Create a financial analyst agent with ES|QL tools for revenue calculations by region
- Set up a security incident response agent that searches alerts and calls automated remediation workflows
- Develop a data exploration agent with index search tools for business intelligence
- Create specialized agents for specific domains with curated tool sets
- DevOps engineers managing Kibana deployments
- Data analysts building intelligent search and analytics agents
- Security teams automating incident investigation
- Business intelligence teams creating domain-specific agents
- Platform engineers extending Kibana capabilities
kibana-agent-builder FAQ
API key (KIBANA_API_KEY, preferred) or basic auth (KIBANA_USERNAME + KIBANA_PASSWORD). Falls back to ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD if Kibana-specific credentials are not set.
No. The agent's id and name are immutable. You can only update description, instructions, and tool assignments.
string, integer, float, boolean, date, and array. Parameters are defined with type and description only; defaults and optional flags are not supported.
Typically 30-60 seconds as the agent reasons and calls tools. Use a longer timeout (120-180s) when running via Bash.
Yes. Pass --conversation-id to the chat command to continue an existing conversation thread.
Full instructions (SKILL.md)
Source of truth, from elastic/agent-skills.
name: kibana-agent-builder description: > 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. metadata: author: elastic version: 0.2.0 disable-model-invocation: true allowed-tools: Bash(node *), Read, Glob, Grep argument-hint: '[agent-name]'
Manage Agent Builder Agents and Tools in Kibana
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.
Prerequisites
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.
Agent Management
Create an Agent
Step 1: List available tools
node skills/kibana/agent-builder/scripts/agent-builder.js list-tools
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.
Step 2: List existing agents
node skills/kibana/agent-builder/scripts/agent-builder.js list-agents
This helps avoid name conflicts and shows what is already configured.
Step 3: Gather agent details
Using $ARGUMENTS as the default name, confirm or collect from the user:
- Name (required) — The agent's display name. Default:
$ARGUMENTS. - Description (optional) — Brief description of what the agent does. Default: same as name.
- System instructions (optional) — Custom system prompt for the agent. Default: none.
Step 4: Select tools
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.
Step 5: Create the agent
node skills/kibana/agent-builder/scripts/agent-builder.js create-agent \
--name "<agent_name>" \
--description "<description>" \
--instructions "<system_instructions>" \
--tool-ids "<tool_id_1>,<tool_id_2>,<tool_id_3>"
Where:
--nameis required--tool-idsis a comma-separated list of tool IDs from Step 4--descriptiondefaults to the name if omitted--instructionscan be omitted if the user did not provide any
Step 6: Verify creation
node skills/kibana/agent-builder/scripts/agent-builder.js list-agents
Show the user the newly created agent entry. If it appears, report success. If not, show any error output from Step 5.
Get an Agent
node skills/kibana/agent-builder/scripts/agent-builder.js get-agent --id "<agent_id>"
Update an Agent
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>"
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.
Delete an Agent
node skills/kibana/agent-builder/scripts/agent-builder.js delete-agent --id "<agent_id>"
Always confirm with the user before deleting. Deletion is permanent.
Chat with an Agent
node skills/kibana/agent-builder/scripts/agent-builder.js chat \
--id "<agent_id>" \
--message "<user_message>"
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.
Tool Management
Custom tools extend what agents can do beyond the built-in platform tools.
Tool Types
ES|QL 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.
{
"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'"
}
}
}
}
Index Search Tools
Scope the built-in search capability to a specific index pattern. The LLM decides how to query; you control which indices are accessible.
{
"id": "customer_feedback_search",
"type": "index_search",
"description": "Searches customer feedback and support tickets.",
"configuration": {
"pattern": "customer-feedback-*"
}
}
Workflow Tools
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).
{
"id": "investigate-alert-workflow",
"type": "workflow",
"description": "Triggers automated alert investigation.",
"configuration": {
"workflow_id": "security-alert-investigation"
}
}
Parameters are auto-detected from the workflow's inputs section.
Tool API Constraints
Read these before creating tools — violations cause 400 errors.
- POST body fields: Only
id,type,description,configuration, andtagsare accepted.nameis not a valid field — omit it entirely. paramsis always required for ES|QL tools, even when empty — use"params": {}.- Param fields: Only
typeanddescriptionare accepted per parameter.defaultandoptionalare not valid and cause 400 errors. Hard-code sensible defaults in the query instead. - Index search config: Use
"pattern", not"index". Using"index"causes a validation error. - PUT restrictions: Only
description,configuration, andtagsare accepted. Includingidortypecauses a 400 error — these fields are immutable after creation.
Tool Script Commands
List all tools
node skills/kibana/agent-builder/scripts/agent-builder.js list-custom-tools
Get a specific tool
node skills/kibana/agent-builder/scripts/agent-builder.js get-tool --id "<tool_id>"
Create a tool
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"}}'
For index search tools:
node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "index_search" \
--description "<description>" \
--pattern "my-index-*"
For workflow tools:
node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "workflow" \
--description "<description>" \
--workflow-id "my-workflow-name"
Update a tool
node skills/kibana/agent-builder/scripts/agent-builder.js update-tool \
--id "<tool_id>" \
--description "<new_description>" \
--query "<new_query>"
Only description, configuration, and tags can be updated. id and type are immutable.
Delete a tool
node skills/kibana/agent-builder/scripts/agent-builder.js delete-tool --id "<tool_id>"
Test a tool
node skills/kibana/agent-builder/scripts/agent-builder.js test-tool \
--id "<tool_id>" \
--params '{"region": "US"}'
Executes the tool via POST /api/agent_builder/tools/_execute and displays column names and row counts for ES|QL
results.
Examples
Create an agent
User: /kibana-agent-builder sales-helper
- List tools — finds
platform.core.search,platform.core.list_indices, and a customesql-sales-datatool - List agents — no conflicts
- Name: "sales-helper", Description: "Helps query sales data"
- Tools:
esql-sales-data,platform.core.search,platform.core.list_indices - Create with
--name "sales-helper" --tool-ids "esql-sales-data,platform.core.search,platform.core.list_indices" - Verify — agent appears in list
Update an agent's instructions
User: Update the sales-helper agent to focus on the APAC region
- Get agent —
get-agent --id "sales-helper"to see current config - Update —
update-agent --id "sales-helper" --instructions "Focus on APAC sales data. Use esql-sales-data for queries." - Verify —
get-agent --id "sales-helper"to confirm new instructions
Chat with an agent
User: Ask sales-helper what the top revenue products are
- Chat —
chat --id "sales-helper" --message "What are the top revenue products?" - Display the agent's response
Create an ES|QL tool with parameters
User: Create a tool that shows billing complaints by category for the last N days
-
Consult the
elasticsearch-esqlskill for ES|QL syntax -
Create tool:
node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \ --id "billing_complaint_summary" \ --type "esql" \ --description "Returns billing complaints grouped by sub-category for the last N days." \ --query "FROM customer-feedback-* | WHERE @timestamp >= NOW() - ?days::integer * 1d AND MATCH(feedback_text, 'billing') | STATS count = COUNT(*) BY sub_category | SORT count DESC | LIMIT 10" \ --params '{"days": {"type": "integer", "description": "Number of days to look back"}}' -
Test:
test-tool --id "billing_complaint_summary" --params '{"days": 30}'
Create an index search tool
User: Create a tool to search support transcripts
node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "transcript_search" \
--type "index_search" \
--description "Searches support call transcripts by topic, agent, or customer issue." \
--pattern "support-transcripts"
References
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 agents
For 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 security-workflows skill.
Guidelines
- Always run
list-toolsbefore creating an agent so the user can choose from real, available tools. - Always run
list-agentsbefore and after creation to detect conflicts and verify success. - Do not invent tool IDs — only use IDs returned by
list-tools. - If no custom tools exist yet, suggest creating one or using the built-in platform tools.
- The agent ID is auto-generated from the name (lowercased, hyphens, alphanumeric only).
- For non-default Kibana spaces, set
KIBANA_SPACE_IDbefore running the script. - Confirm with the user before running
delete-agentordelete-tool— deletion is permanent. - Always include
| LIMIT Nin ES|QL queries to prevent context window overflow. - Write descriptive tool descriptions — the agent decides which tool to call based solely on the description.
- Scope index search tools narrowly (e.g.,
customer-feedback-*not*). - Use
KEEPto return only needed columns and reduce token consumption. - Validate ES|QL queries with
test-toolbefore assigning to an agent. - For ES|QL tools with no parameters, still include
"params": {}.
Related skills
More from elastic/agent-skills and the wider catalog.

kibana-alerting-rules
Create and manage Kibana alerting rules via REST API or Terraform for automated monitoring and incident response.

kibana-anomaly-detection
Elastic ML anomaly detection skill — investigation/RCA, score explanation,

kibana-audit
Enable and configure Kibana audit logging for saved object access, logins, and space operations.

kibana-connectors
Create and manage Kibana connectors for Slack, PagerDuty, Jira, webhooks, and more via REST API or Terraform.

kibana-dashboards
Create and manage Kibana dashboards and visualizations declaratively with Git-friendly, version-controlled definitions.

kibana-streams
List, inspect, enable, disable, and resync Kibana Streams via REST API.