TL;DR: AI agents need credentials to act, but long-lived keys, shared service accounts, and user-session inheritance create overbroad access and weak auditability, according to WorkOS and GitGuardian research. The governance problem is not storage alone: identity controls built for stable, predictable software do not hold when an agent can choose tools and act at runtime.
Editorial analysis by NHI Mgmt Group, based on content published by WorkOS: “How to manage API keys, tokens, and secrets for AI agents”.
By the numbers:
- Nearly 29 million new hardcoded secrets were found in public GitHub commits in 2025, and commits made with AI coding assistance leaked at roughly double the base rate.
Key questions
Q: What breaks when AI agents keep standing credentials?
A: The access model breaks because the agent can continue acting after the human has moved on, the workflow has shifted, or the original approval is no longer relevant.
Q: Why do shared service accounts create risk for AI agents?
A: Shared service accounts hide which agent made a request, so they collapse accountability and make incident response slower.
Q: How can security teams know if agent skill controls are actually working?
A: Look for evidence that skills are inventoried, risk rated, scanned before execution, and tied to a policy manifest or approval record.
Practitioner guidance
- Audit agent-held credentials by task scope Inventory every API key, OAuth token, service account, and certificate currently reachable by an agent.
- Replace raw token storage with managed connections Keep downstream service credentials server-side and let agents request scoped access tokens at runtime instead of storing reusable secrets inside the agent.
- Enforce session expiry as the default revocation point Grant access only for the duration of an approved task session, with access checks on each tool invocation.
Bottom line: AI agent credential management fails when teams reuse persistent secrets that were built for predictable software, not runtime decision-making.
Explore further
View Full Forum → | NHI Foundation Course → | Our Services → | Read the full analysis →
Session scope is the missing control boundary for AI agents: credential lifecycle logic built for stable software does not survive runtime decision-making. An agent can query one system, act in another, and chain those actions inside a single task. The implication is that authorisation has to be tied to task execution, not just identity issuance.
A few things that frame the scale:
- DeepSeek alone generated 113,000 new exposed API keys in 2025, illustrating how new AI providers create credential exposure before security guardrails catch up, according to the State of Secrets Sprawl 2026.
A question worth separating out:
Q: What is the difference between storing secrets securely and governing them well?
A: Secure storage protects where the secret sits. Governance adds ownership, exposure history, lifecycle state, and dependency awareness so teams can decide when a secret should be rotated, revoked, or retired. In practice, the second problem is harder and more important, because it determines whether the secret is still usable by an attacker.
👉 Read our full editorial: How AI agent credential management fails without session scope