Guide

How AI agents get credentials: six models compared

AI agents get credentials in six main ways: the key is put in their environment, an MCP tool hands them the value, a proxy adds the key to their network requests, an authorization server issues them a short-lived token, a password manager fills a website login after you approve it, or a broker performs the whole secret-bearing step and returns only the result. The models differ in one question that matters most: whether the value ends up somewhere the agent, or text the agent reads, can reach. No model removes the need for narrow, expiring, revocable access.

This guide describes each model, what the agent can see, how you revoke and audit it, and when it fits. Facts about named products come from their vendors’ documentation, checked on November 8, 2026.

Why does the delivery model matter?

An agent acts on text it reads, including text written by strangers: a README, an issue, a web page. Instructions hidden in that text can steer it, which is prompt injection. So the useful question is not whether you trust the agent, but what an agent that has been talked into misbehaving could do with what it holds. A value in the agent’s context can be printed, sent elsewhere or written into a log. A value kept outside it can still be misused through the agent, but only within the scope someone granted.

The terms used below are defined in the glossary: non-human identity, agent identity, credential proxy, token exchange, MCP authorization and secretless access.

1. Environment-variable injection

How it works. A secrets tool fetches values and starts a process with them in its environment. Doppler’s doppler run injects secrets as environment variables, and can mount them as an ephemeral file instead (Doppler). The 1Password CLI’s op run and Bitwarden’s early-preview Agent Access tool aac run, which passes a credential only through the child process’s environment (Bitwarden), follow the same pattern. A plain .env file is the unmanaged version.

What the agent can see. The value is not in the chat, but it is in the process. Any command the agent runs in that environment can print it, and agent harnesses pass environment variables on to the tools they start: a local MCP server in Claude Code inherits the shell environment unless an allowlist is set (/agents/claude-code).

Revocation and audit. The secrets tool logs that a value was fetched, not what the process did with it. Revoking means rotating the key at the provider.

When it fits. Trusted scripts and CI jobs, and agents working only with low-value, test or read-only keys. It is the easiest model to adopt and the weakest boundary against a misled agent.

2. MCP secret retrieval

How it works. An MCP server connects the agent to a vault or secrets manager and exposes tools such as “get secret”. The Model Context Protocol is how most coding agents call tools, so this is often the first integration a vendor ships.

What the agent can see. Whatever the tool returns. If it returns a value, the value enters the model’s context and usually the transcript. Doppler’s MCP server, which Doppler labels experimental and intended for development and evaluation, lists reading secret values among its operations and offers a --read-only flag that hides write tools (Doppler). Bitwarden’s MCP server exposes vault tools, including getting items, through the Bitwarden CLI, and its README warns that an assistant with access can read and change vault contents and that the server is for local use only (Bitwarden). Infisical’s MCP server has a get-secret tool (Infisical). Not every MCP server returns values: 1Password’s local MCP server manages Environments and returns only secret and Environment names (1Password).

Revocation and audit. Scope the machine token the MCP server uses, and revoke that token to cut access. The vault logs reads; the transcript may hold the values.

When it fits. Managing secrets (creating, listing, organising) rather than using them, and reading values only in throwaway environments.

3. Network credential proxy

How it works. The agent’s traffic goes through a proxy that knows which credential belongs to which host. The agent holds a placeholder or a session token; the proxy adds the real key to the request and forwards it. Infisical Agent Vault works this way: infisical agent-vault run starts an agent with its HTTP traffic routed through the proxy, which attaches credentials only for hosts in the session’s access bundle, can restrict methods and paths, and handles both HTTP APIs and MCP servers (Infisical). To change HTTPS requests, the proxy presents certificates from its own certificate authority, which the agent is set up to trust.

What the agent can see. A session token or placeholder, and the responses. The real key stays in the proxy, unless a service echoes it back in a response.

Revocation and audit. Revoke the session; Infisical notes that anyone holding the session token has the same access until it expires or is revoked. The proxy is a natural place to log requests. Infisical recommends running the proxy on a different machine from the agent, because an agent on the same machine could read the proxy’s state.

When it fits. Agents that call HTTP APIs with static keys, especially in sandboxes and servers you control. It needs no code changes, since it uses the standard HTTPS_PROXY setting.

