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": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
}
{
"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'"
}
}
}
Session Management
Deactivate Agent
End the active session for an agent and return a summary.
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": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
}
{
"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. If the session was authenticated via thememanto_session_token cookie, this call also clears that cookie.
Authentication
string
required
Session token from Activate Agent. Must match
agent_id.string
Bearer <key> — this endpoint additionally requires the management credential (or a loopback client), on top of the session token above. See Management Endpoint Authentication.string
Alternative to
Authorization: Bearer — same credential.Path Parameters
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": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
}
{
"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
- Activate Agent to start a new session
- List Agents to view updated session counters