POST /api/agent_builder/agents

Spaces method and path for this operation:

post /s/{space_id}/api/agent_builder/agents

Refer to Spaces for more information.

Create a new agent. Use this endpoint to define the agent's behavior, appearance, and capabilities through comprehensive configuration options. To learn more about agents, refer to the agents documentation.

[Required authorization] Route required privileges: agentBuilder:manageAgents.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

Body

  • access_control object

    Additional properties are NOT allowed.

    Hide access_control attribute Show access_control attribute object
    • access_mode string Required Generally available

      Access-control mode: public (any privileged user can read/write), shared (any privileged user can read, only owner can write), private (only owner can read/write). Agents created without an access-control mode default to private.

      Values are public, shared, or private.

  • avatar_color string

    Optional hex color code for the agent avatar.

  • avatar_symbol string

    Optional symbol/initials for the agent avatar.

  • configuration object Required

    Configuration settings for the agent.

    Additional properties are NOT allowed.

    Hide configuration attributes Show configuration attributes object
    • ai_indices array[string]

      Array of AI indices to associate with the agent.

      Not more than 100 elements. Maximum length of each is 256.

    • approvals object Generally available

      Auto-approval defaults applied to every run of this agent.

      Additional properties are NOT allowed.

      Hide approvals attribute Show approvals attribute object
      • auto_approved_apis object

        Destructive Elasticsearch or Kibana APIs this agent may call without a user confirmation, keyed by backend.

        Additional properties are NOT allowed.

        Hide auto_approved_apis attributes Show auto_approved_apis attributes object
        • elasticsearch array[string]

          Elasticsearch APIs pre-approved for every run of this agent. Each entry is an exact identifier formed from the namespace and name (for example indices.create), a namespace wildcard (for example indices.*), or * for every Elasticsearch API. Entries are not checked against the known APIs, and one that matches no API has no effect.

          Not more than 100 elements. Maximum length of each is 256.

        • kibana array[string]

          Kibana APIs pre-approved for every run of this agent. Each entry is an exact identifier formed from the namespace and name (for example alerting.delete-alerting-rule-id), a namespace wildcard (for example alerting.*), or * for every Kibana API. Entries are not checked against the known APIs, and one that matches no API has no effect.

          Not more than 100 elements. Maximum length of each is 256.

    • connector_ids array[string]

      Array of connector IDs to associate with the agent.

      Not more than 100 elements.

    • enable_elastic_capabilities boolean

      When true, enables built-in Elastic capabilities for the agent.

    • instructions string

      Optional system instructions that define the agent behavior.

    • plugin_ids array[string]

      Array of plugin IDs to assign to the agent.

      Not more than 100 elements.

    • post_execution_workflow_ids array[string]

      Optional list of workflow IDs. When set, these workflows run after the agent finishes each round.

      Not more than 100 elements. Maximum length of each is 512.

    • skill_ids array[string]

      Array of skill IDs to be available to the agent.

      Not more than 100 elements.

    • subagent_ids array[string] Generally available

      Allowlist of subagent IDs this agent may spawn. Missing or empty disables the run_subagent tool. Use '_self' to enable self-fork.

      Not more than 50 elements. Maximum length of each is 64.

    • tools array[object] Required

      Tool selection configuration for the agent.

      Hide tools attribute Show tools attribute object

      Tool selection configuration for the agent.

      • tool_ids array[string] Required

        Array of tool IDs that the agent can use.

    • workflow_ids array[string]

      Optional list of workflow IDs. When set, these workflows run before every agent execution, in order.

      Not more than 100 elements.

  • description string Required

    Description of what the agent does.

  • id string Required

    Unique identifier for the agent.

  • labels array[string]

    Optional labels for categorizing and organizing agents.

  • name string Required

    Display name for the agent.

Responses

  • 200 application/json

    Indicates a successful response

POST /api/agent_builder/agents
curl \
  -X POST "${KIBANA_URL}/api/agent_builder/agents" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "new-agent-id",
    "name": "Search Index Helper",
    "description": "Hi! I can help you search the data within the indices starting with \"content-\" prefix.",
    "labels": ["custom-indices", "department-search"],
    "avatar_color": "#BFDBFF",
    "avatar_symbol": "SI",
    "configuration": {
      "instructions": "You are a custom agent that wants to help searching data using all indices starting with prefix \"content-\".",
      "tools": [
        {
          "tool_ids": [
            "platform.core.search",
            "platform.core.list_indices",
            "platform.core.get_index_mapping",
            "platform.core.get_document_by_id"
          ]
        }
      ]
    }
}'
POST kbn://api/agent_builder/agents
{
  "id": "new-agent-id",
  "name": "Search Index Helper",
  "description": "Hi! I can help you search the data within the indices starting with \"content-\" prefix.",
  "labels": ["custom-indices", "department-search"],
  "avatar_color": "#BFDBFF",
  "avatar_symbol": "SI",
  "configuration": {
    "instructions": "You are a custom agent that wants to help searching data using all indices starting with prefix \"content-\".",
    "tools": [
      {
        "tool_ids": [
          "platform.core.search",
          "platform.core.list_indices",
          "platform.core.get_index_mapping",
          "platform.core.get_document_by_id"
        ]
      }
    ]
  }
}
Request example
Example request for creating a custom agent with special prompt and tools
{
  "avatar_color": "#BFDBFF",
  "avatar_symbol": "SI",
  "configuration": {
    "instructions": "You are a custom agent that wants to help searching data using all indices starting with prefix \"content-\".",
    "tools": [
      {
        "tool_ids": [
          "platform.core.search",
          "platform.core.list_indices",
          "platform.core.get_index_mapping",
          "platform.core.get_document_by_id"
        ]
      }
    ]
  },
  "description": "Hi! I can help you search the data within the indices starting with \"content-\" prefix.",
  "id": "created-agent-id",
  "labels": [
    "custom-indices",
    "department-search"
  ],
  "name": "Search Index Helper"
}
Response examples (200)
Example response returning the definition of an agent created as a result of the request
{
  "avatar_color": "#BFDBFF",
  "avatar_symbol": "SI",
  "configuration": {
    "instructions": "You are a custom agent that wants to help searching data using all indices starting with prefix \"content-\".",
    "tools": [
      {
        "tool_ids": [
          "platform.core.search",
          "platform.core.list_indices",
          "platform.core.get_index_mapping",
          "platform.core.get_document_by_id"
        ]
      }
    ]
  },
  "description": "Hi! I can help you search the data within the indices starting with \"content-\" prefix.",
  "id": "created-agent-id",
  "labels": [
    "custom-indices",
    "department-search"
  ],
  "name": "Search Index Helper",
  "type": "chat"
}