shield-halvedAgent Lifecycle

Manage the agent lifecycle — suspend agents temporarily, revoke them permanently, and understand the kill switch behavior.

circle-info

When to use: When you need to disable an agent that is misbehaving, compromised, or no longer needed.

chevron-rightPrerequisiteshashtag

5-Line Core

# Suspend (reversible)
await gateway.suspend_agent("agent:doc-reviewer", organization_id="default")

# Revoke (permanent kill switch)
await gateway.revoke_agent("agent:doc-reviewer", organization_id="default")

Agent Status

Status
Can Delegate?
Can Reactivate?
Existing Tokens Valid?

ACTIVE

Yes

N/A

Yes

SUSPENDED

No

Yes (provider-level)

Yes (until expiry)

REVOKED

No

No (permanent)

Yes (until expiry)

circle-exclamation

Step-by-Step

1

Suspend an Agent

Suspension is reversible — use it when an agent needs temporary restriction:

2

Attempt Delegation to Suspended Agent

Delegating to a suspended agent fails immediately:

3

Reactivate an Agent

Reactivation is done at the provider level, not through the gateway:

circle-info

Reactivation is intentionally not on the IAMGateway to require explicit provider-level access. This prevents accidental reactivation through the standard API.

4

Revoke an Agent (Permanent)

Revocation is the kill switch — permanent and irreversible:

After revocation:

  • No new delegations can be created

  • The agent cannot be reactivated

  • The revoked_at timestamp is recorded

5

List Agents

List agents in an organization, optionally including revoked ones:

circle-check

Kill Switch Behavior

When you suspect an agent is compromised:

  1. Suspend immediately — blocks all new delegations

  2. Investigate — check audit logs, review delegation chains

  3. Revoke if confirmed — permanent kill switch

circle-exclamation

Complete Example

Create agent_lifecycle.py:

Run it:

Expected output:

Common Pitfalls

Pitfall
Solution

Revoking when suspend is enough

Revocation is permanent. Use suspend_agent first to investigate.

Existing tokens still valid

Tokens are stateless JWTs. Use short expires_in_seconds as a best practice.

Reactivate is provider-only

reactivate_agent is on the provider, not the gateway. This is by design.

Missing organization_id

Pass organization_id to scope operations to the correct organization.

Revoking affects all chains

All delegation chains involving the revoked agent will fail on new delegations.

Next Steps


circle-info

Found an issue on this page? Report it on our feedback formarrow-up-right.

Last updated

Was this helpful?