|
| 1 | +--- |
| 2 | +applies_to: |
| 3 | + stack: preview 9.2 |
| 4 | + serverless: |
| 5 | + elasticsearch: preview |
| 6 | + observability: unavailable |
| 7 | + security: unavailable |
| 8 | +navigation_title: "Permissions & access control" |
| 9 | +--- |
| 10 | + |
| 11 | +# Permissions and access control in {{agent-builder}} |
| 12 | + |
| 13 | +Use this page to learn how to configure security roles and API keys for {{agent-builder}}. Understanding these privileges helps you control who can use agents, which tools they can access, and what data they can query. |
| 14 | + |
| 15 | +## Required privileges |
| 16 | + |
| 17 | +{{agent-builder}} requires privileges at three levels: |
| 18 | + |
| 19 | +- [{{kib}} feature access](#kib-privileges) |
| 20 | +- [{{es}} cluster access](#es-cluster-privileges) |
| 21 | +- [{{es}} index access](#es-index-privileges) |
| 22 | + |
| 23 | +### {{kib}} privileges |
| 24 | + |
| 25 | +{{agent-builder}} access control is managed by the `agentBuilder` {{kib}} feature: |
| 26 | + |
| 27 | +- "Read" access to the `agentBuilder` feature: Required to use agents, send chat messages, view tools, and access conversations. |
| 28 | +- "All" access to the `agentBuilder` feature: Required to create, update, or delete custom agents and tools. |
| 29 | +- "Read" access to the "Actions and Connectors" feature: Required to use AI connectors with agents. |
| 30 | + |
| 31 | +Learn more about [{{kib}} privileges](/deploy-manage/users-roles/cluster-or-deployment-auth/kibana-privileges.md). |
| 32 | + |
| 33 | +### {{es}} cluster privileges |
| 34 | + |
| 35 | +{{agent-builder}} requires cluster-level privileges for AI-powered query generation: |
| 36 | + |
| 37 | +- `monitor_inference`: Required when the agent uses an AI connector that calls the {{es}} Inference API (such as the Elastic default LLM or other AI connectors configured to use the Inference API). The built-in tools `search` and `generate_esql`, as well as [index search tools](tools/index-search-tools.md), use this API to generate queries from natural language. This privilege is not required when the agent uses other {{kib}} GenAI connectors. |
| 38 | + |
| 39 | +Learn more about [cluster privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html#privileges-list-cluster). |
| 40 | + |
| 41 | +### {{es}} index privileges |
| 42 | + |
| 43 | +Tools execute queries against {{es}} indices as the current user. Required privileges depend on which indices the tools access: |
| 44 | + |
| 45 | +- `read`: Required for tools that query data. |
| 46 | +- `view_index_metadata`: Required for tools that inspect index structure. Also required for the built-in `search` tool and [index search tools](tools/index-search-tools.md), which may use index exploration capabilities internally. |
| 47 | + |
| 48 | +Learn more about [index privileges](elasticsearch://reference/elasticsearch/security-privileges.md#privileges-list-indices). |
| 49 | + |
| 50 | +## Grant access |
| 51 | + |
| 52 | +You can grant users access to {{agent-builder}} using these methods: |
| 53 | + |
| 54 | +- [Roles](#grant-access-with-roles) to bundle privileges for users. |
| 55 | +- [API keys](#grant-access-with-api-keys) for programmatic access. |
| 56 | +- [Spaces](#working-with-spaces) to scope access to specific environments. |
| 57 | + |
| 58 | +### Grant access with roles |
| 59 | + |
| 60 | +[Roles](/deploy-manage/users-roles/cluster-or-deployment-auth/defining-roles.md) are {{es}} security constructs that bundle together {{kib}} feature privileges and {{es}} privileges. To grant users access to {{agent-builder}}, create a role that includes the required privileges. |
| 61 | + |
| 62 | +:::{note} |
| 63 | +When configuring roles in the {{kib}} UI, {{agent-builder}} privileges are currently located under the **Analytics** section, not the {{es}} section. |
| 64 | +::: |
| 65 | + |
| 66 | +Example role for users who need full {{agent-builder}} access: |
| 67 | + |
| 68 | +```json |
| 69 | +POST /_security/role/agent-builder-full |
| 70 | +{ |
| 71 | + "cluster": ["monitor_inference"], |
| 72 | + "indices": [ |
| 73 | + { |
| 74 | + "names": ["logs-*", "metrics-*"], |
| 75 | + "privileges": ["read", "view_index_metadata"] |
| 76 | + } |
| 77 | + ], |
| 78 | + "applications": [ |
| 79 | + { |
| 80 | + "application": "kibana-.kibana", |
| 81 | + "privileges": [ |
| 82 | + "feature_agentBuilder.all", |
| 83 | + "feature_actions.read" |
| 84 | + ], |
| 85 | + "resources": ["space:default"] |
| 86 | + } |
| 87 | + ] |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +:::{tip} |
| 92 | +For read-only access, use `feature_agentBuilder.read` instead of `feature_agentBuilder.all`. |
| 93 | +::: |
| 94 | + |
| 95 | +### Grant access with API keys |
| 96 | + |
| 97 | +When using the {{agent-builder}} APIs programmatically, authenticate with an API key that includes the required privileges. |
| 98 | + |
| 99 | +Unlike roles, which use UI-friendly feature privilege names like `feature_agentBuilder.all`, API keys use the underlying API privilege names (`read_onechat`, `manage_onechat`). This is because API keys interact directly with the {{kib}} API layer rather than through the UI. |
| 100 | + |
| 101 | +Refer to these pages for API key configuration examples: |
| 102 | +- [MCP server](mcp-server.md#api-key-application-privileges) |
| 103 | +- [{{kib}} API](kibana-api.md) |
| 104 | + |
| 105 | +Learn more about [API keys](/deploy-manage/api-keys/elasticsearch-api-keys.md). |
| 106 | + |
| 107 | +### Working with Spaces |
| 108 | + |
| 109 | +{{agent-builder}} respects {{kib}} Spaces when enabled. All conversations, custom agents, and custom tools are scoped to the current Space. |
| 110 | + |
| 111 | +When configuring roles or API keys, specify the Space in the application privileges resources (e.g., `"resources": ["space:production"]`). Users and API keys cannot access resources in other Spaces. |
| 112 | + |
| 113 | +Learn how to [Copy your MCP server URL](tools.md#copy-your-mcp-server-url). |
| 114 | + |
| 115 | +:::{important} |
| 116 | +When accessing {{agent-builder}} APIs or the MCP server from a custom Space, include the space name in the URL path: `https://<deployment>/s/<space-name>/api/agent_builder/...` |
| 117 | + |
| 118 | +The default space uses the standard URL format without `/s/<space-name>`. |
| 119 | +::: |
| 120 | + |
| 121 | +Learn more about [{{kib}} Spaces](/deploy-manage/manage-spaces.md). |
0 commit comments