Skip to main content
POST
/
api
/
v2
/
agents
/
{agent_id}
/
deactivate
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/deactivate" \
  -H "X-Session-Token: your_session_token"
{
  "session_id": "9f733fdb-ebf2-494e-8eb6-fb3320d6020d",
  "agent_id": "my-agent",
  "started_at": "2026-05-09T02:40:00.313078Z",
  "ended_at": "2026-05-09T03:15:00.000000Z",
  "duration_hours": 0.58,
  "memories_created": 3,
  "summary_memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
{
  "detail": "Missing session token. Use X-Session-Token header."
}
{
  "detail": {
    "error": "InvalidSessionToken",
    "message": "Invalid session token: Not enough segments",
    "details": {}
  }
}
{
  "detail": {
    "error": "SessionNotFound",
    "message": "Session for agent 'my-agent' not found",
    "details": {}
  }
}
{
  "detail": {
    "error": "InternalServerError",
    "message": "An unexpected error occurred",
    "details": {
      "original_error": "Session is for agent 'other-agent', cannot access 'my-agent'"
    }
  }
}

Overview

Terminates the current session for the specified agent and returns a summary including the start/end time, total duration, and number of memories stored during the session.

Authentication

API clients do not send an API key or Authorization header.
X-Session-Token
string
required
Session token from Activate Agent. Must match agent_id.

Path Parameters

agent_id
string
required
The unique identifier of the agent whose session should be ended.
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/deactivate" \
  -H "X-Session-Token: your_session_token"
{
  "session_id": "9f733fdb-ebf2-494e-8eb6-fb3320d6020d",
  "agent_id": "my-agent",
  "started_at": "2026-05-09T02:40:00.313078Z",
  "ended_at": "2026-05-09T03:15:00.000000Z",
  "duration_hours": 0.58,
  "memories_created": 3,
  "summary_memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
{
  "detail": "Missing session token. Use X-Session-Token header."
}
{
  "detail": {
    "error": "InvalidSessionToken",
    "message": "Invalid session token: Not enough segments",
    "details": {}
  }
}
{
  "detail": {
    "error": "SessionNotFound",
    "message": "Session for agent 'my-agent' not found",
    "details": {}
  }
}
{
  "detail": {
    "error": "InternalServerError",
    "message": "An unexpected error occurred",
    "details": {
      "original_error": "Session is for agent 'other-agent', cannot access 'my-agent'"
    }
  }
}

Next Steps