AgentNetwork

The AgentNetwork orchestrates agents, channels, and the event plane. Use AgentNetwork.setup() to wire everything together.

Setup

const network = AgentNetwork.setup(
  ({ mainChannel, createChannel, sink, registerAgent, spawner }) => {
    // ...
  },
);

Setup Context

mainChannel(name)

Creates and designates the main channel. Start events are published here when the network is exposed as an API. Every network should have exactly one main channel.

const main = mainChannel('main');

createChannel(name)

Creates an additional named channel. Names must be kebab-case.

const client = createChannel('client');
const analytics = createChannel('analytics');

sink

Provides sink factories:

registerAgent(agent)

Registers an agent and returns a binding builder:

An agent can subscribe to and publish to multiple channels:

spawner

Creates a spawner for dynamically creating agents at runtime (multi-tenant, on-demand):

Running the Network

See IO + Adapters.

Programmatic Run

Accessors

See Also

Last updated