Create session

POST/v1/sessions
Creates a new agent session in the given environment (or the organization's default when omitted). Picked repositories are validated against the organization's repository catalog before being attached.

Authorization

header

Authorization: Bearer <token>

An access token from Settings → Access tokens, with the scopes this call needs. Authentication

Request body

application/json · required
idstring | null
Optional client-generated TypeID (asess_…). Lets callers navigate and sync to the new session before the server round-trip completes; the underlying UUIDv7 keeps the id space time-ordered so cursor pagination on id DESC stays consistent. Format-validated at the boundary so a rogue string can't become a session PK.
namestring
Human-readable display name. If omitted, a random fun name is generated.
Length
at most 255
modelobject
browserIdstring | null
Optional browser identity selected before the first turn. Must be readable in the session organization. Omitted or null keeps inherited/default browser resolution.
environmentIdstring | null
Environment to run the session in. Validated to exist; when omitted, the organization's default environment is used.
repositoriesarray<SessionRepositoryPick>
Repositories selected in the composer (0..n, each a catalog repository in the organization). The agent loads context for these and provisioning refreshes their working trees. When omitted, defaults to the resolved environment's repositories; an explicitly empty list attaches none.
Items
at most 20
eventsarray<object | TextSubmitted | Stopped | ...>
Optional harness events seeded into the new session (typically a MessagesSubmitted to start the first turn). Carried on the actor create call and processed when the actor boots, before it serves any read; a failing event is logged and skipped actor-side (later events still apply) and never fails creation.
Items
1 to 20
visibilitystring | null
Read audience of the new session. When omitted, inherits the originating session audience for spawned sessions; otherwise defaults to organization.
Value in
"private" | "organization"

Responses

An agent sessionapplication/json

idstringrequired
Unique session identifier
organizationIdstringrequired
Organization this session belongs to
teamIdstring | nullrequired
Team this session belongs to
createdBystring | null
statusstringrequired
Runtime status of the session. provisioning means setup is in flight, idle means no turn is running, working means a turn is in flight, and failed means provisioning failed terminally. Lifecycle (archive/restore) is signaled by archivedAt, not status.
Value in
"pending" | "idle" | "running" | "failed"
typestringrequired
Immutable session kind assigned at creation.
Value in
"default" | "review" | "memory" | "agent" | "assistant" | "background"
statusDetailSessionStatusDetail | null
Who or what unblocks an idle session (user, session or event; absent when nothing is awaited), an open-text kind refining it (question, plan-review, approval, reply, done, error, ...), and a short user-facing label. error marks a recoverable root-turn failure while the coarse runtime status remains idle; failed is reserved for terminal runtime failure. Readers must tolerate unknown kinds: the closed waitingOn bucket alone decides attention treatment.
archivedAtstring | nullrequired
When the session was archived, or null if not archived
machineIdstring | null
Explicitly borrowed machine, when attached to an existing workspace. Null does not mean the session has no machine: owned, forked and inherited machines are resolved separately. Read GET /v1/sessions/{id}/machine/info for caller-visible stored effective machine metadata, not live guest liveness.
forkedFromobject | null
projectIdstring | null
TypeID with prefix "proj_".
environmentIdstring | null
TypeID with prefix "env_".
parentSessionIdstring | null
TypeID with prefix "asess_".
namestringrequired
Human-readable display name for the session
isMineOrSharedboolean
Whether the current viewer created this session or is in its collaborator roster. Browsing classification only, not an access grant.
visibilitystring
Value in
"private" | "organization"
createdAtstringrequired
updatedAtstringrequired
lastRepliedAtstring | null
lastUsedAtstringrequired
lastActivityAtstring | null
tagIdsarray<string>
Ids of the tags applied to this item, in ascending id order. Resolve names and colors from the organization's tag list (GET /v1/tags).
pullRequestIdsarray<string>
collaboratorsarray<SessionItemCollaborator>
repositoriesarray<SessionItemRepository>
slackChannelsarray<SessionItemSlackChannel>
machineSessionItemMachine | null