AGT-042DocumentedAgent identity/Credentials
Agents on people's own machines: coding assistants and other local agents
Give agents that run on laptops and workstations, such as coding assistants and desktop agents, identities and credentials that fit where they run: public-client sign-in with short-lived, device-held tokens, no personal access tokens or cloud keys in files, consent before local servers run, and the same controls on what they reach as any other agent.
In short#
- Treat a local agent as a public client: it signs the person in with authorisation code and PKCE (or device flow) and receives short-lived tokens kept in the operating system's credential store, never in dotfiles or environment variables.
- Replace personal access tokens and cloud keys with scoped, expiring tokens from your identity provider or source platform, and require consent before local MCP servers run.
- Mark agent work as the agent's (commit trailers, separate identities for unattended runs) and discover local agents and MCP servers through endpoint and browser tooling.
Problem#
The most common AI agents in many organisations are not in the cloud at all. They are coding assistants in editors and terminals, desktop agents and local MCP servers that developers and analysts install themselves. They run with the person's operating system account, read and write their files, run commands, and call cloud services with whatever credentials are lying around: a personal access token with every repository scope, cloud access keys in a profile, database passwords in a project's environment file.
This is a credential problem waiting to become an incident. A poisoned package, a malicious instruction in a README or an untrusted MCP server can make the agent run a command that sends those files somewhere else. Changes the agent makes look exactly like the person's. And because the agents were installed locally, nobody has a list of them.
When to use it#
Use it when
- People use coding assistants, terminal agents or desktop agents that call company systems.
- Local MCP servers connect agents to repositories, databases, ticketing or cloud consoles.
- Developers hold long-lived personal access tokens or cloud keys on their machines.
Avoid it, or add more, when
- The agent runs as a managed cloud service with its own workload identity. Use short-lived workload credentials (AGT-014) instead of public-client patterns.
Forces#
- Developer speed against control. A token in a file is the fastest way to get an agent working.
- Person's authority against agent attribution. Local agents act inside the person's session, so their work looks like the person's.
- Public clients cannot keep secrets. Anything shipped to a laptop can be read; security must come from PKCE, short lifetimes and device binding.
- Local servers against supply chain. Installing an MCP server is installing code that runs with the person's rights.
Solution#
Register each approved local agent (or agent product) as a public client with your identity provider, using a client ID metadata document where the provider supports it so the vendor maintains the client details. The agent signs the person in through the system browser with authorisation code and PKCE, or device flow for terminals without a browser, and stores tokens in the operating system's credential store. Tokens are short-lived and scoped to what the agent needs; where supported, they are bound to a key held on the device (DPoP). For source control and cloud, replace personal access tokens and static keys with tokens that expire in hours and carry narrow scopes. Local MCP servers come from an approved list and run only after the person consents. Unattended runs (scheduled jobs, CI) use a separate agent identity, not the person's. Endpoint and browser discovery finds agents and MCP servers that were installed without approval.