4. OAuth token exchange and task-scoped tokens

How it works. Instead of a long-lived key, the agent gets a short-lived token from an authorization server. OAuth 2.0 Token Exchange, RFC 8693, lets a client present one token (who it acts for, and optionally who is acting) and receive a narrower one for a stated audience or scope; in delegation, an act claim records the acting party (RFC 8693). Keycard uses token exchange to issue task-scoped credentials and narrow permissions each time work passes between agents (Keycard). Aembit’s MCP Identity Gateway sits between agents and MCP servers and relays requests with credentials Aembit manages, and its “blended identity” evaluates the agent and the human operating it in one policy decision (Aembit). For remote MCP servers, the MCP specification’s authorization section defines an OAuth 2.1 flow in which each token is bound to one server and must not be passed through to upstream APIs (MCP).

What the agent can see. A bearer token, but a weak one to steal: short-lived, valid at one service, and limited to the task’s scopes.

Revocation and audit. Strong. Tokens expire on their own, policy changes can revoke them, and the authorization server records which agent acted for whom.

When it fits. Companies with an identity platform and services that accept OAuth tokens. The limit is coverage: many APIs and most websites still accept only static keys or passwords.

5. Browser sign-in approval

How it works. The agent asks a password manager to sign in to a website, a person approves, and the password manager fills the form. 1Password for Agents, launched on October 22, 2026, is the main example. A supported agent app, such as Claude Duet, Grok Bot, Muse or Town, asks 1Password for a sign-in; 1Password shows a prompt naming the app and a suggested login; you approve, choose another login or deny; and the 1Password browser extension in the agent’s browser fills the username, password and one-time code outside the agent’s view and submits the form (1Password support, 1Password blog, TechCrunch). It costs nothing extra on Individual and Family accounts on 1Password.com; team, business, 1Password.ca and 1Password.eu accounts are not supported yet, and nor are passkeys or shared vaults. A separate integration for the Claude desktop app on a Mac turns on an Agentic Mode in which only the items approved for the current task are reachable (1Password).

What the agent can see. Not the password or one-time code, according to 1Password. It gets a signed-in session, and 1Password says plainly that after sign-in the website manages the session as it would in your own browser, so the agent can act on the account.

Revocation and audit. An approval lasts up to 30 days for that site; you can disconnect an agent at any time and ask it to sign out. The support article does not describe a log of past agent sign-ins.

When it fits. Personal assistants that book, buy and manage accounts on websites. It does not cover API keys for commands or coding agents calling cloud APIs; for those, 1Password’s developer tools (CLI, SDKs, the Environments MCP server) apply instead.

6. Intent brokering

How it works. The agent never asks for a value at all. It asks for an outcome, such as “run this deploy with the Cloudflare token” or “make this request with the Stripe key”, and a broker checks policy, performs the secret-bearing step itself, and returns a result. This is a credential broker with a fixed set of actions. BotPassword works this way: agents call intents over MCP or the CLI, the daemon checks each call against a grant a person approved, and the agent gets back a typed outcome and redacted output. Built today: run_with, which runs a command with a key (sealed on Linux and macOS through a per-run proxy that swaps a placeholder for the value only on the grant’s hosts), http_request, which checks the destination against the credential’s allowed hosts and injects the auth, and request_access, approved in the desktop app.

What the agent can see. By default, no value: no intent returns one. Some delivery is disclosing by design, and BotPassword labels it so. A disclosing run_with puts the value in the child process’s environment, cli_login hands it to tools such as git or Docker through a credential helper, and website sign-in over a browser the agent drives fills a page the agent could read back. A sealed fill is planned, not built yet.

Revocation and audit. Grants are scoped to a project, intents, hosts and an expiry, and revoking one cuts that agent client off. The ledger records each request and decision. See Security for agents and the security model.

When it fits. People and small teams whose coding agents deploy, call APIs and log in to CLIs with static keys, and who want approvals in their password manager rather than in a chat window. See /agents for per-harness setup.

How do the six models compare?

