Interfaces

SwarmOptions

Interface: SwarmOptions

Defined in: src/patterns/Swarm.ts:35

Properties

agents

readonly agents: readonly SwarmAgent[]

Defined in: src/patterns/Swarm.ts:40

The fixed agent roster. Must contain >= 2 agents. The order doesn't matter — the route function selects by id.


id?

readonly optional id?: string

Defined in: src/patterns/Swarm.ts:51


maxHandoffs?

readonly optional maxHandoffs?: number

Defined in: src/patterns/Swarm.ts:49

Max hand-offs before the loop halts. Default 10.


name?

readonly optional name?: string

Defined in: src/patterns/Swarm.ts:50


route

readonly route: (input) => string | undefined

Defined in: src/patterns/Swarm.ts:47

Routing function — receives the current message and returns the selected agent's id. Pure sync; evaluated before each iteration's chosen agent runs. Return undefined or an unknown id to halt the swarm (the loop's until guard fires).

Parameters

input
message

string

Returns

string | undefined

On this page