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, refer to the agents documentation.

[Required authorization] Route required privileges: manage_agent_builder.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

Body

  • 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
    • instructions string

      Optional system instructions that define the agent behavior.

    • tools array[object] Required

      Tool selection configuration for the agent.

      Hide tools attribute Show tools attribute object
      • 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
{
  "id": "created-agent-id",
  "name": "Search Index Helper",
  "labels": [
    "custom-indices",
    "department-search"
  ],
  "description": "Hi! I can help you search the data within the indices starting with \"content-\" prefix.",
  "avatar_color": "#BFDBFF",
  "avatar_symbol": "SI",
  "configuration": {
    "tools": [
      {
        "tool_ids": [
          "platform.core.search",
          "platform.core.list_indices",
          "platform.core.get_index_mapping",
          "platform.core.get_document_by_id"
        ]
      }
    ],
    "instructions": "You are a custom agent that wants to help searching data using all indices starting with prefix \"content-\"."
  }
}
Response examples (200)
Example response returning the definition of an agent created as a result of the request
{
  "id": "created-agent-id",
  "name": "Search Index Helper",
  "type": "chat",
  "labels": [
    "custom-indices",
    "department-search"
  ],
  "description": "Hi! I can help you search the data within the indices starting with \"content-\" prefix.",
  "avatar_color": "#BFDBFF",
  "avatar_symbol": "SI",
  "configuration": {
    "tools": [
      {
        "tool_ids": [
          "platform.core.search",
          "platform.core.list_indices",
          "platform.core.get_index_mapping",
          "platform.core.get_document_by_id"
        ]
      }
    ],
    "instructions": "You are a custom agent that wants to help searching data using all indices starting with prefix \"content-\"."
  }
}