Skip to main content
Call this endpoint at the start of every agent task or run. The session JWT you receive scopes all events, traces, and logs produced during that task back to a single identifiable session. Pass the returned token in the X-OTAS-AGENT-SESSION-TOKEN header on every subsequent OTAS call made within that run.
Authentication for this endpoint uses the agent’s API key (X-OTAS-AGENT-KEY), not a user token. The key must be active and unexpired.

Endpoint

Base URL: http://localhost:8000

Request headers

string
required
The agent’s API key in the format agent_<prefix>_<secret>. Obtained when creating the agent or rotating its key.

Request body

object
Optional JSON object with task context. Use it to attach structured metadata to the session for filtering and debugging, e.g. { "task": "summarize", "input_length": 512 }. Defaults to {}.

Response

number
1 on success.
string
"agent_session_created" on success.
object
Create a new session for every distinct task or process. Never reuse a session JWT across separate, independent runs — doing so conflates their events under a single session, making attribution and debugging unreliable.
Do not share a session JWT between parallel agent instances. Each concurrent run must start its own session so that events are attributed correctly.

Example

cURL
Response (200)
After receiving the token, attach it to all subsequent OTAS calls for this run:
Subsequent call example