kibana-agent-builder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManage Agent Builder Agents and Tools in Kibana
在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.
创建、更新、删除、查看并与Agent Builder代理对话。创建、更新、删除、列出并测试自定义工具(ES|QL、索引搜索、工作流)。如果用户提供了名称,默认使用**$ARGUMENTS**作为代理名称。
Prerequisites
前提条件
Set these environment variables before running any script:
| Variable | Required | Description |
|---|---|---|
| Yes | Kibana base URL (e.g., |
| No | API key for authentication (preferred) |
| No | Username for basic auth (falls back to |
| No | Password for basic auth (falls back to |
| No | Kibana space ID (omit for default space) |
| No | Set to |
Provide either or + .
KIBANA_API_KEYKIBANA_USERNAMEKIBANA_PASSWORD在运行任何脚本前设置以下环境变量:
| 变量名称 | 是否必填 | 描述 |
|---|---|---|
| 是 | Kibana基础URL(例如: |
| 否 | 用于身份验证的API密钥(推荐使用) |
| 否 | 基础认证的用户名(默认使用 |
| 否 | 基础认证的密码(默认使用 |
| 否 | Kibana空间ID(默认空间可省略) |
| 否 | 设置为 |
需提供或 + 其中一组。
KIBANA_API_KEYKIBANA_USERNAMEKIBANA_PASSWORDAgent Management
代理管理
Create an Agent
创建代理
Step 1: List available tools
步骤1:列出可用工具
bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-toolsIf the script reports a connection error, stop and tell the user to verify their and authentication
environment variables.
KIBANA_URLReview the list of available tools. Tools prefixed with are built-in. Other tools are custom or
connector-provided.
platform.core.bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-tools如果脚本报告连接错误,请停止操作并告知用户验证其和身份验证环境变量。
KIBANA_URL查看可用工具列表。前缀为的工具是内置工具,其他工具为自定义或连接器提供的工具。
platform.core.Step 2: List existing agents
步骤2:列出已有代理
bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-agentsThis helps avoid name conflicts and shows what is already configured.
bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-agents这有助于避免名称冲突,并显示已配置的代理。
Step 3: Gather agent details
步骤3:收集代理详情
Using as the default name, confirm or collect from the user:
$ARGUMENTS- 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.
默认使用作为名称,向用户确认或收集以下信息:
$ARGUMENTS- 名称(必填)—— 代理的显示名称。默认值:。
$ARGUMENTS - 描述(可选)—— 代理功能的简要说明。默认值与名称相同。
- 系统指令(可选)—— 代理的自定义系统提示词。默认值:无。
Step 4: Select tools
步骤4:选择工具
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.
展示步骤1中的可用工具,询问用户要包含哪些工具。根据代理用途建议合理的默认工具列表,允许用户添加或移除工具。
Step 5: Create the agent
步骤5:创建代理
bash
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:
- is required
--name - is a comma-separated list of tool IDs from Step 4
--tool-ids - defaults to the name if omitted
--description - can be omitted if the user did not provide any
--instructions
bash
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>"参数说明:
- 为必填项
--name - 是步骤4中工具ID的逗号分隔列表
--tool-ids - 若省略则默认使用名称
--description - 若用户未提供可省略
--instructions
Step 6: Verify creation
步骤6:验证创建结果
bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-agentsShow the user the newly created agent entry. If it appears, report success. If not, show any error output from Step 5.
bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-agents向用户展示新创建的代理条目。如果条目存在,则报告创建成功;如果不存在,则展示步骤5中的错误输出。
Get an Agent
获取代理信息
bash
node skills/kibana/agent-builder/scripts/agent-builder.js get-agent --id "<agent_id>"bash
node skills/kibana/agent-builder/scripts/agent-builder.js get-agent --id "<agent_id>"Update an Agent
更新代理
bash
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 are optional — only provided fields are updated. The agent's and are immutable.
--ididnameAPI constraint: PUT only accepts,description, andconfiguration. Includingtags,id, ornamecauses a 400 error.type
bash
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>"除外,所有参数均为可选——仅更新提供的字段。代理的和不可修改。
--ididnameAPI限制:PUT请求仅接受、description和configuration字段。包含tags、id或name会导致400错误。type
Delete an Agent
删除代理
bash
node skills/kibana/agent-builder/scripts/agent-builder.js delete-agent --id "<agent_id>"Always confirm with the user before deleting. Deletion is permanent.
bash
node skills/kibana/agent-builder/scripts/agent-builder.js delete-agent --id "<agent_id>"删除前务必与用户确认,删除操作不可恢复。
Chat with an Agent
与代理对话
bash
node skills/kibana/agent-builder/scripts/agent-builder.js chat \
--id "<agent_id>" \
--message "<user_message>"Uses the streaming endpoint with and in the request body.
Output shows , , , and as events arrive. Pass
to continue an existing conversation.
POST /api/agent_builder/converse/asyncagent_idinput[Reasoning][Tool Call][Tool Result][Response]--conversation-idNote: 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.
bash
node skills/kibana/agent-builder/scripts/agent-builder.js chat \
--id "<agent_id>" \
--message "<user_message>"使用流式端点,请求体中包含和。当事件到达时,输出会显示、、和。传递可继续现有对话。
POST /api/agent_builder/converse/asyncagent_idinput[Reasoning][Tool Call][Tool Result][Response]--conversation-id注意:该命令可能需要30-60秒,因为代理需要进行推理并调用工具。通过Bash运行时,请使用更长的超时时间(例如120秒或180秒)。
Tool Management
工具管理
Custom tools extend what agents can do beyond the built-in platform tools.
自定义工具可扩展代理的功能,超出平台内置工具的范围。
Tool Types
工具类型
ES|QL Tools
ES|QL工具
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 in the query. Define each parameter with and only. Valid
types: , , , , , .
?param_nametypedescriptionstringintegerfloatbooleandatearrayjson
{
"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'"
}
}
}
}预定义的参数化ES|QL查询。适用于需要保证查询正确性、强制执行业务规则、分析聚合或细粒度数据访问控制的场景。
参数语法:在查询中使用。仅需为每个参数定义和。有效类型包括:、、、、、。
?param_nametypedescriptionstringintegerfloatbooleandatearrayjson
{
"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.
json
{
"id": "customer_feedback_search",
"type": "index_search",
"description": "Searches customer feedback and support tickets.",
"configuration": {
"pattern": "customer-feedback-*"
}
}将内置搜索能力限定在特定索引模式下。LLM会决定查询方式,而您可以控制可访问的索引。
json
{
"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).
json
{
"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 section.
inputs将代理与Elastic Workflow(YAML定义的多步骤自动化流程)连接。适用于代理需要执行数据检索之外的操作(发送通知、创建工单、调用外部API)的场景。
json
{
"id": "investigate-alert-workflow",
"type": "workflow",
"description": "Triggers automated alert investigation.",
"configuration": {
"workflow_id": "security-alert-investigation"
}
}参数会从工作流的部分自动检测。
inputsTool API Constraints
工具API限制
Read these before creating tools — violations cause 400 errors.
- POST body fields: Only ,
id,type,description, andconfigurationare accepted.tagsis not a valid field — omit it entirely.name - is always required for ES|QL tools, even when empty — use
params."params": {} - Param fields: Only and
typeare accepted per parameter.descriptionanddefaultare not valid and cause 400 errors. Hard-code sensible defaults in the query instead.optional - Index search config: Use , not
"pattern". Using"index"causes a validation error."index" - PUT restrictions: Only ,
description, andconfigurationare accepted. Includingtagsoridcauses a 400 error — these fields are immutable after creation.type
创建工具前请阅读以下内容——违反限制会导致400错误。
- POST请求体字段:仅接受、
id、type、description和configuration。tags不是有效字段——请完全省略。name - ES|QL工具必须包含:即使没有参数,也需使用
params。"params": {} - 参数字段:每个参数仅接受和
type。description和default无效,会导致400错误。请在查询中硬编码合理的默认值。optional - 索引搜索配置:使用,而非
"pattern"。使用"index"会导致验证错误。"index" - PUT请求限制:仅接受、
description和configuration。包含tags或id会导致400错误——这些字段创建后不可修改。type
Tool Script Commands
工具脚本命令
List all tools
列出所有工具
bash
node skills/kibana/agent-builder/scripts/agent-builder.js list-custom-toolsbash
node skills/kibana/agent-builder/scripts/agent-builder.js list-custom-toolsGet a specific tool
获取特定工具信息
bash
node skills/kibana/agent-builder/scripts/agent-builder.js get-tool --id "<tool_id>"bash
node skills/kibana/agent-builder/scripts/agent-builder.js get-tool --id "<tool_id>"Create a tool
创建工具
bash
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:
bash
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:
bash
node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "workflow" \
--description "<description>" \
--workflow-id "my-workflow-name"bash
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"}}'对于索引搜索工具:
bash
node skills/kibana/agent-builder/scripts/agent-builder.js create-tool \
--id "<tool_id>" \
--type "index_search" \
--description "<description>" \
--pattern "my-index-*"对于工作流工具:
bash
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
更新工具
bash
node skills/kibana/agent-builder/scripts/agent-builder.js update-tool \
--id "<tool_id>" \
--description "<new_description>" \
--query "<new_query>"Only , , and can be updated. and are immutable.
descriptionconfigurationtagsidtypebash
node skills/kibana/agent-builder/scripts/agent-builder.js update-tool \
--id "<tool_id>" \
--description "<new_description>" \
--query "<new_query>"仅可更新、和。和不可修改。
descriptionconfigurationtagsidtypeDelete a tool
删除工具
bash
node skills/kibana/agent-builder/scripts/agent-builder.js delete-tool --id "<tool_id>"bash
node skills/kibana/agent-builder/scripts/agent-builder.js delete-tool --id "<tool_id>"Test a tool
测试工具
bash
node skills/kibana/agent-builder/scripts/agent-builder.js test-tool \
--id "<tool_id>" \
--params '{"region": "US"}'Executes the tool via and displays column names and row counts for ES|QL
results.
POST /api/agent_builder/tools/_executebash
node skills/kibana/agent-builder/scripts/agent-builder.js test-tool \
--id "<tool_id>" \
--params '{"region": "US"}'通过执行工具,并显示ES|QL结果的列名和行数。
POST /api/agent_builder/tools/_executeExamples
示例
Create an agent
创建代理
text
User: /kibana-agent-builder sales-helper- List tools — finds ,
platform.core.search, and a customplatform.core.list_indicestoolesql-sales-data - List agents — no conflicts
- Name: "sales-helper", Description: "Helps query sales data"
- Tools: ,
esql-sales-data,platform.core.searchplatform.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
text
User: /kibana-agent-builder sales-helper- 列出工具——找到、
platform.core.search和自定义工具platform.core.list_indicesesql-sales-data - 列出代理——无名称冲突
- 名称:"sales-helper",描述:"帮助查询销售数据"
- 工具:、
esql-sales-data、platform.core.searchplatform.core.list_indices - 使用命令创建:
--name "sales-helper" --tool-ids "esql-sales-data,platform.core.search,platform.core.list_indices" - 验证——代理出现在列表中
Update an agent's instructions
更新代理指令
text
User: Update the sales-helper agent to focus on the APAC region- Get agent — to see current config
get-agent --id "sales-helper" - Update —
update-agent --id "sales-helper" --instructions "Focus on APAC sales data. Use esql-sales-data for queries." - Verify — to confirm new instructions
get-agent --id "sales-helper"
text
User: Update the sales-helper agent to focus on the APAC region- 获取代理信息——运行查看当前配置
get-agent --id "sales-helper" - 更新代理——
update-agent --id "sales-helper" --instructions "Focus on APAC sales data. Use esql-sales-data for queries." - 验证——运行确认新指令已生效
get-agent --id "sales-helper"
Chat with an agent
与代理对话
text
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
text
User: Ask sales-helper what the top revenue products are- 对话——运行
chat --id "sales-helper" --message "What are the top revenue products?" - 显示代理的回复
Create an ES|QL tool with parameters
创建带参数的ES|QL工具
text
User: Create a tool that shows billing complaints by category for the last N days-
Consult theskill for ES|QL syntax
elasticsearch-esql -
Create tool:bash
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}'
text
User: Create a tool that shows billing complaints by category for the last N days-
参考技能获取ES|QL语法
elasticsearch-esql -
创建工具:bash
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-tool --id "billing_complaint_summary" --params '{"days": 30}'
Create an index search tool
创建索引搜索工具
text
User: Create a tool to search support transcriptsbash
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"text
User: Create a tool to search support transcriptsbash
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:
- — Core concepts, built-in tools, context engineering, best practices, token optimization, REST API endpoints, MCP/A2A integration, permissions
references/architecture-guide.md - — Full playbooks for Customer Feedback Analysis, Marketing Campaign Analysis, and Contract Analysis agents
references/use-cases.md
For ES|QL syntax, functions, operators, and parameter rules, use the skill. For workflow YAML
structure, trigger types, step types, and agent-workflow patterns, use the skill.
elasticsearch-esqlsecurity-workflows以下资料提供详细指导:
- — 核心概念、内置工具、上下文工程、最佳实践、令牌优化、REST API端点、MCP/A2A集成、权限
references/architecture-guide.md - — 客户反馈分析、营销活动分析和合同分析代理的完整操作手册
references/use-cases.md
如需ES|QL语法、函数、运算符和参数规则,请使用技能。如需工作流YAML结构、触发器类型、步骤类型和代理-工作流模式,请使用技能。
elasticsearch-esqlsecurity-workflowsGuidelines
指南
- Always run before creating an agent so the user can choose from real, available tools.
list-tools - Always run before and after creation to detect conflicts and verify success.
list-agents - 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 before running the script.
KIBANA_SPACE_ID - Confirm with the user before running or
delete-agent— deletion is permanent.delete-tool - Always include in ES|QL queries to prevent context window overflow.
| LIMIT N - Write descriptive tool descriptions — the agent decides which tool to call based solely on the description.
- Scope index search tools narrowly (e.g., not
customer-feedback-*).* - Use to return only needed columns and reduce token consumption.
KEEP - Validate ES|QL queries with before assigning to an agent.
test-tool - For ES|QL tools with no parameters, still include .
"params": {}
- 创建代理前始终运行,以便用户从真实可用的工具中选择。
list-tools - 创建前后始终运行,以检测冲突并验证成功。
list-agents - 不要自行编造工具ID——仅使用返回的ID。
list-tools - 如果尚无自定义工具,建议创建一个或使用平台内置工具。
- 代理ID由名称自动生成(小写、连字符连接、仅包含字母数字)。
- 对于非默认Kibana空间,运行脚本前设置。
KIBANA_SPACE_ID - 运行或
delete-agent前务必与用户确认——删除操作不可恢复。delete-tool - ES|QL查询中始终包含,以防止上下文窗口溢出。
| LIMIT N - 编写描述性的工具描述——代理仅根据描述决定调用哪个工具。
- 缩小索引搜索工具的范围(例如而非
customer-feedback-*)。* - 使用仅返回所需列,减少令牌消耗。
KEEP - 将ES|QL工具分配给代理前,使用验证查询。
test-tool - 对于无参数的ES|QL工具,仍需包含。
"params": {}