Skip to main content

Class: AgentOSOrchestrator

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:291

Description​

The AgentOSOrchestrator is responsible for unifying the request handling pipeline for AgentOS. It bridges the high-level AgentOSInput from the public API to the internal GMI processing logic. It ensures that user requests are routed to the correct GMI, manages the GMI's turn lifecycle, and handles the complex dance of tool calls and streaming responses.

Constructors​

Constructor​

new AgentOSOrchestrator(): AgentOSOrchestrator

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:311

Returns​

AgentOSOrchestrator

Methods​

broadcastWorkflowUpdate()​

broadcastWorkflowUpdate(update): Promise<void>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:463

Parameters​

update​

WorkflowProgressUpdate

Returns​

Promise<void>


getStreamIdentity()​

getStreamIdentity(streamId): { conversationId: string; personaId: string; sessionId: string; userId: string; } | null

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:510

Who a live stream belongs to, for the guardrails that judge its continuation; null once the stream has ended.

Parameters​

streamId​

string

Returns​

{ conversationId: string; personaId: string; sessionId: string; userId: string; } | null


initialize()​

initialize(config, dependencies): Promise<void>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:324

Async

Initializes the AgentOSOrchestrator with its configuration and dependencies. This method must be called successfully before orchestrating any turns.

Parameters​

config​

AgentOSOrchestratorConfig

Configuration settings for the orchestrator.

dependencies​

AgentOSOrchestratorDependencies

Required services.

Returns​

Promise<void>

A Promise that resolves when initialization is complete.

Throws​

If any critical dependency is missing or config is invalid.


orchestrateResumedToolResults()​

orchestrateResumedToolResults(pendingRequest, toolResults, options?): Promise<string>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:596

Parameters​

pendingRequest​

AgentOSPendingExternalToolRequest

toolResults​

AgentOSToolResultInput[]

options?​

AgentOSResumeExternalToolRequestOptions = {}

Returns​

Promise<string>


orchestrateToolResult()​

orchestrateToolResult(agentOSStreamId, toolCallId, toolName, toolOutput, isSuccess, errorMessage?): Promise<void>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:1176

Handles the result of an external tool execution, feeding it back into the relevant GMI instance for continued processing. Delegates to ExternalToolResultHandler.

Parameters​

agentOSStreamId​

string

toolCallId​

string

toolName​

string

toolOutput​

any

isSuccess​

boolean

errorMessage?​

string

Returns​

Promise<void>


orchestrateToolResults()​

orchestrateToolResults(agentOSStreamId, toolResults): Promise<void>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:1194

Handles one or more external tool results in batch. Delegates to ExternalToolResultHandler.

Parameters​

agentOSStreamId​

string

toolResults​

AgentOSToolResultInput[]

Returns​

Promise<void>


orchestrateTurn()​

orchestrateTurn(input): Promise<string>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:527

Async

Orchestrates a full logical turn for a user request. This involves managing GMI interaction, tool calls, and streaming responses. Instead of directly yielding, it uses the StreamingManager to push chunks.

Parameters​

input​

AgentOSInput

The comprehensive input for the current turn.

Returns​

Promise<string>

The ID of the stream to which responses will be pushed.

Throws​

If critical initialization or setup fails.


shutdown()​

shutdown(): Promise<void>

Defined in: packages/agentos/src/api/runtime/AgentOSOrchestrator.ts:1214

Async

Shuts down the AgentOSOrchestrator. Currently, this mainly involves clearing active stream contexts. Dependencies like GMIManager are assumed to be shut down by AgentOS.

Returns​

Promise<void>

A promise that resolves when shutdown is complete.