mosoodocs

Threads and Runs

How Mosoo maps a published Agent call to Thread and Run lifecycle state.

Mosoo exposes a published Agent through Thread-based APIs. Your application creates or reuses a Thread, then sends user events that queue Runs. Mosoo executes each Run inside the published Agent configuration and writes public events back to the Thread.

Resource model

ConceptMeaning
Agent API EndpointThe published Agent entry point from the Agent API Access panel. agentId is a bare ULID in v1.
ThreadThe conversation container created through the API. Store thread.id in your application.
RunOne execution pass of the Agent on a Thread. A create-thread input or user message can queue a Run.
EventA public timeline entry for input, Agent output, tool state, files, usage, and Run lifecycle changes.

Resource IDs in v1 are bare ULIDs. Do not add prefixes such as agent_, thread_, file_, or run_.

Create and retrieve

Create a Thread for a published Agent:

POST /api/v1/agents/{agentId}/threads

If input is present, Mosoo queues the initial Run. If input is omitted, Mosoo creates an empty IDLE Thread with no Run.

Retrieve current Thread state:

GET /api/v1/threads/{threadId}

The response includes thread, the latest run when one exists, and convenience links.

Thread status

StatusMeaning
IDLENo active Run. A user message can queue work.
RUNNINGA Run is executing.
RESCHEDULINGThe Thread is between Runs.
TERMINATEDThe Thread has ended.

Run status

StatusMeaning
queuedRun exists but has not started.
bootingRuntime is preparing.
runningRun is executing.
waiting_inputRun is blocked on caller input, often a permission decision.
completedTerminal success. finalOutput.text is stable when present.
failedTerminal failure. Inspect run.error.
cancelledTerminal cancellation.
expiredTerminal timeout or expiry.

Lifecycle operations

Use lifecycle endpoints to keep your app-side Thread list clean:

OperationEndpoint
List Threads for an AgentGET /api/v1/agents/{agentId}/threads
Archive a ThreadPOST /api/v1/threads/{threadId}/archive
Unarchive a ThreadPOST /api/v1/threads/{threadId}/unarchive
Delete a ThreadDELETE /api/v1/threads/{threadId}

Archive hides a Thread from default active lists. Delete permanently deletes the Thread and its backing AgentSession.

On this page