|
| 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 | + |
| 12 | +# Permissions and access control in {{agent-builder}} |
| 13 | + |
| 14 | +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. |
| 15 | + |
| 16 | +Agent Builder requires privileges at three levels: |
| 17 | + |
| 18 | +- [{{kib}} feature access](#kib-privileges) |
| 19 | +- [{{es}} cluster access](#es-cluster-privileges) |
| 20 | +- [{{es}} index access](#es-index-privileges) |
| 21 | + |
| 22 | +### {{kib}} privileges |
| 23 | + |
| 24 | +Agent Builder uses two {{kib}} privileges within the `agentBuilder` feature: |
| 25 | + |
| 26 | +- `read_onechat`: Required to use agents, send chat messages, view tools, and access conversations. Maps to the "Read" feature privilege. |
| 27 | +- `manage_onechat`: Required to create, update, or delete custom agents and tools. Maps to the "All" feature privilege along with `read_onechat`. |
| 28 | + |
| 29 | +Learn more about [{{kib}} privileges](elasticsearch://reference/elasticsearch/security-privileges.md#privileges-list-kibana). |
| 30 | + |
| 31 | +### {{es}} cluster privileges |
| 32 | + |
| 33 | +Agent Builder requires cluster-level privileges for AI-powered query generation: |
| 34 | + |
| 35 | +- `monitor_inference`: Required for agents to use AI-powered tools. The built-in tools `search` and `generate_esql`, as well as [index search tools](tools/index-search-tools.md), call the {{es}} Inference API to generate queries from natural language. |
| 36 | + |
| 37 | +Learn more about [cluster privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html#privileges-list-cluster). |
| 38 | + |
| 39 | +### {{es}} index privileges |
| 40 | + |
| 41 | +Tools execute queries against {{es}} indices as the current user. Required privileges depend on which indices the tools access: |
| 42 | + |
| 43 | +- `read`: Required for tools that query data, including `execute_esql`, `search`, `get_document_by_id`, and [{{esql}} tools](tools/esql-tools.md) |
| 44 | +- `view_index_metadata`: Required for tools that inspect index structure, including `list_indices`, `get_index_mapping`, and `index_explorer` |
| 45 | + |
| 46 | +Learn more about [index privileges](elasticsearch://reference/elasticsearch/security-privileges.md#privileges-list-indices). |
| 47 | + |
| 48 | +### Granting access with roles |
| 49 | + |
| 50 | +[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. |
| 51 | + |
| 52 | +Example role for users who need full Agent Builder access: |
| 53 | + |
| 54 | +```json |
| 55 | +POST /_security/role/agent-builder-full |
| 56 | +{ |
| 57 | + "cluster": ["monitor_inference"], |
| 58 | + "indices": [ |
| 59 | + { |
| 60 | + "names": ["logs-*", "metrics-*"], |
| 61 | + "privileges": ["read", "view_index_metadata"] |
| 62 | + } |
| 63 | + ], |
| 64 | + "applications": [ |
| 65 | + { |
| 66 | + "application": "kibana-.kibana", |
| 67 | + "privileges": ["feature_agentBuilder.all"], |
| 68 | + "resources": ["space:default"] |
| 69 | + } |
| 70 | + ] |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +:::{tip} |
| 75 | +For read-only access, use `feature_agentBuilder.read` instead of `feature_agentBuilder.all`. |
| 76 | +::: |
| 77 | + |
| 78 | +### API keys for programmatic access |
| 79 | + |
| 80 | +When using the Agent Builder APIs programmatically, authenticate with an API key that includes the required privileges. |
| 81 | + |
| 82 | +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. |
| 83 | + |
| 84 | +See these pages for API key configuration examples: |
| 85 | +- [MCP server](mcp-server.md#api-key-application-privileges) |
| 86 | +- [{{kib}} API](kibana-api.md) |
| 87 | + |
| 88 | +Learn more about [API keys](/deploy-manage/api-keys/elasticsearch-api-keys.md). |
| 89 | + |
| 90 | +### Spaces |
| 91 | + |
| 92 | +Agent Builder respects {{kib}} Spaces when enabled. All conversations, custom agents, and custom tools are scoped to the current Space. |
| 93 | + |
| 94 | +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. |
| 95 | + |
| 96 | +Learn more about [{{kib}} Spaces](/deploy-manage/manage-spaces.md). |
0 commit comments