Model How the credential reaches the service What the agent can see Revocation and audit Example
Environment-variable injection Value placed in the process environment The value, through any command it runs Fetch logged; rotate the key to revoke doppler run, op run, .env
MCP secret retrieval Tool returns the value to the agent The value, in context and transcript Revoke the MCP server’s token; reads logged Doppler, Bitwarden, Infisical MCP servers
Network credential proxy Proxy adds the key to outbound requests A session token or placeholder Revoke the session; proxy can log requests Infisical Agent Vault
Token exchange Authorization server issues a short-lived, scoped token A short-lived token for one service Tokens expire; policy revokes; issuer logs RFC 8693, Keycard, Aembit
Browser sign-in approval Password manager fills the website login The signed-in session, not the password Approval up to 30 days; disconnect anytime 1Password for Agents
Intent brokering Broker performs the step and returns a result Typed outcome and redacted output by default Scoped, expiring grants; ledger of decisions BotPassword

How do you choose?

  1. If the service accepts OAuth tokens, prefer short-lived tokens. Token exchange and MCP authorization give the strongest revocation and the clearest audit trail.
  2. If the agent signs in to websites for you, use a sign-in approval model. 1Password for Agents does this today for supported personal agents. Remember that the agent can act on the account once signed in.
  3. If the service only takes a static key, keep the key outside the agent. A proxy or a broker attaches it only for approved hosts. Run the component where the agent cannot read its state.
  4. Use environment injection or MCP retrieval only where a leak would be cheap, such as test keys, read-only keys or a disposable sandbox.
  5. In every model, scope and expire the credential itself. A narrow key behind a weak delivery model can do less harm than a powerful key behind a strong one. See how to give AI coding agents API access safely.

What are BotPassword’s limits?

BotPassword is in early access and runs from source today, so treat it as you would any young security tool.

  • Some intents are not finished. rotate is partly built (Cloudflare tokens and AWS IAM keys, through an autopilot grant); changing a password is planned, not built yet. Approval on your phone is planned, not built yet; today you approve in the desktop app or bpw access. Planned: bpw agent install will set up each harness in one step; today, add the bpw mcp entry by hand.
  • Sealed delivery is limited. Sealed run_with works on Linux and macOS, not Windows, and some tools, such as Go programs on macOS, do not honour its certificate settings. A sealed grant does not fully protect a short or guessable value.
  • Disclosing modes exist. cli_login, website sign-in and a disclosing run_with let code the agent runs read the value; grants must opt in, and BotPassword marks them as disclosing.
  • Redaction is best effort. It catches known values and simple encodings, not every transformation.
  • Client identity is attribution, not isolation. Each harness is enrolled as its own client and checked by process where the platform allows, which tells you which agent asked but does not stop another process running as the same user.
  • No independent assessment has been published yet. The security design is public; an outside review is on the roadmap.

If you need website sign-ins for a personal assistant today, 1Password for Agents is the more mature choice; see BotPassword vs 1Password. If your agents mostly run commands and call APIs with static keys, compare the proxy and broker models above.

Frequently asked questions

What is the safest way to give an AI agent a credential?

Give it as little as the task needs, for as short a time as possible. Where the service supports OAuth, a short-lived, audience-bound token is the cleanest option. Where it only issues static keys, keep the key outside the agent with a proxy or broker that attaches it only for approved hosts.

Does an MCP server keep secrets away from the model?

Not by itself. An MCP tool that returns a secret puts that value in the model's context and usually in the transcript. Some MCP servers, such as 1Password's Environments server, return names only; others, such as Doppler's experimental server, can return values.

How does 1Password for Agents work?

A supported agent app asks 1Password to sign in to a site, you approve or deny the request in 1Password, and the 1Password browser extension fills the login outside the agent's view. An approval lasts up to 30 days for that site. It covers website sign-ins, not API keys for commands.

What is the difference between a credential proxy and token exchange?

A proxy keeps a static key outside the agent and adds it to requests on the way out. Token exchange (RFC 8693) replaces the static key with a short-lived token issued for one service and task. Token exchange needs the target service to accept OAuth tokens; a proxy works with services that only take API keys.

Where does BotPassword fit among these models?

BotPassword is an intent broker for people and their agents: the agent asks for an outcome such as running a command or making a request, and the daemon performs the secret-bearing step under a grant you approved. It is in early access, and some intents are partly built or planned.

More guides

Give agents access. Keep the keys.

BotPassword is in early access. Request an invite and we'll email you when your spot opens.