Security
Agent permissions
An agent queries corpora and calls external systems through its own service account. Tool calls use that account's permissions rather than the caller's.
Two settings control this: the scope of the agent's tools, which determines
the roles its service account holds, and a per-user filter applied with
attribute-based access control.
For example, be careful to define which corpora the corpora_search tool has
access to, because leaving it unset gives it access to every corpus in the
account.
What your agent can reach
Each tool declares which of its arguments carries the corpus key it acts on. How you configure that argument determines how wide the agent's role becomes.
- Pin the corpus in the tool's configuration. The service account receives a role on that corpus only.
- Leave the argument unset. No corpus key is available to scope to, so the service account receives the equivalent account-wide role.
| Tool permission | Pinned to a corpus | Left unscoped |
|---|---|---|
| Query | Query role on that corpus | corpus_viewer across the account |
| Index | Index role on that corpus | corpus_developer across the account |
| Admin or owner | The declared role on that corpus | corpus_administrator across the account |
An agent with one unscoped corpora_search tool holds corpus_viewer on every
corpus in the account. Pin the corpus unless you intend the agent to query all
of them.
An argument set to a reference the platform cannot resolve at configuration
time produces the same account-wide role, because no corpus key is available to
scope to. This applies to agent.* and session.* references inside a tool
owned by a composable lambda, because no session exists until the agent runs.
Scope a search tool to one corpus
Name the corpus in the tool's query_configuration, where the agent cannot
change it.
{
"knowledge_search": {
"type": "corpora_search",
"query_configuration": {
"search": {
"corpora": [{ "corpus_key": "support-articles" }]
}
}
}
}
The agent's auto identity now carries a query role on support-articles
rather than on the whole account. To scope results per user within that corpus,
add a metadata_filter as described in
attribute-based access control.
Where the agent's roles come from
Each agent has an OAuth2 service account, reported as client_id on
Get agent identity. Its roles come from one
of two modes.
| Mode | Where roles come from | Use when |
|---|---|---|
auto | Derived from the agent's tool configuration and recomputed whenever that configuration changes. | The default. The agent should hold exactly what its tools need. |
manual | Set explicitly through the identity API and left alone. | You need a role the tool configuration does not imply, or you want the set frozen. |
In auto mode the platform computes the minimum roles the tools require,
including the tools that a composable lambda calls through its own
configurations.
How access is enforced
Access is checked when the request arrives, when a tool runs, and when an agent is created or updated.
| Check | What it verifies | When |
|---|---|---|
| The caller reaches the API | The caller holds a role for the operation. On the end-user session API, the caller must also be a member of the session. | Every request |
| The agent runs the tool | The tool call executes as the agent's service account, not as the caller. | Every tool call |
| The agent cannot exceed its creator | The roles the agent's tools require must be a subset of the roles held by whoever creates or updates it. | Agent create and update |
Reading, sending to, or deleting a session you are not a member of returns
403, and an agent administrator is bound by that rule on the end-user API like
anyone else. See End user sessions.
Tool calls run under the agent's service account. The caller's own corpus permissions do not narrow what a tool can reach, and their identity is recorded for tracing rather than consulted when a tool runs.
The same holds outside Vectara. A tool that authenticates to an upstream system with a shared service-account credential presents that account to the upstream system, so that system cannot tell one caller from another. See Connector authentication patterns.
Creating an agent cannot escalate your own permissions. If your tool
configuration needs a role you do not hold, the request is rejected with 403
and a message naming the tool configurations that require them.
Related
- Role-based access control - the roles an account can grant.
- Attribute-based access control - filtering results per user inside a corpus.
- End user sessions - session membership and what an end user can read.
- Secrets - the encrypted credential scopes a tool can reference.