Sessions are the core resource in the Omnigent API. Each session represents a live agent conversation with its own message history, sub-agent children, file resources, terminals, and code environments. Sessions are bound to an agent spec (which determines the harness, model, and available tools) and to a runner (a Python subprocess that executes the LLM loop). You interact with a session by posting events and subscribing to its SSE stream.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/omnigent-ai/omnigent/llms.txt
Use this file to discover all available pages before exploring further.
List Sessions
GET /v1/sessions
Returns a cursor-paginated list of sessions. Only sessions with an agent binding are included — legacy conversations without an agent are excluded.
Query parameters:
Maximum sessions to return. Range: 1–1000.
Cursor — return sessions whose ID appears after this value in sort order.
Cursor — return sessions before this ID.
Filter to sessions bound to a specific agent, e.g.
"ag_abc123".Filter by bound agent name. Includes session-scoped agents sharing the name.
Sort direction.
"desc" (newest first) or "asc" (oldest first).Column to sort on.
"created_at" or "updated_at".Case-insensitive substring filter on the session title or conversation content.
When
true, includes archived sessions alongside active ones.Conversation kind:
"default" (user-initiated), "sub_agent", or "any".PaginatedList:
Create Session
POST /v1/sessions
Creates a new session. Accepts either JSON (bind to an already-registered agent by ID) or multipart/form-data (upload an agent bundle and create in one request).
JSON request body:
Identifier of a registered agent to bind, e.g.
"ag_abc123".Optional human-readable title, e.g.
"debugging auth flow".Initial guardrails labels, e.g.
{"env": "prod"}.Per-session reasoning effort hint:
"none", "low", "medium", "high", "max".Optional host to launch the runner on, e.g.
"host_a1b2c3".Absolute path on the host to use as the runner’s working directory, e.g.
"/Users/alice/projects/api".Optional git worktree options. When set the server creates a worktree for a new branch off
workspace.201 Created with the full session snapshot.
Get Session
GET /v1/sessions/{session_id}
Returns the full snapshot of a session, including committed items, status, and resource references.
Path parameter: session_id — the session/conversation identifier.
Query parameters:
When
false, skips the conversation items read and returns items: []. Useful when you load items separately via the paginated items endpoint.When
false, skips runner/host liveness checks and returns those fields as null.Session/conversation identifier, e.g.
"conv_abc123".Durable identifier of the bound agent.
Human-readable name of the bound agent.
Lifecycle status:
"idle", "running", "waiting", or "failed".Unix epoch timestamp of creation.
Optional human-readable title.
Session-scoped guardrails labels.
Runner currently bound to this session, or
null.Whether the runner has an open WebSocket tunnel, or
null when include_liveness=false.Committed conversation items in chronological order. Empty when
include_items=false.Update Session
PATCH /v1/sessions/{session_id}
Updates mutable session fields. All fields are optional — omitted fields are left unchanged.
New session title.
Bind or rebind to a registered runner. Last-write-wins.
Labels to upsert. Merges with existing labels; unmentioned keys are untouched.
Per-session reasoning effort. Use
"default" to clear back to the agent’s setting.Override the agent’s configured LLM model, e.g.
"claude-opus-4-7". Use "default" to clear.true archives (hides from the default listing); false unarchives.Delete Session
DELETE /v1/sessions/{session_id}
Deletes a session and all associated resources: tasks, runner-side environments and terminals, session files, and the conversation row. Requires owner-level access.
Query parameter: delete_branch (boolean, default false) — when true and the session has a server-created git worktree, the host also removes the worktree directory and deletes its branch.
Fork Session
POST /v1/sessions/{source_id}/fork
Deep-copies a session’s conversation items into a new session. Useful for branching a conversation to try a different approach.
Title for the forked session. Defaults to
"Fork of <source_title>".Switch the fork to a different built-in agent, e.g. to fork a Claude session into Codex.
Truncation point. When set, only history up to and including this response is copied.
201 Created with the new session snapshot.
Post Event
POST /v1/sessions/{session_id}/events
Submits an input event to a session. Dispatches on type:
type | Behaviour |
|---|---|
"message" | Persists a user message and starts or steers a turn |
"interrupt" | Cancels the active turn and publishes session.interrupted |
"approval" | Resolves an outstanding elicitation in-band |
"compact" | Triggers explicit context compaction |
Event discriminator, e.g.
"message".Type-specific payload. For
"message": {"role": "user", "content": [{"type": "input_text", "text": "Hello"}]}.Optional per-event LLM model override for the resulting turn.
202 Accepted:
"interrupt", "approval"): { "queued": false }.
List Conversation Items
GET /v1/sessions/{session_id}/items
Lists persisted conversation items with cursor-based pagination.
Maximum items to return. Range: 1–1000.
Cursor — return items after this item ID.
Sort order:
"asc" (chronological) or "desc".List Child Sessions
GET /v1/sessions/{session_id}/child_sessions
Lists sub-agent sessions spawned under this parent session.
Maximum children to return.
Forward pagination cursor.
Sort direction.
Switch Agent
POST /v1/sessions/{session_id}/switch-agent
Rebinds an existing session to a different agent harness in place. The transcript, files, comments, and workspace are kept; only the agent/harness changes.
Built-in agent to switch to, e.g.
"ag_builtin_codex". Must be a built-in agent listed by GET /v1/agents.