Direct Addressing vs Broadcasting
You'll learn how to choose between sending messages to specific agents or broadcasting to multiple agents at once in multi-agent systems.
When agents need to communicate, you have two fundamental approaches: direct addressing (one-to-one) and broadcasting (one-to-many).
Direct Addressing
Direct addressing means sending a message to a specific agent by name or ID. Think of it like sending a text message to one person in your contacts. You know exactly who should receive and respond to your message.
When to use:
- You need a specific agent's expertise (e.g., only the SQL agent should execute a database query)
- The task requires coordination between two known agents
- You want to avoid unnecessary processing by irrelevant agents
- You need guaranteed delivery to one recipient
Example scenario: A coordinator agent asks the "EmailAgent" to send a notification after the "PaymentAgent" confirms a transaction.
Broadcasting
Broadcasting sends the same message to multiple agents simultaneously, often without specifying individual recipients. Like announcing something in a meeting room—everyone hears it, and those interested can respond.
When to use:
- Multiple agents might handle the request (first-come-first-served)
- You want all agents to update their state with new information
- Discovery: you don't know which agent can help
- Event notifications that multiple agents should observe
Example scenario: Broadcasting "UserLoggedIn" lets the analytics agent log it, the recommendation agent refresh preferences, and the notification agent check for alerts—all independently.
Key Takeaway:
Use direct addressing when you know exactly which agent should act; use broadcasting when multiple agents need awareness or when you're discovering who can help. Choose based on specificity, efficiency, and coordination needs.