Send a command to a session
A message starts a turn, or waits in the session's queue while a turn runs or waits (protocol 17; delivery: "reject" is refused with 409 session_busy instead); the others answer what the session waits on, or cancel. Idempotent on the command's idempotencyKey.
AuthorizationBearer <token>An application key of the Tenant (PUT /v1/tenant/keys/{keyId}), or Studio's key, derived from the admin key. With Nylorun-Subject and Nylorun-Scopes, it acts for that person, narrowed to those scopes. Never accepted from a browser (Origin).
sessionId*stringNylorun-Protocol*stringThe protocol version, 18
Nylorun-Subject?stringThe person an application key acts for
Nylorun-Scopes?stringThe subject's space-separated scopes; required with a subject
traceparent?stringW3C trace context: the turn this request starts joins the caller's trace (feature traces). A malformed value is ignored
tracestate?stringW3C trace context, kept with traceparent
application/json- body
requestId*string1 <= lengthidempotencyKey*string1 <= length <= 256type*"message""message"manifest?removeTools?array<>items <= 256delivery?string"queue""reject""steer"context?array<>1 <= items <= 16content*string1 <= lengthThe command, accepted; a message may be queued
application/json- response
status*"accepted""accepted"turnId*string|nullcursor*string|nullrequestId*stringimport { createClient } from "@nylorun/agents";const client = await createClient();const session = client.session("ses_123");await session.input("Where is order demo-123?", { idempotencyKey: crypto.randomUUID(), delivery: "queue", // the default: waits for a running turn; "reject" is 409 session_busy});// Also: session.approve(), session.respond(), session.cancel(){ "status": "accepted", "turnId": "string", "cursor": "string", "requestId": "string"}List sessions GET
Acting for a person, only theirs.
Follow a session's events GET
Server-sent events, each with its type as `event` and its cursor as `id`, from the cursor on. Events are on the `nylorun.event/2` envelope, typed by `SessionEvent`; a client ignores a type it does not know. A trusted issuer's token's stream ends with `event: nylorun.closed` when the token expires. A `: keepalive` comment every 15 seconds.