Kibana Agent Builder API fully scriptable for tools and agents
On Elastic Serverless (9.6), Kibana exposes the Agent Builder REST API, so you can create tools, agents and chats from a repo script and never need the UI. POST /api/agent_builder/tools with {id, type:'esql', description, configuration:{query, params}}. The query uses ?name placeholders, and each param is {type:'integer'|..., description, optional:true, defaultValue:7}. Optional params with defaults work, which suits a days filter like DATE_DIFF("day", @timestamp, NOW()) < ?days. POST /api/agent_builder/agents takes {id, name, configuration:{instructions, tools:[{tool_ids:[...]}]}}, and POST /api/agent_builder/converse takes {input, agent_id}. Every call needs Authorization: ApiKey <key> plus kbn-xsrf: true. GET /api/agent_builder/agents lists the built-in elastic-ai-agent, which is a quick way to check the API is enabled. To make install idempotent, PUT to update anything that already exists.