Everstack
API ReferenceAgentsSession management

Session management

POST/v1/agents/sessions
POST/v1/agents/sessions

Your instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.

Request Body

PropertyTypeRequiredDescription
tenantIdstringNo
agentIdstringNo
metadataobjectNo

Responses

200 Create a new agent session

PropertyTypeDescription
sessionobjectAgentSession is an execution instance of an agent.

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

Request

curl -X POST "http://localhost:8089/v1/agents/sessions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tenantId":"string","agentId":"string"}'
const response = await fetch("http://localhost:8089/v1/agents/sessions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "tenantId": "string",
  "agentId": "string"
}),
});
const data = await response.json();
import requests

response = requests.post(
    "http://localhost:8089/v1/agents/sessions",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
  "tenantId": "string",
  "agentId": "string"
},
)
data = response.json()

Response

{
  "session": {
    "id": "string",
    "tenantId": "string",
    "agentId": "string",
    "status": "SESSION_STATUS_UNSPECIFIED",
    "turnCount": 0,
    "totalTokens": 0,
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z",
    "completedAt": "2024-01-01T00:00:00Z",
    "turns": [
      {
        "id": "string",
        "sessionId": "string",
        "turnNumber": 0,
        "status": "TURN_STATUS_UNSPECIFIED",
        "userInput": "string",
        "assistantOutput": "string",
        "toolCalls": "string",
        "promptTokens": 0,
        "completionTokens": 0,
        "totalTokens": 0,
        "latencyMs": "string",
        "error": "string",
        "createdAt": "2024-01-01T00:00:00Z",
        "completedAt": "2024-01-01T00:00:00Z"
      }
    ]
  }
}
{
  "code": 0,
  "message": "string",
  "details": [
    {
      "@type": "string"
    }
  ]
}