Networks are defined using the createNetwork function.

import { createNetwork, openai } from '@inngest/agent-kit';

// Create a network with two agents
const network = createNetwork({
  agents: [searchAgent, summaryAgent],
  defaultModel: openai({ model: 'gpt-4o', step }),
  maxIter: 10,
});

Options

agents
array<Agent>
required

Agents that can be called from within the Network.

defaultModel
string

The provider model to use for routing inference calls.

system
string
required

The system prompt, as a string or function. Functions let you change prompts based off of state and memory

tools
array<TypedTool>

Defined tools that an agent can call.

Tools are created via createTypedTool.