Resource · Definition

What are task-scoped credentials?

Task-scoped credentials are short-lived, identity-bound secrets issued for one agent session, one person, one agent, one task, and revoked when the task ends. The agent never sees the raw long-lived secret for the upstream system.

Scroll for definition
Nolan Sullivan headshotBy Nolan Sullivan, Founding Growth Engineer
Published
Definition

task-scoped credentials

Task-scoped credentials are short-lived, identity-bound secrets issued for one agent session, one person, one agent, one task, and revoked when the task ends. The agent never sees the raw long-lived secret for the upstream system, and if the session dies or the person is deprovisioned, the credential dies with it.


Task-scoped credentialsDefinitionSpeakeasy

Task-scoped credentials exist because the common way to connect an AI agent to an upstream system is a long-lived secret, such as an API key pasted into a config file, or a shared service account every agent signs in with. That secret can keep working long after the task, the session, and the employee are gone. A task-scoped credential is a short-lived, just-in-time credential minted for the session in front of it, bound to the person driving it, and expired when the task completes, so the durable secret never enters the agent at all.

Why do long-lived agent secrets show up in security incident reports?

The shared service account is the default because it works on the first try, with one key for every agent and no further ceremony. The properties that make it convenient are the ones that make it a liability:

  • It is over-scoped. A single credential has to cover everything any agent might ever do.
  • It is held by every agent at once. A leak from any one of them is a leak of the whole grant.
  • It leaves no trail. Every action arrives under the same name, which turns the incident-response question of who did this into a dead end.

Agents typically make each of those properties worse than they were for ordinary service integrations. An agent often holds its secret in places that weren’t designed to keep one, such as a dotfile, an environment variable, or a context window that can be coaxed into repeating what it has read. And a key in an agent config is usually tied to nothing in the directory, so when the engineer who set it up leaves, the key can keep working.

What kind of non-human identity an agent should hold instead is the subject of what is agent identity and what is non-human identity. The credential pattern on this page is how that identity reaches the upstream system without a durable secret riding along.

What does identity-bound mean for a task-scoped credential?

An identity-bound credential carries who is acting, not just what is allowed. The session behind it names the person from the directory as the subject and the agent workload as the actor, the pairing described in what is agent composite identity. When the agent requests a tool, the full tuple of tenant, subject, actor, and tool resolves to exactly one upstream credential, or an error. The resolution fails closed, never into a fallback, so a request that matches no grant gets a refusal instead of a shared key.

The tuple resolves to one credential or a refusalTenant, subject, actor, and tool converge on a single resolution step. That step produces one of two outcomes: exactly one scoped credential for the matching grant, or a refusal when no grant matches. There is no fallback to a shared credential.REFERENCE · CREDENTIAL RESOLUTIONResolution grants exactly one credential or refuses the request
Tenant
The organization the call runs under
Subject
The person from the directory
Actor
The agent workload making the call
Tool
The upstream system being requested
Resolution
The full tuple is checked against issued grants.
Tuple matches a grant
Exactly one task-scoped credential is minted, bound to this session
No grant matches
The request is refused. Nothing is issued, and there is no shared credential to fall back to
Resolution can only reach one of these two outcomes. A partial or misrouted match still resolves to a refusal, never a shared key.

Binding the credential to a person is also what makes directory events reach agent access. Deprovision the person in the identity provider and the credentials bound to them stop being issued, which is the practical meaning of extending IAM to agents. The controls the organization already runs for people, including joiner and leaver events, govern the agents acting on their behalf with no parallel system to keep in sync.

Are task-scoped credentials the same as agent-scoped credentials?

No, and the difference is which boundary the credential dies at. A credential scoped to the agent alone is a standing secret that belongs to the agent workload. Every person who triggers the agent rides on the same credential, it lives as long as the agent does, and offboarding any one person never touches it. That is a service account by another name, with the over-scoping, the shared trail, and the offboarding gap described above.

A task-scoped credential narrows two further dimensions. It is bound to the person driving the run as well as the agent, and it lives for the task rather than for the agent’s lifetime. The agent still has a durable identity, its name, owner, and grants in the control plane, but no durable secret comes with it. That split is what keeps directory events meaningful. Deprovisioning a person stops issuance for every session they drove, and retiring an agent retires its identity without leaving a key to find and rotate.

How long do task-scoped credentials last before they expire?

Every credential expires when the task completes, the credential itself is never stored, and nothing has to remember to clean it up, so its whole life is measured in minutes. The agent identity product page shows this concretely. A live session in the gateway console carries a credential with a TTL of 23 minutes, counting down alongside the identity and policy checks for the same call.

