Think about what happens when you ask one person at a company to do everything. Imagine asking the same employee to write your backend C# code, design your marketing graphics, review your tax filings, and negotiate your office lease. Even if they try their best, they will get overwhelmed, mix up priorities, and make mistakes.
The exact same thing happens when you try to build one giant "super-agent" in Microsoft Foundry. When you stuff 40 pages of instructions and 25 different tools into a single prompt, the agent loses focus, forgets rules, and burns through your token budget.
The solution is teamwork. Instead of building one massive agent, you build small, focused specialist agents and connect them together using three tools in Microsoft Foundry: Connected Agents, the Microsoft Agent Framework (@workflow), and the Agent-to-Agent (A2A) protocol.
Three Ways Agents Work Together in Microsoft Foundry
Depending on how much control you need over the handoffs, you can pick from three teamwork patterns:
1. Supervisor & Sub-Agents (Connected Agents)
[ Triage Manager Agent ]
|---> Calls [ Billing Specialist Agent ]
+---> Calls [ Technical Support Agent ]
2. Step-by-Step Code Graph (Microsoft Agent Framework @workflow)
[ Step 1: Parse Order ] --> [ Step 2: Fraud Check ] --> [ Step 3: Fulfill ]
3. Cross-Team / Cross-Cloud (Agent-to-Agent / A2A v1.0)
[ Your Foundry Agent ] <=== HTTPS / A2A Protocol ===> [ Partner Company Agent ]
- Connected Agents (Manager and Specialists): You create a main Prompt Agent that acts like a project manager. You attach other Foundry agents to it as tools. When a customer asks a billing question, the manager delegates the question to the Billing Agent, gets the answer back, and replies to the customer.
- Deterministic Workflows (Microsoft Agent Framework): When you need strict rules (for example, Step A must always finish before Step B starts, with zero guessing by the language model), you write a workflow graph in C# or Python using
WorkflowBuilder or the @workflow decorator.
- Agent-to-Agent Protocol (A2A v1.0 GA): What if one agent lives in your Microsoft Foundry project, and another agent was built by a different department on a completely different cloud? A2A is an open standard that lets agents discover each other's capabilities and pass tasks securely over HTTPS.
Pattern 1: Delegating Work with Connected Agents
Let's start with the simplest approach. Suppose you already created a specialist agent named refund-policy-checker. You can hand that specialist over to a main front-desk agent in just a few lines of code.
C# (.NET) Example: Connecting a Specialist Agent to a Manager Agent
using System;
using Azure.Identity;
using Azure.AI.Projects;
using Azure.AI.Projects.Agents;
var projectEndpoint = "https://your-resource.services.ai.azure.com/api/projects/your-project";
AIProjectClient projectClient = new(new Uri(projectEndpoint), new DefaultAzureCredential());
// 1. Create the specialist agent first
var refundSpecialist = new DeclarativeAgentDefinition("gpt-5-mini")
{
Instructions = "You check if an order qualifies for a refund. Orders under 30 days qualify."
};
projectClient.AgentAdministrationClient.CreateAgentVersion(
"refund-specialist",
options: new(refundSpecialist));
// 2. Wrap the specialist as a Connected Agent Tool
var connectedRefundTool = new ConnectedAgentToolDefinition(
agentName: "refund-specialist",
description: "Call this specialist whenever a user asks about refunds or returns.");
// 3. Create the front-desk manager agent and give it the specialist tool
var frontDeskManager = new DeclarativeAgentDefinition("gpt-5-mini")
{
Instructions = "You are the main customer support desk. Delegate refund questions to your specialist.",
Tools = { connectedRefundTool }
};
ProjectsAgentVersion manager = projectClient.AgentAdministrationClient.CreateAgentVersion(
"front-desk-manager",
options: new(frontDeskManager));
Console.WriteLine($"Manager Agent Ready: {manager.Name} (v{manager.Version})");
Pattern 2: Building a Strict Code Pipeline with the Agent Framework
Sometimes you cannot afford to let a language model decide which step runs next. For example, in an automated code review pipeline, you always want the security scanner to run first, the style checker to run second, and a human approval gate to run third if a security issue is found.
The Microsoft Agent Framework lets you wire agents and regular Python or C# functions into a strict step-by-step graph.
Python Example: Multi-Step Workflow with Conditional Routing
import asyncio
from typing import Literal
from agent_framework import WorkflowBuilder, step
@step
async def classify_request(user_message: str) -> str:
# Fast check to route the request
if "refund" in user_message.lower() or "charge" in user_message.lower():
return f"BILLING::{user_message}"
return f"TECH::{user_message}"
@step
async def handle_billing(routed_message: str) -> str:
clean_msg = routed_message.replace("BILLING::", "")
return f"[Billing Specialist] Checked ledger for: '{clean_msg}'. Refund approved."
@step
async def handle_tech_support(routed_message: str) -> str:
clean_msg = routed_message.replace("TECH::", "")
return f"[Tech Specialist] Generated diagnostic steps for: '{clean_msg}'."
async def main() -> None:
# Build a predictable graph connecting the steps
builder = WorkflowBuilder(start_executor=classify_request)
builder.add_switch_case_edge_group(
source=classify_request,
cases=[
(lambda msg: msg.startswith("BILLING::"), handle_billing),
(lambda msg: msg.startswith("TECH::"), handle_tech_support),
],
)
workflow = builder.build()
result = await workflow.run("I saw a double charge on my invoice yesterday.")
print(result)
if __name__ == "__main__":
asyncio.run(main())
Choosing the Right Multi-Agent Pattern
Before you write any orchestration code, use this simple checklist to pick the right tool for your team:
| Orchestration Pattern |
Who Decides the Next Step? |
Best Used When... |
| Connected Agents |
The Supervisor LLM |
You have open-ended chat where users jump between topics (billing, tech support, sales). |
| Agent Framework Workflows |
Your C# or Python Code |
You have a strict business process that must follow exact rules and order of operations every time. |
| Agent-to-Agent (A2A) |
Remote Agent Contract |
Your Foundry agent needs to talk to an external agent owned by another team or hosted outside Azure. |
Practical Rule of Thumb: Always start with a single agent and a clean Toolbox. Only split into multiple agents when your instructions start conflicting with each other or when different tasks require completely different security permissions.
Join the conversation! Your thoughts help the community grow.