# Interface IOrchestrator

Unified orchestrator interface.

This interface provides a canonical path for all orchestration in the system, regardless of the underlying strategy.

#### Example

    const orchestrator: IOrchestrator = factory.create('orchestrator');

    const result = await orchestrator.execute(
      { type: 'task', task: myTask },
      { timeout: 30000 }
    );

    if (result.ok) {
      console.log('Output:', result.value.output);
    }

interface IOrchestrator {
id: string;
type: OrchestratorType;
execute(
definition: OrchestratorDefinition,
inputs: Record<string, unknown>,
options?: OrchestratorExecuteOptions,
): Promise<Result<OrchestratorResult, OrchestratorError>>;
getStatus(executionId: string): ExecutionStatus;
cancel(
executionId: string,
reason?: string,
): Promise<Result<void, OrchestratorError>>;
registerAgent?(agent: IAgent): void;
unregisterAgent?(agentId: string): void;
listAgents?(): { id: string; role: AgentRole }[];
getHistory?(limit?: number): OrchestratorResult[];
}

#### Implemented by

- WorkflowOrchestratorAdapter

- Defined in packages/nexus-agents/src/core/types/orchestrator.ts:149

##### Index

### Properties

id
type

### Methods

execute
getStatus
cancel
registerAgent?
unregisterAgent?
listAgents?
getHistory?

## Properties

### `Readonly` id

id: string

Unique orchestrator instance ID

- Defined in packages/nexus-agents/src/core/types/orchestrator.ts:151

### `Readonly` type

type: OrchestratorType

Orchestrator type

- Defined in packages/nexus-agents/src/core/types/orchestrator.ts:154

## Methods

### execute

- execute(
  definition: OrchestratorDefinition,
  inputs: Record<string, unknown>,
  options?: OrchestratorExecuteOptions,
  ): Promise<Result<OrchestratorResult, OrchestratorError>>

  Execute an orchestration.

  #### Parameters

  - definition: OrchestratorDefinition

    What to orchestrate (task, workflow, or policy)

  - inputs: Record<string, unknown>

    Input values for the orchestration

  - `Optional` options: OrchestratorExecuteOptions

    Execution options (timeout, budget, callbacks)

  #### Returns Promise<Result<OrchestratorResult, OrchestratorError>>

  Result with OrchestratorResult or OrchestratorError

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:164

### getStatus

- getStatus(executionId: string): ExecutionStatus

  Get status of an execution.

  #### Parameters

  - executionId: string

    Execution ID to check

  #### Returns ExecutionStatus

  Current execution status

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:176

### cancel

- cancel(
  executionId: string,
  reason?: string,
  ): Promise<Result<void, OrchestratorError>>

  Cancel a running execution.

  #### Parameters

  - executionId: string

    Execution ID to cancel

  - `Optional` reason: string

    Optional cancellation reason

  #### Returns Promise<Result<void, OrchestratorError>>

  Result with void or OrchestratorError

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:185

### `Optional` registerAgent

- registerAgent?(agent: IAgent): void

  Register an agent with this orchestrator. Optional - not all orchestrators manage agent pools.

  #### Parameters

  - agent: IAgent

    Agent to register

  #### Returns void

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:193

### `Optional` unregisterAgent

- unregisterAgent?(agentId: string): void

  Unregister an agent. Optional - not all orchestrators manage agent pools.

  #### Parameters

  - agentId: string

    Agent ID to unregister

  #### Returns void

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:201

### `Optional` listAgents

- listAgents?(): { id: string; role: AgentRole }[]

  List registered agents. Optional - not all orchestrators manage agent pools.

  #### Returns { id: string; role: AgentRole }[]

  Array of registered agent IDs and roles

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:209

### `Optional` getHistory

- getHistory?(limit?: number): OrchestratorResult[]

  Get execution history. Optional - for orchestrators that track history.

  #### Parameters

  - `Optional` limit: number

    Maximum number of executions to return

  #### Returns OrchestratorResult[]

  Array of past execution results

  - Defined in packages/nexus-agents/src/core/types/orchestrator.ts:218