# Interface IInteractionObserver

Interface for the SwarmObserver.

interface IInteractionObserver {
recordEvent(event: AgentEvent): void;
recordInteraction(options: RecordInteractionOptions): void;
getCollaborationGraph(): InteractionGraph;
getBottlenecks(): BottleneckInfo[];
getEmergentClusters(): AgentCluster[];
attributeSuccess(taskId: string): Map<string, ContributionScore>;
getHealthMetrics(): SwarmHealthMetrics;
getEventsByTrace(traceId: string): AgentEvent[];
getEventsByAgent(agentId: string): AgentEvent[];
clear(): void;
}

#### Implemented by

- InteractionSwarmObserver

- Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:198

##### Index

### Methods

recordEvent
recordInteraction
getCollaborationGraph
getBottlenecks
getEmergentClusters
attributeSuccess
getHealthMetrics
getEventsByTrace
getEventsByAgent
clear

## Methods

### recordEvent

- recordEvent(event: AgentEvent): void

  Record an agent event.

  #### Parameters

  - event: AgentEvent

  #### Returns void

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:202

### recordInteraction

- recordInteraction(options: RecordInteractionOptions): void

  Record an interaction between two agents.

  #### Parameters

  - options: RecordInteractionOptions

  #### Returns void

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

### getCollaborationGraph

- getCollaborationGraph(): InteractionGraph

  Get the collaboration graph.

  #### Returns InteractionGraph

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:212

### getBottlenecks

- getBottlenecks(): BottleneckInfo[]

  Identify bottleneck agents.

  #### Returns BottleneckInfo[]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:217

### getEmergentClusters

- getEmergentClusters(): AgentCluster[]

  Detect emergent clusters of collaborating agents.

  #### Returns AgentCluster[]

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

### attributeSuccess

- attributeSuccess(taskId: string): Map<string, ContributionScore>

  Attribute success of a task to contributing agents.

  #### Parameters

  - taskId: string

  #### Returns Map<string, ContributionScore>

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:227

### getHealthMetrics

- getHealthMetrics(): SwarmHealthMetrics

  Get swarm health metrics.

  #### Returns SwarmHealthMetrics

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:232

### getEventsByTrace

- getEventsByTrace(traceId: string): AgentEvent[]

  Get events for a specific trace.

  #### Parameters

  - traceId: string

  #### Returns AgentEvent[]

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

### getEventsByAgent

- getEventsByAgent(agentId: string): AgentEvent[]

  Get events for a specific agent.

  #### Parameters

  - agentId: string

  #### Returns AgentEvent[]

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:242

### clear

- clear(): void

  Clear all recorded data.

  #### Returns void

  - Defined in packages/nexus-agents/src/observability/swarm-observer-types.ts:247