kibana-agent-builder by elastic/agent-skills
npx skills add https://github.com/elastic/agent-skills --skill kibana-agent-builder创建、更新、删除、检查 Agent Builder 智能体,并与之对话。创建、更新、删除、列出和测试自定义工具(ES|QL、索引搜索、工作流)。如果用户提供了名称,则使用 $ARGUMENTS 作为默认智能体名称。
在运行任何脚本之前设置以下环境变量:
| 变量 | 必需 | 描述 |
|---|---|---|
KIBANA_URL | 是 | Kibana 基础 URL(例如,https://my-deployment.kb.us-east-1.aws.elastic.cloud) |
KIBANA_API_KEY | 否 | 用于身份验证的 API 密钥(首选) |
KIBANA_USERNAME | 否 | 基本身份验证的用户名(回退到 ) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
ELASTICSEARCH_USERNAMEKIBANA_PASSWORD | 否 | 基本身份验证的密码(回退到 ELASTICSEARCH_PASSWORD) |
KIBANA_SPACE_ID | 否 | Kibana 空间 ID(对于默认空间请省略) |
KIBANA_INSECURE | 否 | 设置为 true 以跳过 TLS 验证 |
请提供 KIBANA_API_KEY 或 KIBANA_USERNAME + KIBANA_PASSWORD。
node skills/kibana/agent-builder/scripts/agent-builder.js list-tools
如果脚本报告连接错误,请停止并告知用户验证其 KIBANA_URL 和身份验证环境变量。
查看可用工具列表。以 platform.core. 为前缀的工具是内置的。其他工具是自定义的或由连接器提供的。
node skills/kibana/agent-builder/scripts/agent-builder.js list-agents
这有助于避免名称冲突,并显示已配置的内容。
使用 $ARGUMENTS 作为默认名称,向用户确认或收集以下信息:
$ARGUMENTS。展示步骤 1 中的可用工具,并询问用户要包含哪些工具。根据智能体的用途建议一个合理的默认值。允许用户在建议列表中添加或删除工具。
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 是必需的--tool-ids 是来自步骤 4 的工具 ID 的逗号分隔列表--description 如果省略则默认为名称--instructions 如果用户未提供任何指令,则可以省略node skills/kibana/agent-builder/scripts/agent-builder.js list-agents
向用户展示新创建的智能体条目。如果出现,则报告成功。如果没有,则显示步骤 5 中的任何错误输出。
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>"
除了 --id 之外的所有标志都是可选的 — 仅更新提供的字段。智能体的 id 和 name 是不可变的。
API 约束 : PUT 仅接受
description、configuration和tags。包含id、name或type会导致 400 错误。
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>"
使用流式端点 POST /api/agent_builder/converse/async,请求体中包含 agent_id 和 input。输出会在事件到达时显示 [推理]、[工具调用]、[工具结果] 和 [响应]。传递 --conversation-id 以继续现有对话。
注意: 此命令可能需要 30-60 秒,因为智能体需要推理和调用工具。通过 Bash 运行时,请使用更长的超时时间(例如 120 秒或 180 秒)。
自定义工具扩展了智能体在平台内置工具之外的能力。
预定义的、参数化的 ES|QL 查询。当您需要保证查询正确性、强制执行业务规则、分析聚合或细粒度数据访问控制时使用。
参数语法 : 在查询中使用 ?param_name。仅使用 type 和 description 定义每个参数。有效类型:string、integer、float、boolean、date、array。
{
"id": "campaign_revenue_by_region",
"type": "esql",
"description": "按季度计算某个区域的确认收入。",
"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": "区域代码,例如 'US'、'EU'、'APAC'"
}
}
}
}
将内置搜索功能限定到特定的索引模式。LLM 决定如何查询;您控制哪些索引可访问。
{
"id": "customer_feedback_search",
"type": "index_search",
"description": "搜索客户反馈和支持工单。",
"configuration": {
"pattern": "customer-feedback-*"
}
}
将智能体连接到 Elastic 工作流 — 一个 YAML 定义的多步骤自动化流程。当智能体需要执行数据检索之外的操作(发送通知、创建工单、调用外部 API)时使用。
{
"id": "investigate-alert-workflow",
"type": "workflow",
"description": "触发自动警报调查。",
"configuration": {
"workflow_id": "security-alert-investigation"
}
}
参数会根据工作流的 inputs 部分自动检测。
在创建工具之前请阅读这些内容 — 违反会导致 400 错误。
id、type、description、configuration 和 tags。name 不是 有效字段 — 请完全省略它。params 对于 ES|QL 工具始终是必需的,即使为空 — 使用 "params": {}。type 和 description。default 和 optional 无效,会导致 400 错误。请在查询中硬编码合理的默认值。"pattern",而不是 "index"。使用 "index" 会导致验证错误。description、configuration 和 tags。包含 id 或 type 会导致 400 错误 — 这些字段在创建后是不可变的。node skills/kibana/agent-builder/scripts/agent-builder.js list-custom-tools
node 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>"
只能更新 description、configuration 和 tags。id 和 type 是不可变的。
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"}'
通过 POST /api/agent_builder/tools/_execute 执行工具,并显示 ES|QL 结果的列名和行数。
User: /kibana-agent-builder sales-helper
platform.core.search、platform.core.list_indices 和一个自定义的 esql-sales-data 工具esql-sales-data、platform.core.search、platform.core.list_indices--name "sales-helper" --tool-ids "esql-sales-data,platform.core.search,platform.core.list_indices" 创建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" 确认新指令User: Ask sales-helper what the top revenue products are
chat --id "sales-helper" --message "What are the top revenue products?"User: Create a tool that shows billing complaints by category for the last N days
查阅 elasticsearch-esql 技能以了解 ES|QL 语法
创建工具:
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}'
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/architecture-guide.md — 核心概念、内置工具、上下文工程、最佳实践、令牌优化、REST API 端点、MCP/A2A 集成、权限references/use-cases.md — 客户反馈分析、营销活动分析和合同分析智能体的完整操作手册对于 ES|QL 语法、函数、运算符和参数规则,请使用 elasticsearch-esql 技能。对于工作流 YAML 结构、触发器类型、步骤类型和智能体-工作流模式,请使用 security-workflows 技能。
list-tools,以便用户可以从真实可用的工具中进行选择。list-agents,以检测冲突并验证成功。list-tools 返回的 ID。KIBANA_SPACE_ID。delete-agent 或 delete-tool 之前与用户确认 — 删除是永久性的。| LIMIT N 以防止上下文窗口溢出。customer-feedback-* 而不是 *)。KEEP 仅返回需要的列,以减少令牌消耗。test-tool 进行验证。"params": {}。每周安装量
150
代码仓库
GitHub 星标数
89
首次出现
11 天前
安全审计
安装于
cursor133
github-copilot126
opencode125
gemini-cli125
codex125
amp124
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.
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.
node skills/kibana/agent-builder/scripts/agent-builder.js list-agents
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.
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:
--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 anynode 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.
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>"
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.
node skills/kibana/agent-builder/scripts/agent-builder.js delete-agent --id "<agent_id>"
Always confirm with the user before deleting. Deletion is permanent.
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.
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.
{
"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'"
}
}
}
}
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-*"
}
}
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.
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. and are and cause 400 errors. Hard-code sensible defaults in the query instead.node skills/kibana/agent-builder/scripts/agent-builder.js list-custom-tools
node 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"}}'
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"
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.
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"}'
Executes the tool via POST /api/agent_builder/tools/_execute and displays column names and row counts for ES|QL results.
User: /kibana-agent-builder sales-helper
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"User: Update the sales-helper agent to focus on the APAC region
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 instructionsUser: Ask sales-helper what the top revenue products are
chat --id "sales-helper" --message "What are the top revenue products?"User: Create a tool that shows billing complaints by category for the last N days
Consult the elasticsearch-esql skill 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}'
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"
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 security-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 ).Weekly Installs
150
Repository
GitHub Stars
89
First Seen
11 days ago
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
cursor133
github-copilot126
opencode125
gemini-cli125
codex125
amp124
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
Wix CLI 仪表板页面构建器 - 为 Wix 应用创建管理后台扩展
264 周安装
Bootstrap开发专家指南:响应式Web界面构建与最佳实践
269 周安装
美国商务英语写作指南:专业沟通技巧、美式拼写与商务邮件规范
268 周安装
Electron 33 + Vite + React + TypeScript 构建安全桌面应用教程与架构指南
262 周安装
Hugging Face 模型评估技能:自动提取、导入和运行AI模型评测,优化模型卡片
264 周安装
Google Sheets API 集成指南:使用 Membrane CLI 自动化电子表格操作
266 周安装
defaultoptional"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.*KEEP to return only needed columns and reduce token consumption.test-tool before assigning to an agent."params": {}.