---
id: AGT-042
title: "Agents on people's own machines: coding assistants and other local agents"
url: https://patterns.trevonix.com/patterns/agt-042-agents-on-people-s-own-machines-coding-assistants-and-other-local-agents
version: "1.0"
maturity: documented
collection: "Agent identity"
category: "Credentials"
last_reviewed: 2026-11-25
problems: ["Secrets on developer machines","Coding agents with broad repository access","Shadow AI on endpoints","Supply-chain compromise through local tools","Attribution of agent changes"]
standards: ["OAuth 2.0 for Native Apps (RFC 8252)","PKCE (RFC 7636)","OAuth 2.0 Device Authorization Grant (RFC 8628)","DPoP (RFC 9449)","OAuth Client ID Metadata Document (IETF draft)","Model Context Protocol authorization","OWASP Top 10 for Agentic Applications 2026 (ASI03, ASI04, ASI05)"]
recipes: {ping: documented, okta: documented, entra: documented, saviynt: documented, misc: documented}
license: CC BY 4.0
publisher: Trevonix
---

# Agents on people's own machines: coding assistants and other local agents (AGT-042)

**Intent:** 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.

Coding assistants and desktop agents run on laptops with the person's full access, and often with long-lived access tokens and cloud keys in plain files. Register them as public clients, issue short-lived tokens held by the operating system, scope what they reach, and discover the ones nobody registered.

## 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.

## 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.

![Diagram. Left: a developer laptop with a coding agent, local MCP servers and the operating system's credential store. The agent signs the person in through the system browser with authorisation code and PKCE (device flow for a terminal) and keeps only short-lived tokens in the credential store; a re](https://patterns.trevonix.com/img/AGT-042/agt-042-solution.png)

*A local agent signs the person in with PKCE, keeps short-lived tokens in the OS store and reaches only approved tools.*

*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

1. **Choose approved agents and MCP servers** and publish the list with installation guidance.
2. **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.
3. **Use the system browser for sign-in** (device flow for headless terminals) and store tokens in the OS credential store.
4. **Replace standing secrets:** retire personal access tokens with repository-wide scopes and static cloud keys; issue short-lived tokens per task or session.
5. **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.
6. **Gate local MCP servers:** approved list, consent before first run, version pinning, and no servers that hold their own long-lived secrets.
7. **Attribute agent work:** commit trailers or co-author lines, and a separate agent identity for scheduled or CI runs.
8. **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.

> **Make the secure path the easy one:** Developers keep long-lived tokens because the alternative is signing in all day. Make the short-lived path pleasant: single sign-on with a long-lived session on the identity provider, silent token refresh, and one command that sets up a new agent. The secure path has to be the easy one.

## Design rules

1. **Local agents are public clients; nothing shipped to a laptop is a secret.**
2. **No personal access tokens or static cloud keys for agents.**
3. **Tokens live in the OS credential store, are short-lived and narrowly scoped.**
4. **Local MCP servers are approved, pinned and consented to.**
5. **Unattended runs use their own agent identity.**
6. **Agent work is marked as the agent's.**
7. **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 |

## 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

### Ping Identity

*Maturity: Documented; last verified 2026-11.*

Pre-registered public clients with PKCE; PingGateway in front of MCP servers.

Configure

1. 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.
2. Pre-register each client: PingOne does not support dynamic client registration; Advanced Identity Cloud supports client ID metadata documents.
3. Front MCP servers with PingGateway so local agents present Ping tokens rather than server-specific secrets.

### Okta

*Maturity: Documented; last verified 2026-11.*

Public-client registration for local agents, narrow resource connections and endpoint discovery. Written from Okta documentation.

Configure

1. 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.
2. Link the agent to the user-facing app so it can act only while the person is signed in.
3. Add resource connections with the narrowest scopes for each repository, API or MCP server.
4. Use ISPM endpoint discovery to find local agents and MCP servers on managed devices.

### Microsoft Entra

*Maturity: Documented; last verified 2026-11.*

Public-client sign-in for local agents; on-behalf-of from a backend where needed. Written from Microsoft documentation.

Configure

1. 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.
2. 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.
3. 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

*Maturity: Documented; last verified 2026-11.*

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

*Maturity: Documented; last verified 2026-11.*

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.

## References

- [RFC 8252: OAuth 2.0 for Native Apps](https://www.rfc-editor.org/rfc/rfc8252)
- [Model Context Protocol: authorization (2025-11-25)](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization)
- [Auth0: MCP November 2025 specification update](https://auth0.com/blog/mcp-november-2025-specification-update/)
- [Okta Help: Add AI agents manually (client registration methods)](https://help.okta.com/oie/en-us/content/topics/ai-agents/ai-agent-add-manually.htm)
- [Microsoft Learn: What's new in Microsoft Entra Agent ID](https://learn.microsoft.com/en-us/entra/agent-id/whats-new-agent-id)
- [RFC 9449: OAuth 2.0 Demonstrating Proof of Possession (DPoP)](https://www.rfc-editor.org/rfc/rfc9449)

---

Source: https://patterns.trevonix.com/patterns/agt-042-agents-on-people-s-own-machines-coding-assistants-and-other-local-agents. © Trevonix. Licensed CC BY 4.0. Provided as is, without warranty; see https://patterns.trevonix.com/about#disclaimer.
