curl -X POST "http://localhost:8000/api/v2/agents/my-agent/activate"
{
"session_id": "9f733fdb-ebf2-494e-8eb6-fb3320d6020d",
"session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"agent_id": "my-agent",
"namespace": "memanto_agent_my-agent",
"started_at": "2026-05-09T02:40:00.313078Z",
"expires_at": "2026-05-09T08:40:00.313078Z",
"pattern": "support",
"status": "active"
}
{
"detail": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
}
{
"detail": {
"error": "AgentNotFound",
"message": "Agent 'my-agent' not found",
"details": {}
}
}
{
"detail": "Agent 'my-agent' already has an active session. Deactivate it first before re-activating."
}
{
"detail": {
"error": "InternalServerError",
"message": "An unexpected error occurred",
"details": {
"original_error": "..."
}
}
}
Session Management
Activate Agent
Activate an agent to start a new session and obtain a session token for memory operations.
POST
/
api
/
v2
/
agents
/
{agent_id}
/
activate
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/activate"
{
"session_id": "9f733fdb-ebf2-494e-8eb6-fb3320d6020d",
"session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"agent_id": "my-agent",
"namespace": "memanto_agent_my-agent",
"started_at": "2026-05-09T02:40:00.313078Z",
"expires_at": "2026-05-09T08:40:00.313078Z",
"pattern": "support",
"status": "active"
}
{
"detail": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
}
{
"detail": {
"error": "AgentNotFound",
"message": "Agent 'my-agent' not found",
"details": {}
}
}
{
"detail": "Agent 'my-agent' already has an active session. Deactivate it first before re-activating."
}
{
"detail": {
"error": "InternalServerError",
"message": "An unexpected error occurred",
"details": {
"original_error": "..."
}
}
}
Overview
Starts a new session for the specified agent and returns a JWT session token that authorizes subsequent memory operations (remember, recall, answer, etc.). The session is initialized with the server’s default duration (typically 6 hours) and tracked in ~/.memanto/sessions/.
The endpoint takes no request body; session duration is controlled by server configuration (SESSION_DEFAULT_DURATION_HOURS).
Activation is rejected with 409 Conflict while the agent already has a live session, so one caller cannot take over another caller’s session. To start a new session, end the current one with Deactivate Agent (using that session’s token), or wait for it to expire. An expired session does not block activation.
In addition to returning session_token in the response body, this endpoint sets an HttpOnly, SameSite=Strict cookie (memanto_session_token) so browser clients can authenticate without reading the token from JavaScript. See Cookie-Based Authentication.
Authentication
string
Bearer <key> — required unless the request originates from a loopback client. See Management Endpoint Authentication.string
Alternative to
Authorization: Bearer — same credential.Path Parameters
string
required
The unique identifier of the agent to activate.
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/activate"
{
"session_id": "9f733fdb-ebf2-494e-8eb6-fb3320d6020d",
"session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"agent_id": "my-agent",
"namespace": "memanto_agent_my-agent",
"started_at": "2026-05-09T02:40:00.313078Z",
"expires_at": "2026-05-09T08:40:00.313078Z",
"pattern": "support",
"status": "active"
}
{
"detail": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
}
{
"detail": {
"error": "AgentNotFound",
"message": "Agent 'my-agent' not found",
"details": {}
}
}
{
"detail": "Agent 'my-agent' already has an active session. Deactivate it first before re-activating."
}
{
"detail": {
"error": "InternalServerError",
"message": "An unexpected error occurred",
"details": {
"original_error": "..."
}
}
}
Next Steps
After activating an agent, store the returnedsession_token and use it in the X-Session-Token header for:
- Remember to store new memories
- Recall to search stored memories
- Generate AI Answer to synthesize a grounded response
- Get Current Session to inspect the active session