Safeguard
Security Guides•

How do you offboard an AI agent identity and its credentials?

A checklist for retiring an AI agent: find its tokens, revoke and rotate, remove it from MCP configs, keep the logs and confirm nothing still works.

Safeguard Security Team
3 min read

To offboard an AI agent, name its owner, list every credential and connection it holds, revoke tokens and rotate shared secrets, remove it from tool and MCP configurations, keep its audit logs, and then test that the old identity can no longer act. OWASP ranks improper offboarding first among non-human identity risks.

Why this gets missed

When an employee leaves, HR triggers a process. When an agent is replaced or a pilot ends, nobody triggers anything. The agent stops being used, but its tokens, service accounts and server connections keep working.

OWASP puts improper offboarding at the top of its 2025 non-human identity list for that reason. A forgotten identity is an unmonitored way in.

The checklist

  1. Name the owner and the date. Record who approved retirement and when.
  2. List credentials. API keys, OAuth tokens, refresh tokens, service accounts, certificates and any secrets in a vault.
  3. List connections. Every MCP server, SaaS app, repository and database the agent could reach.
  4. Revoke. Revoke active tokens and sessions at the authorization server, not only in the agent's config.
  5. Rotate shared secrets. If any secret was shared with other systems, rotate it, then update the others.
  6. Remove from configs. Delete the agent from tool allowlists, MCP client files, CI variables and policy groups.
  7. Preserve evidence. Keep audit logs and the agent's registry entry for your retention period.
  8. Test. Try the old credentials. They should fail, and the attempt should appear in logs.
  9. Close the record. Mark the identity retired, with the date and proof of the test.

Order matters

StepWhy it comes here
Revoke before deleteDeleting config does not kill a token already issued
Rotate shared secrets after listingYou need the full list to know what else shares them
Preserve logs before cleanupCleanup scripts sometimes remove them
Test lastIt proves the earlier steps worked

Prevent the next one

Give every agent an expiry or a review date when it is created. Use short lived tokens so a missed revocation fixes itself. Keep one identity per agent, because shared accounts make step 5 painful. Review the inventory on a regular schedule and retire anything with no owner.

The MCP authorization spec also says clients must keep refresh tokens confidential and that servers should not treat refresh tokens as a resource requirement, which is a reminder that long sessions are a choice, not a default.

Safeguard includes agent identity and asset discovery to keep the inventory current, plus a free scan at https://gold.safeguard.sh/scan.

Quick check

Is deleting the agent enough?

No. Tokens already issued may keep working until they expire or are revoked at the authorization server.

How long should logs be kept?

Follow your own retention policy and any legal or contractual requirement. Keep enough history to investigate misuse of the old identity.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.