Expiry handles the normal case, and revocation handles the urgent one, taking one call and applying immediately. Between the two, the failure modes of the long-lived key disappear. A credential captured mid-session is worthless minutes later, a session that dies takes its credential with it, and a person who is deprovisioned stops being a valid subject for issuance, so their agents lose access on the same directory event that disables their account.

How do task-scoped credentials compare to an API key in the agent config?

The API key in the config and the task-scoped credential answer the same integration need, so the difference is easiest to see property by property.

PropertyAPI key in the agent configTask-scoped credential
LifetimeUntil someone remembers to rotate itThe task, measured in minutes
Who holds the secretThe agent, its config file, and anything that can read eitherThe agent holds only the session credential, and the raw secret never enters it
ScopeEverything the key can reachThe person, the agent, and the task
When the person leavesThe key can keep workingIssuance stops with the deprovisioned identity
The trailNo action tied to a personEvery action attributed to the person and agent

The mechanism behind the right-hand column is just-in-time issuance, a short-lived credential minted at the moment of use, from a system that can bind it to the session requesting it. Where that system sits matters. Agents reach tools through an MCP gateway, which puts a single point on the path of every call, and that point is where a scoped credential can be issued per session instead of a standing secret being distributed to every agent config in the organization.

How does the Speakeasy AI Control Plane issue just-in-time task-scoped credentials?

The Speakeasy AI Control Plane ships the pattern as part of agent identity, and the issuance is the third step of a fixed sequence rather than a feature to wire up separately:

  • Identity resolves first. The person signs in through the identity provider the organization already runs, and the session binds them as the subject with the agent workload as the actor.
  • Policy evaluates before anything is minted. Every tool call is checked against rules scoped to the person, the system, and the action, and a matching deny always wins.
  • The credential is minted for the task. The platform issues a short-lived credential bound to the person and the task. Agents never see raw secrets. Credentials are identity-bound and expire with the task, with no shared service accounts and no long-lived tokens.
  • Every decision is recorded. Allow and deny both land in the audit stream under the directory identity that drove the call.

The model behind it is that identity lives in the control plane and credentials never do. The platform holds the agent’s name, its owner, its grants, and a rule saying that an assertion from a trusted issuer is that agent. It holds no secret for the agent and cannot reissue one, so there is no agent key for an attacker to steal or replay, and the tuple resolution described above fails closed rather than falling back to one. To see what your agents would hold under this model, and what they would stop holding, talk to us.

Frequently asked questions

What are task-scoped credentials?

Task-scoped credentials are short-lived, identity-bound secrets issued for one agent session, meaning one person, one agent, one task, and revoked when the task ends. The agent never sees the raw long-lived secret for the upstream system. If the session dies or the person behind it is deprovisioned, the credential dies with it, so nothing durable is left behind for an attacker or a departed employee to reuse.

How long does a task-scoped credential live?

As long as the task, measured in minutes rather than months. The Speakeasy agent identity product page shows a live session where the issued credential carries a TTL of 23 minutes. Every credential expires when the task completes, the credential itself is never stored, and revocation takes one call and is effective immediately.

What does identity-bound mean for a credential?

The credential is tied to a session that names the person as the subject and the agent as the actor, so it carries who is acting, not just what is allowed. When the agent requests a tool, the full tuple of tenant, subject, actor, and tool resolves to exactly one upstream credential, or an error. The resolution fails closed, never into a fallback, so there is no shared key for a misrouted request to land on.

Do agents ever see the raw secret for the upstream system?

No. The agent works with the short-lived credential minted for its session, and the long-lived secret for the upstream system stays out of the agent, its config, and its context window entirely. That removes the failure mode where a key pasted into an agent config leaks through a log, a prompt, or a compromised dependency.

How are task-scoped credentials different from a shared service account?

A shared service account is one key used by every agent, scoped wide enough to cover anything any of them might do, and it leaves no trail because every action arrives under the same name. A task-scoped credential is minted per session, bound to the person and agent that requested it, scoped to the task, and expired when the work is done, with every action attributed to a named identity.

Are task-scoped credentials the same as agent-scoped credentials?

No. A credential scoped to the agent alone is a standing secret that belongs to the agent workload. Every person who triggers the agent rides on the same credential, it lives as long as the agent does, and offboarding any one person never touches it, which makes it a service account by another name. A task-scoped credential is bound to the person driving the run as well as the agent, and it lives for the task rather than for the agent's lifetime, so the agent keeps a durable identity while no durable secret exists for it.

What happens to an agent's access when the person behind it leaves?

Because each credential is bound to the person driving the session, deprovisioning that person in the identity provider stops issuance for their agents rather than leaving a key that can keep working after they are gone. This is the offboarding gap that long-lived agent secrets create and task-scoped credentials close.

AI everywhere.

Control here.