Create an Agentic Network
Orchestrate multiple agents to work together as a cohesive unit by building a Agent Network.
In this guide, you will build a network where a Supervisor agent manages two worker agents to fetch stock news and send SMS notifications.
💡 Core Concepts
Before writing the YAML, it is helpful to visualize how these agents interact.
1. The Architecture
In a agent network, one agent acts as the Supervisor (the brain), and other agents act as Workers (the hands).
- Supervisor: Receives the user's request, breaks it down, and delegates tasks.
- Workers: Execute specific tasks (e.g., searching news, sending SMS) and report back to the Supervisor.
2. The "Edges" (Wiring)
Edges define the communication flow.
- Incoming Edge: Who can talk to this agent?
- Outgoing Edge: Who can this agent talk to?
- Start Signal: The Supervisor must have
"Start"in itsincoming_edgeto initiate the workflow.
⚙️ Configuration Steps
Follow these steps to build the Stock News Network from scratch.
Initialize the Network Skeleton
Define the top-level key create_agent_network and establish the identities of your agents.
create_agent_network:
agent-1:
agent_name: "Stock_news_searcher"
agent-2:
agent_name: "sms_sender"
agent-3:
agent_name: "my_supervisor"
Role: "supervisor" # Crucial: Marks this agent as the orchestrator
Configure the "Brains" (LLM)
Every agent needs an LLM configuration to reason and make decisions. You can use different models for different agents, but we will use a consistent config here.
LLM_config:
params:
model: "gpt-5-mini"
max_tokens: 1000
request_timeout: 600
Pro Tip: You might assign a smarter, more expensive model (like gpt-5) to the Supervisor for complex reasoning, and smaller models to workers for simple tasks.
Equip the Workers (Tools)
Give your worker agents the specific tools they need to do their jobs.
- News Searcher: Needs
YahooFinanceNewsTool. - SMS Sender: Needs
Twilio_sms.
# Inside agent-1 (Searcher)
tools:
tool_assigned:
- name: "YahooFinanceNewsTool"
# Inside agent-2 (SMS Sender)
tools:
tool_assigned:
- name: "Twilio_sms"
config:
to: "+1234567890" # Replace with recipient
from: "+1987654321" # Replace with Twilio number
YahooFinanceNewsTool is currently unavailable. Alternatively, you can use Tavily.
Define Responsibilities (Prompts)
Use the agent_function to tell each agent exactly what it should do.
- Supervisor: "Your function is to coordinate the agents defined in outgoing edges (
Stock_news_searcher,sms_sender) to answer the user request. Stock_news_searcher for searching the latest news and sms_sender for sending the SMS messages." - Searcher: "Your function is to search the web or the internet for the latest news about given companies and the stock market, including all relevant news articles and official filings."
- Sender: "Your function is to send SMS messages to the user with the given message."
Be explicit in the Supervisor's function about how it should use the workers.
Wire the Connections (Edges)
This is the most critical step. You must define the flow of control.
- Supervisor: Needs
incoming_edge: ["Start"]to begin in this scenario. It needsoutgoing_edgeto both workers. - Workers: Need
incoming_edgefrom the Supervisor andoutgoing_edgeback to the Supervisor.
The user instructs the Supervisor agent, which is why it is connected to the Start node. The Supervisor must interact with the workers to get the job done.
Each worker only needs to take input from the Supervisor and respond back to the Supervisor.
# Inside agent-3 (Supervisor)
incoming_edge:
- "Start"
- "Stock_news_searcher" # To receive results back
- "sms_sender"
outgoing_edge:
- "Stock_news_searcher" # To delegate tasks
- "sms_sender"
📚 Practical Recipes
Recipe: Stock News & SMS Network
Use Case: A supervisor coordinates a stock research agent to find stock news and a comms agent to text the summary to a user.
create_agent_network:
agent-1:
agent_name: "Stock_news_searcher"
LLM_config:
params:
model: "gpt-5-mini"
max_tokens: 1000
request_timeout: 600
tools:
tool_assigned:
- name: "YahooFinanceNewsTool"
agent_function:
- "Your function is to search the web or the internet for the latest news about given companies and the stock market, including all relevant news articles and official filings."
incoming_edge:
- "my_supervisor"
outgoing_edge:
- "my_supervisor"
agent-2:
agent_name: "sms_sender"
LLM_config:
params:
model: "gpt-5-mini"
max_tokens: 1000
request_timeout: 600
tools:
tool_assigned:
- name: "Twilio_sms"
config:
to: "<recipient_phone_number>"
from: "<twilio_phone_number>"
agent_function:
- "Your function is to send SMS messages to the user with the given message."
incoming_edge:
- "my_supervisor"
outgoing_edge:
- "my_supervisor"
agent-3:
agent_name: "my_supervisor"
Role: "supervisor"
LLM_config:
params:
model: "gpt-5-mini"
max_tokens: 1000
request_timeout: 600
agent_function:
- "Your function is to coordinate the agents defined in outgoing edges (`Stock_news_searcher`, `sms_sender`) to answer the user request."
incoming_edge:
- "Start"
- "Stock_news_searcher"
- "sms_sender"
outgoing_edge:
- "Stock_news_searcher"
- "sms_sender"
🚑 Troubleshooting
-
Workflow never starts
- Check if the Supervisor agent (
Role: supervisor) includes"Start"in itsincoming_edgelist.
- Check if the Supervisor agent (
-
Supervisor doesn't call workers
- Verify the
outgoing_edgelist in the Supervisor matches the exactagent_nameof the workers. - Ensure the Supervisor's
agent_functionclearly describes when to use the workers.
- Verify the
-
"Tool not found" error
- Ensure the tool names in
tool_assignedmatch the exact system names (e.g.,Twilio_sms, notTwilioSMS).
- Ensure the tool names in