Class: RunManager
Defined in: packages/orchestration/src/run/run-manager.ts:18
Manages the lifecycle of agent execution runs. This is the critical integration point where agent.process() is called and streaming events are captured to Supabase for live UI.
Constructors
Constructor
new RunManager(
runStore,ticketStore,registry,events,costs):RunManager
Defined in: packages/orchestration/src/run/run-manager.ts:21
Parameters
runStore
ticketStore
registry
events
EventBus<OrchestrationEventMap>
costs
Returns
RunManager
Methods
cancel()
cancel(
runId):Promise<void>
Defined in: packages/orchestration/src/run/run-manager.ts:277
Cancel a running run
Parameters
runId
string
Returns
Promise<void>
getActive()
getActive():
Map<string,ActiveRun>
Defined in: packages/orchestration/src/run/run-manager.ts:284
Get all active runs
Returns
Map<string, ActiveRun>
getActiveCount()
getActiveCount():
number
Defined in: packages/orchestration/src/run/run-manager.ts:289
Get active run count
Returns
number
resumeRun()
resumeRun(
runId,answer):Promise<Run>
Defined in: packages/orchestration/src/run/run-manager.ts:305
Resume a paused run with an answer to the agent's question.
Creates a new run for the same ticket, restoring the agent's conversation history from the paused run's serialized state. The answer is passed as the new input, and the agent sees its full previous conversation context.
Parameters
runId
string
The paused run's ID
answer
string
The answer to the agent's question
Returns
Promise<Run>
The new run (completed or paused again)
spawn()
spawn(
ticket,agentName):Promise<Run>
Defined in: packages/orchestration/src/run/run-manager.ts:40
Spawn a run: create run record, call agent.process(), stream events to store.
This is the critical path for live streaming:
- Creates a Run record in Supabase
- Updates ticket status to in_progress
- Calls agent.process() with onToken callback that persists every event
- Each event is emitted on EventBus for server-side listeners
- Uses AbortController signal for pause/cancel
- On completion, updates run and ticket status
Parameters
ticket
agentName
string
Returns
Promise<Run>