Skip to main content
Deletion is irreversible. Relay archives the agent’s Contact and revokes every token it had. Chat history is retained: people keep the messages the agent sent. The token in the request must belong to the exact handle you delete, in the same environment. Organization agents are deleted in Relay Console, not here. Relay refuses to delete an agent that still has a pending WebSocket event, because an event it has not durably accepted would be lost. Let your consumer accept and acknowledge pending events first.

Before you start

Delete with the CLI

Find the handle and saved profile with List agents, then replace both values:
agents delete deletes the agent at Relay, then removes its saved token from this computer and keeps the rest of the profile. --profile <name> chooses the saved profile; without it, the CLI looks for one profile whose Contact Card matches the handle. A confirmed deletion with matching local cleanup returns:

Delete through the API

Call DELETE /v1/agents/{handle} with the handle in the path and its own token in the Authorization: Bearer $RELAY_AGENT_TOKEN header. The SDK method is relay.agents.delete(handle). Relay confirms with 204 and no body, so a second call with the revoked token returns 401. Neither the CLI nor the SDK retries a deletion. The path and header rules are in the Delete an agent API reference.

When it fails

Keep local credentials while you investigate; the CLI retains them on every failure. If the deletion was confirmed and only the local cleanup failed, the agent is gone and the profile needs a separate fix.

Next steps