Risks and controls
| Risk | Control |
|---|---|
| Personal access token with broad scopes in a file | Short-lived, narrowly scoped tokens from sign-in; tokens in the OS credential store |
| Cloud access keys in a profile | Single sign-on to the cloud with short sessions; no static keys on laptops |
| Malicious or compromised local MCP server | Approved server list, consent before a server runs, servers pinned to versions |
| Agent runs commands with the person's full rights | Allow-lists for commands and paths; approval for destructive commands; separate workspace |
| Agent changes indistinguishable from the person's | Commit trailers or co-author lines; separate agent identity for unattended runs |
| Nobody knows which agents are installed | Endpoint and browser discovery; register or block |
How it works
- Choose approved agents and MCP servers and publish the list with installation guidance.
- Register agents as public clients in the identity provider, with a client ID metadata document where supported, redirect URIs on localhost or a custom scheme, and PKCE required.
- Use the system browser for sign-in (device flow for headless terminals) and store tokens in the OS credential store.
- Replace standing secrets: retire personal access tokens with repository-wide scopes and static cloud keys; issue short-lived tokens per task or session.
- Scope agent access with the same decision rules as other agents (AGT-003): read by default, write to specific repositories or projects, no production access from laptops.
- Gate local MCP servers: approved list, consent before first run, version pinning, and no servers that hold their own long-lived secrets.
- Attribute agent work: commit trailers or co-author lines, and a separate agent identity for scheduled or CI runs.
- Discover and respond: inventory local agents and MCP servers from endpoint and browser signals (AGT-012); revoke tokens when a device is lost or a server is withdrawn.
Design rules#
- Local agents are public clients; nothing shipped to a laptop is a secret.
- No personal access tokens or static cloud keys for agents.
- Tokens live in the OS credential store, are short-lived and narrowly scoped.
- Local MCP servers are approved, pinned and consented to.
- Unattended runs use their own agent identity.
- Agent work is marked as the agent's.
- Discovery covers endpoints, not only the cloud.
Anti-patterns#
| Anti-pattern | What goes wrong |
|---|---|
| Personal access token with all repository scopes in an environment file | One malicious instruction exfiltrates access to every repository |
| Shared client secret embedded in a desktop agent | Anyone can extract it and impersonate the agent |
| Installing any MCP server from a public registry | Unvetted code runs with the person's rights and secrets |
| Using the person's token for nightly or CI runs | Work continues after the person leaves; actions look like theirs |
| Blocking local agents outright | People use them anyway, unmanaged |
Trade-offs#
Benefits
- Far fewer long-lived secrets on laptops.
- Stolen tokens expire quickly and reach little.
- Local agents and MCP servers are known, approved and revocable.
- Agent changes can be told apart from people's.
Costs and risks
- Client registration and sign-in support for each agent product.
- Migration away from personal access tokens and static cloud keys.
- Endpoint and browser discovery tooling.
- Some agent products support only tokens in files; they need wrappers or replacement.
Recipes#
How to build this pattern on specific products. Each recipe shows its own maturity and when it was last verified.
Ping Identity recipe
Ping Identity
PingOne native application with PKCE and PingGateway
Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.
Pre-registered public clients with PKCE; PingGateway in front of MCP servers.
Configure
- Register the local agent as a native application in PingOne (or Advanced Identity Cloud) with Authorization Code and Refresh Token grants, Token Endpoint Auth Method: None and PKCE Enforcement: S256 Required, with a localhost redirect URI.
- Pre-register each client: PingOne does not support dynamic client registration; Advanced Identity Cloud supports client ID metadata documents.
- Front MCP servers with PingGateway so local agents present Ping tokens rather than server-specific secrets.
Okta recipe
Okta
Okta for AI Agents with client ID only or CIMD registration
Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.
Public-client registration for local agents, narrow resource connections and endpoint discovery. Written from Okta documentation.
Configure
- Register the local agent under Directory > AI Agents and choose Client ID only as the client registration method, which Okta recommends for public clients that cannot store a secret, such as local coding agents; use CIMD where the agent vendor publishes a metadata URL.
- Link the agent to the user-facing app so it can act only while the person is signed in.
- Add resource connections with the narrowest scopes for each repository, API or MCP server.
- Use ISPM endpoint discovery to find local agents and MCP servers on managed devices.
Microsoft Entra recipe
Microsoft Entra
Microsoft Entra local agent authentication (preview) and MSAL public clients
Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.
Public-client sign-in for local agents; on-behalf-of from a backend where needed. Written from Microsoft documentation.
Configure
- Microsoft Entra Agent ID added local agent authentication (public client, authorisation code with PKCE) in preview; use it for desktop and coding agents where available.
- Otherwise, register a public-client app registration for the local front end, sign the person in through the system browser with MSAL, and keep the agent identity on a backend that performs on-behalf-of.
- Apply Conditional Access requiring compliant devices for sessions that local agents use.
Gotchas
- Agent identities were confidential clients only before the local-agent preview; check current support before designing around a public-client agent identity.
Saviynt recipe
Saviynt
Saviynt discovery and governance of local agents
Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.
Inventory, owners and certifications; no token issuance.
Use Saviynt's discovery (Zuma Insights) to inventory agents and MCP servers it can see through its integrations, assign owners and certify their access. Saviynt does not issue tokens to local agents; pair it with your identity provider for sign-in.
Source platform and cloud short-lived tokens recipe
Source platform and cloud short-lived tokens
Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.
Replace personal access tokens and static cloud keys before rolling out coding agents.
Source platforms increasingly support short-lived, narrowly scoped tokens for apps and agents (for example app installations with per-repository permissions and user tokens that expire in hours) instead of personal access tokens. Cloud CLIs support single sign-on with short sessions instead of static keys. Configure both before rolling out coding agents.
Verification tests#
| Test | Expected result |
|---|---|
| Search developer machines (sample) for personal access tokens and cloud keys | None used by agents |
| Agent signs in | System browser with PKCE; tokens appear in the OS credential store |
| Token copied to another machine (with DPoP where supported) | Rejected, or expires within the agreed lifetime |
| Install an unapproved local MCP server | Discovered and flagged; consent prompt shown before it runs |
| Commit made by the agent | Carries the agent trailer |
| Device reported lost | Agent tokens revoked |
Maturity and verification#
Documented. Written from OAuth standards, the MCP authorisation specification and vendor documentation. Public-client support for agent identities and client ID metadata documents were preview or new in several identity providers at the time of writing.
Frequently asked questions#
Can a local agent keep a client secret?
No: anything installed on a laptop can be read by its user or by malware. Local agents use public-client flows (PKCE, device flow) and rely on short token lifetimes and device-held keys, not on a secret.
Should a coding agent use the developer's identity?
For interactive work, the person's own token with narrow scopes is acceptable, as the person is present and accountable. For scheduled, background or CI runs, use a separate agent identity so the work stops when the person leaves and is attributed correctly.
Related patterns and references#
- RFC 8252: OAuth 2.0 for Native Apps
- Model Context Protocol: authorization (2025-11-25)
- Auth0: MCP November 2025 specification update
- Okta Help: Add AI agents manually (client registration methods)
- Microsoft Learn: What's new in Microsoft Entra Agent ID
- RFC 9449: OAuth 2.0 Demonstrating Proof of Possession (DPoP)
Cite this pattern
Trevonix (2026). Agents on people's own machines: coding assistants and other local agents (AGT-042, version 1.0). Identi Patterns. https://patterns.trevonix.com/patterns/agt-042-agents-on-people-s-own-machines-coding-assistants-and-other-local-agents
Licensed under CC BY 4.0. Credit Trevonix and link to this page when you reuse it.
Patterns are guidance, provided as is and without warranty. Test in a non-production environment and check current vendor documentation before you rely on them. Read the full disclaimer.