# Interface IOrchestrationObserver

OrchestrationObserver interface for dependency injection.

interface IOrchestrationObserver {
start(): void;
stop(): void;
getAgentStates(): readonly ObserverTrackedAgent[];
getRoutingHistory(limit?: number): readonly ObserverRoutingDecision[];
getSessionMetrics(sessionId?: string): readonly ObserverSessionMetrics[];
getStats(): OrchestrationStats;
addEventListener(listener: OrchestrationObserverListener): void;
removeEventListener(listener: OrchestrationObserverListener): void;
recordRoutingDecision(decision: ObserverRoutingDecision): void;
recordTokenUsage(
sessionId: string,
model: "claude" | "gemini" | "codex" | "opencode",
tokens: ObserverTokenUsage,
): void;
isActive(): boolean;
}

- Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:205

##### Index

### Methods

start
stop
getAgentStates
getRoutingHistory
getSessionMetrics
getStats
addEventListener
removeEventListener
recordRoutingDecision
recordTokenUsage
isActive

## Methods

### start

- start(): void

  Start observing the event bus

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:207

### stop

- stop(): void

  Stop observing and cleanup

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:210

### getAgentStates

- getAgentStates(): readonly ObserverTrackedAgent[]

  Get current agent states

  #### Returns readonly ObserverTrackedAgent[]

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:213

### getRoutingHistory

- getRoutingHistory(limit?: number): readonly ObserverRoutingDecision[]

  Get routing decision history

  #### Parameters

  - `Optional` limit: number

  #### Returns readonly ObserverRoutingDecision[]

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:216

### getSessionMetrics

- getSessionMetrics(sessionId?: string): readonly ObserverSessionMetrics[]

  Get session metrics

  #### Parameters

  - `Optional` sessionId: string

  #### Returns readonly ObserverSessionMetrics[]

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:219

### getStats

- getStats(): OrchestrationStats

  Get aggregate orchestration statistics

  #### Returns OrchestrationStats

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:222

### addEventListener

- addEventListener(listener: OrchestrationObserverListener): void

  Add event listener for visualization

  #### Parameters

  - listener: OrchestrationObserverListener

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:225

### removeEventListener

- removeEventListener(listener: OrchestrationObserverListener): void

  Remove event listener

  #### Parameters

  - listener: OrchestrationObserverListener

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:228

### recordRoutingDecision

- recordRoutingDecision(decision: ObserverRoutingDecision): void

  Record a routing decision manually (for non-event-bus integrations)

  #### Parameters

  - decision: ObserverRoutingDecision

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:231

### recordTokenUsage

- recordTokenUsage(
  sessionId: string,
  model: "claude" | "gemini" | "codex" | "opencode",
  tokens: ObserverTokenUsage,
  ): void

  Record token usage for a session

  #### Parameters

  - sessionId: string
  - model: "claude" | "gemini" | "codex" | "opencode"
  - tokens: ObserverTokenUsage

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:234

### isActive

- isActive(): boolean

  Check if observer is active

  #### Returns boolean

  - Defined in packages/nexus-agents/src/agents/observability/orchestration-observer-types.ts:237