{"id":"AGT-042","title":"Agents on people's own machines: coding assistants and other local agents","maturity":"documented","collection":"Agent identity","category":"Credentials","complexity":"Medium","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.","summary":"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.","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)"],"tags":["local agent","coding agent","coding assistant","desktop agent","public client","PKCE","device flow","personal access token","PAT","keychain","MCP local server","stdio","CIMD","endpoint discovery","developer workstation","DPoP"],"roles":["IAM architect","Identity engineer","Security leader","Platform engineering","AI engineering"],"industries":["Cross-industry","Financial services","Healthcare","Retail","Public sector"],"builds_on":["AGT-014","AGT-015"],"related":["AGT-012","AGT-033","AGT-045"],"authors":"Trevonix Innovation","reviewers":"Trevonix IAM architecture","version":"1.0","last_reviewed":"2026-11-25","published":"2026-11-25","og_image":"og-agt-042.png","sections":{"summary":[{"type":"bullets","content":"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.\nReplace **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**.\nMark 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":[{"type":"paragraph","content":"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.\n\nThis 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_when":[{"type":"bullets","content":"People use coding assistants, terminal agents or desktop agents that call company systems.\nLocal MCP servers connect agents to repositories, databases, ticketing or cloud consoles.\nDevelopers hold long-lived personal access tokens or cloud keys on their machines."}],"avoid_when":[{"type":"bullets","content":"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":[{"type":"bullets","content":"**Developer speed against control.** A token in a file is the fastest way to get an agent working.\n**Person's authority against agent attribution.** Local agents act inside the person's session, so their work looks like the person's.\n**Public clients cannot keep secrets.** Anything shipped to a laptop can be read; security must come from PKCE, short lifetimes and device binding.\n**Local servers against supply chain.** Installing an MCP server is installing code that runs with the person's rights."}],"solution":[{"type":"paragraph","content":"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."},{"type":"image","content":"A local agent signs the person in with PKCE, keeps short-lived tokens in the OS store and reaches only approved tools.","title":"Solution overview","media":"agt-042-solution.png","alt":"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"},{"type":"table","content":"Risk | Control\nPersonal access token with broad scopes in a file | Short-lived, narrowly scoped tokens from sign-in; tokens in the OS credential store\nCloud access keys in a profile | Single sign-on to the cloud with short sessions; no static keys on laptops\nMalicious or compromised local MCP server | Approved server list, consent before a server runs, servers pinned to versions\nAgent runs commands with the person's full rights | Allow-lists for commands and paths; approval for destructive commands; separate workspace\nAgent changes indistinguishable from the person's | Commit trailers or co-author lines; separate agent identity for unattended runs\nNobody knows which agents are installed | Endpoint and browser discovery; register or block","title":"Risks and controls"},{"type":"numbered","content":"**Choose approved agents and MCP servers** and publish the list with installation guidance.\n**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.\n**Use the system browser for sign-in** (device flow for headless terminals) and store tokens in the OS credential store.\n**Replace standing secrets:** retire personal access tokens with repository-wide scopes and static cloud keys; issue short-lived tokens per task or session.\n**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.\n**Gate local MCP servers:** approved list, consent before first run, version pinning, and no servers that hold their own long-lived secrets.\n**Attribute agent work:** commit trailers or co-author lines, and a separate agent identity for scheduled or CI runs.\n**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.","title":"How it works"},{"type":"tip","content":"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.","title":"Make the secure path the easy one"}],"design_rules":[{"type":"numbered","content":"**Local agents are public clients; nothing shipped to a laptop is a secret.**\n**No personal access tokens or static cloud keys for agents.**\n**Tokens live in the OS credential store, are short-lived and narrowly scoped.**\n**Local MCP servers are approved, pinned and consented to.**\n**Unattended runs use their own agent identity.**\n**Agent work is marked as the agent's.**\n**Discovery covers endpoints, not only the cloud.**"}],"anti_patterns":[{"type":"table","content":"Anti-pattern | What goes wrong\nPersonal access token with all repository scopes in an environment file | One malicious instruction exfiltrates access to every repository\nShared client secret embedded in a desktop agent | Anyone can extract it and impersonate the agent\nInstalling any MCP server from a public registry | Unvetted code runs with the person's rights and secrets\nUsing the person's token for nightly or CI runs | Work continues after the person leaves; actions look like theirs\nBlocking local agents outright | People use them anyway, unmanaged"}],"benefits":[{"type":"bullets","content":"Far fewer long-lived secrets on laptops.\nStolen tokens expire quickly and reach little.\nLocal agents and MCP servers are known, approved and revocable.\nAgent changes can be told apart from people's."}],"costs":[{"type":"bullets","content":"Client registration and sign-in support for each agent product.\nMigration away from personal access tokens and static cloud keys.\nEndpoint and browser discovery tooling.\nSome agent products support only tokens in files; they need wrappers or replacement."}],"tests":[{"type":"table","content":"Test | Expected result\nSearch developer machines (sample) for personal access tokens and cloud keys | None used by agents\nAgent signs in | System browser with PKCE; tokens appear in the OS credential store\nToken copied to another machine (with DPoP where supported) | Rejected, or expires within the agreed lifetime\nInstall an unapproved local MCP server | Discovered and flagged; consent prompt shown before it runs\nCommit made by the agent | Carries the agent trailer\nDevice reported lost | Agent tokens revoked"}],"maturity_notes":[{"type":"paragraph","content":"**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."}],"faq":[{"type":"faq","content":"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.","title":"Can a local agent keep a client secret?"},{"type":"faq","content":"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.","title":"Should a coding agent use the developer's identity?"}],"references":[{"type":"bullets","content":"[RFC 8252: OAuth 2.0 for Native Apps](https://www.rfc-editor.org/rfc/rfc8252)\n[Model Context Protocol: authorization (2025-11-25)](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization)\n[Auth0: MCP November 2025 specification update](https://auth0.com/blog/mcp-november-2025-specification-update/)\n[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)\n[Microsoft Learn: What's new in Microsoft Entra Agent ID](https://learn.microsoft.com/en-us/entra/agent-id/whats-new-agent-id)\n[RFC 9449: OAuth 2.0 Demonstrating Proof of Possession (DPoP)](https://www.rfc-editor.org/rfc/rfc9449)"}]},"recipes":{"ping":{"status":"documented","product_name":"PingOne native application with PKCE and PingGateway","summary":"Pre-registered public clients with PKCE; PingGateway in front of MCP servers.","last_verified":"2026-11","blocks":[{"type":"numbered","content":"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.\nPre-register each client: PingOne does not support dynamic client registration; Advanced Identity Cloud supports client ID metadata documents.\nFront MCP servers with PingGateway so local agents present Ping tokens rather than server-specific secrets.","title":"Configure"}]},"okta":{"status":"documented","product_name":"Okta for AI Agents with client ID only or CIMD registration","summary":"Public-client registration for local agents, narrow resource connections and endpoint discovery. Written from Okta documentation.","last_verified":"2026-11","blocks":[{"type":"numbered","content":"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.\nLink the agent to the user-facing app so it can act only while the person is signed in.\nAdd resource connections with the narrowest scopes for each repository, API or MCP server.\nUse ISPM endpoint discovery to find local agents and MCP servers on managed devices.","title":"Configure"}]},"entra":{"status":"documented","product_name":"Microsoft Entra local agent authentication (preview) and MSAL public clients","summary":"Public-client sign-in for local agents; on-behalf-of from a backend where needed. Written from Microsoft documentation.","last_verified":"2026-11","blocks":[{"type":"numbered","content":"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.\nOtherwise, 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.\nApply Conditional Access requiring compliant devices for sessions that local agents use.","title":"Configure"},{"type":"bullets","content":"Agent identities were confidential clients only before the local-agent preview; check current support before designing around a public-client agent identity.","title":"Gotchas"}]},"saviynt":{"status":"documented","product_name":"Saviynt discovery and governance of local agents","summary":"Inventory, owners and certifications; no token issuance.","last_verified":"2026-11","blocks":[{"type":"paragraph","content":"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."}]},"misc":{"status":"documented","product_name":"Source platform and cloud short-lived tokens","summary":"Replace personal access tokens and static cloud keys before rolling out coding agents.","last_verified":"2026-11","blocks":[{"type":"paragraph","content":"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."}]}},"slug":"agt-042-agents-on-people-s-own-machines-coding-assistants-and-other-local-agents","updated_at":"2026-12-02T09:48:47.417Z","url":"https://patterns.trevonix.com/patterns/agt-042-agents-on-people-s-own-machines-coding-assistants-and-other-local-agents","markdown_url":"https://patterns.trevonix.com/patterns/agt-042-agents-on-people-s-own-machines-coding-assistants-and-other-local-agents.md","publisher":"Trevonix","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"}}