Skip to main content

Class: AgentOSOrchestrator

Defined in: packages/agentos/src/api/AgentOSOrchestrator.ts:228

AgentOSOrchestrator

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/AgentOSOrchestrator.ts:241

Returns

AgentOSOrchestrator

Methods

broadcastWorkflowUpdate()

broadcastWorkflowUpdate(update): Promise<void>

Defined in: packages/agentos/src/api/AgentOSOrchestrator.ts:422

Parameters

update

WorkflowProgressUpdate

Returns

Promise<void>


initialize()

initialize(config, dependencies): Promise<void>

Defined in: packages/agentos/src/api/AgentOSOrchestrator.ts:254

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.

Async

Throws

If any critical dependency is missing or config is invalid.


orchestrateToolResult()

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

Defined in: packages/agentos/src/api/AgentOSOrchestrator.ts:1169

Handles the result of an external tool execution, feeding it back into the relevant GMI instance for continued processing. Uses StreamingManager to push subsequent GMI outputs.

Parameters

agentOSStreamId

string

The orchestrator's stream ID for this interaction flow.

toolCallId

string

The ID of the tool call being responded to.

toolName

string

The name of the tool.

toolOutput

any

The output from the tool.

isSuccess

boolean

Whether the tool execution was successful.

errorMessage?

string

Error message if not successful.

Returns

Promise<void>

Async

Throws

If stream context is not found or GMI fails to handle result.


orchestrateTurn()

orchestrateTurn(input): Promise<string>

Defined in: packages/agentos/src/api/AgentOSOrchestrator.ts:501

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.

Async

Throws

If critical initialization or setup fails.


shutdown()

shutdown(): Promise<void>

Defined in: packages/agentos/src/api/AgentOSOrchestrator.ts:1525

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.

Async