Aex Brain
ReferenceAPI

Create a session

Create a conversation using an admitted agent loop. In this example, replace the component id with the id returned by uploading your loop to POST /v1/agentloops, and replace the model API key. Loop configuration depends on the chosen package; the empty object suits the reference loop.

POST/v1/sessions

Authorization

serverToken
AuthorizationBearer <token>

The server's BRAIN_API_TOKEN, sent as Authorization: Bearer . Required for application API calls when configured; optional only on a loopback server started without a token.

In: header

Header Parameters

Idempotency-Key*string
Length1 <= length <= 256

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/sessions" \  -H "Idempotency-Key: string" \  -H "Authorization: Bearer YOUR_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "agentloop": {      "configuration": {},      "environment": "brain",      "implementation": {        "entrypoint": "turn",        "id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",        "type": "brain_component"      }    },    "environments": [      {        "configuration": {},        "driver": "brain",        "lifecycle": "automatic",        "name": "brain"      }    ],    "model": {      "api_key": "YOUR_MODEL_API_KEY",      "name": "gpt-4.1-mini",      "provider": "openai"    },    "tools": []  }'
{  "last_sequence": 0,  "session_id": "string",  "status": "creating"}