Combine one or more agents into a Network.
run()
, the network runs a core loop to call one or more agents to find a suitable answer.
Create the Network of Agents
Provide the staring prompt
run()
.Core execution loop
Call the Network router
Run the Agent
Store the result
Call the the Router again ↩️
defaultModel
and composed of Agents without model will throw an error.summaryAgent
is configured to use an Anthropic model:
defaultRouter
function that will be used to determine the next Agent to run.
maxIter
setting to limit the number of iterations.
maxIter
option is useful when using a Default Routing Agent or a Hybrid Router to avoid infinite loops.A Routing Agent or Hybrid Router rely on LLM calls to make decisions, which means that they can sometimes fail to identify a final condition.maxIter
and defaultRouter
maxIter
and defaultRouter
to create a Network that will stop after a certain number of iterations or when a condition is met.
However, please note that the maxIter
option can prevent the defaultRouter
from being called (For example, if maxIter
is set to 1, the defaultRouter
will only be called once).
defaultState
setting to provide a default State.
defaultState
can be useful to persist the state in database between runs or initialize your network with external data.