Stream Run Logs (WebSocket)
Stream a run’s live app.log over a WebSocket as the job progresses — the same log the dashboard’s run view shows.
This is not a normal HTTP request: connect with a WebSocket client, not curl. It is documented here as GET because OpenAPI has no way to declare a wss:// operation. Replace the https:// in the server URL with wss://.
Building the URL. Do not assemble the path by hand — a run reports it as logs_url, on the launch response (POST /rt/redteam, /rt/eval, /rt/playground) and on GET /rt/runs/{run_id}. That value is relative; join it onto wss://api.enkryptai.com/wss/redteam/v1/logs/tasks/ and append ?apikey=<your key>. The v1 in that prefix is the gateway route’s own name, not a version of the Red Team API; v2 is an identical alias.
Authentication. The key goes in the query string, not the apikey header, because a browser cannot set headers on a WebSocket handshake. The resulting URL therefore contains your API key — do not log it or share it.
What you receive. One text frame per log line, already formatted (<timestamp> - <LEVEL> - <message>). Lines already produced are replayed first, so connecting part-way through still gives you the run from the beginning; the server then tails, and closes the socket once the run reaches a terminal state. Retention is limited, so a long-finished run may replay from its stored app.log instead.
Ownership. The first path segment is the run’s owner and must match the account your API key belongs to; another account’s run is a 403. A run started with an organization key is owned by the organization.
GET, so it cannot be exercised over HTTP — the playground
is suppressed rather than offered and left to fail. Dial it with wss:// from a WebSocket
client, or use stream_logs() in the Python SDK, which resolves the URL from a run id and
hands you the lines.It is documented as a GET only because OpenAPI has no way to declare a wss://
operation.Authorizations
API key passed as a query parameter instead of a header. Used only by the log-streaming WebSocket, because the browser WebSocket API cannot set request headers on the handshake. Treat the resulting URL as a secret.
Path Parameters
The run's owner id, as reported in user_metadata.user_id. Must match the account the API key belongs to.
The prefixed run id, e.g. rt-<uuid> or eval-<uuid>. A bare uuid opens a socket that never emits anything.
The target model's folder segment: the part of model_name after the last /, with _<model_version> appended when a version is set. unknown for runs with no target, such as eval.
Query Parameters
Your API key. In the query string because a WebSocket handshake cannot carry headers.
Response
Switching Protocols - the socket is open and log lines follow as text frames.

