Operational phases
Before walking through the full workflow, it helps to understand the three phases at a high level:- Session creation — At the start of every new process, your agent calls the UASAM session endpoint to obtain a short-lived JWT. This JWT becomes its identity for the duration of the run.
- In-domain requests — For any call made within your project domain, your agent attaches the session JWT as the
X-OTAS-AGENT-SESSION-TOKENheader. The server-side OTAS middleware captures the event automatically. - Out-of-domain requests — For any external API call (outside your project domain), your agent makes the call normally, then immediately POSTs a structured event log to Brain using both the agent key and the session token.
Full integration workflow
Obtain your credentials
Your agent needs three fixed values before it can integrate with OTAS. These are set at deployment time and must not be changed or exposed during operation.
| Credential | Description |
|---|---|
PROJECT_ID | UUID of your OTAS project |
AGENT_KEY | Agent key in the format agent_<prefix>_<secret> — valid for 30 days |
PROJECT_DOMAIN | Base URL of the project your agent operates within (e.g., https://usc.edu) |
Create a session at process start
Call the UASAM session creation endpoint at the beginning of every new task or process. Never skip this step and never reuse a token from a previous run.The Store the value of
meta field accepts any JSON object. Use it to record task context such as the task name, user-facing operation, or input summary.A successful response returns a JWT you must store for the rest of the session:jwt_token. This is your X-OTAS-AGENT-SESSION-TOKEN for this session.Attach the session token to every in-domain request
For any API call made within your project domain, include the session JWT as a request header. The OTAS server-side middleware on your backend reads this header and logs the event automatically — you do not need to call Brain yourself.
Log out-of-domain requests manually
When your agent calls an API outside the project domain, it must manually POST the event to Brain immediately after the external call completes. Use both the agent key and session token as headers.Fill in all fields accurately based on the actual request and response. The
latency_ms value must reflect the real measured round-trip time — it is used directly in p50/p95/p99 analytics.Behavioral rules
These rules are mandatory for all OTAS-integrated agents. Violating any of them will result in missing or rejected events.| Rule | Requirement |
|---|---|
| Session creation | Always create a new session at the start of every new process |
| In-domain requests | Always include X-OTAS-AGENT-SESSION-TOKEN on every request within the project domain |
| Out-of-domain requests | Always log via the Brain logging endpoint immediately after the external call |
| Agent key usage | Use the agent key only in session creation and out-of-domain logging headers |
| Session token reuse | Never reuse a session token across separate processes |
Quick reference
| Item | Value |
|---|---|
| Agent key header | X-OTAS-AGENT-KEY |
| Session token header | X-OTAS-AGENT-SESSION-TOKEN |
| Session creation URL | http://localhost:8000/api/agent/v1/session/create/ |
| Out-of-domain log URL | http://localhost:8002/api/v1/backend/log/agent/ |
| Agent key format | agent_<prefix>_<secret> |
| Agent key validity | 30 days |