Orchestrating Agents with Microsoft Agent Framework
This lesson describes the agents, workflows and built-in orchestrations of Microsoft Agent Framework, Microsoft's open-source framework for agents and multi-agent workflows in Python and .NET and the successor to Semantic Kernel agents and AutoGen.
Learning outcomes
After completing this lesson, you will be able to:
- Create an agent with a chat client, instructions and tools.
- Build workflows of executors connected by typed edges.
- Use the built-in orchestration builders.
- Combine deterministic rules and agents in one workflow.
Agents and tools
An Agent combines a chat client, instructions, tools and optional middleware and context providers. The agent-framework-foundry package provides FoundryChatClient, which connects to a Foundry project endpoint with a Microsoft Entra ID credential. Python functions become tools with the @tool decorator, which can also mark a tool as requiring approval.
from agent_framework import Agent, tool
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
client = FoundryChatClient(project_endpoint=PROJECT_ENDPOINT, model="gpt-5-mini", credential=AzureCliCredential())
@tool(approval_mode="always_require")
def issue_refund(order_id: str, amount: float) -> str:
'''Issue a refund for an order. Requires human approval.'''
return payments.refund(order_id, amount, idempotency_key=f"refund-{order_id}")
refunds = Agent(client=client, name="refunds", instructions="You handle refund requests.", tools=[issue_refund])Agent Framework agents
Workflows
Workflows are graphs of executors (agents or plain functions) connected by edges that carry typed messages. Edges can be conditional, fan out to several executors and fan in to an aggregator. Workflows support checkpointing, so a run can pause and resume later, and human-in-the-loop requests, which emit a request_info event and wait for a response. Workflows can also be declared in YAML. Because deterministic executors sit beside agents, a workflow can keep business rules in code and call agents only for judgement.
The following diagram shows a workflow graph with function and agent executors.

Workflow building blocks
Built-in orchestrations
The agent-framework-orchestrations package provides ready-made builders for common patterns: SequentialBuilder, ConcurrentBuilder, HandoffBuilder, GroupChatBuilder and MagenticBuilder. Each builds a workflow from a list of participants.
from agent_framework.orchestrations import SequentialBuilder, ConcurrentBuilder
writer = client.as_agent(name="writer", instructions="Draft a short product announcement.")
reviewer = client.as_agent(name="reviewer", instructions="Check the previous draft for unsupported claims and fix them.")
pipeline = SequentialBuilder(participants=[writer, reviewer], chain_only_agent_responses=True).build()
events = await pipeline.run("Announce the new 2-year warranty on all blenders.")
print(events.get_outputs()[0].text)
panel = ConcurrentBuilder(participants=[market_agent, legal_agent, tech_agent]).build() # fan-out and aggregateBy default, each agent in a sequential orchestration receives the previous agent's full conversation; chain_only_agent_responses=True passes only the previous response, which saves tokens. Tools marked as requiring approval pause the orchestration with a request that the application answers before resuming.
Choosing a builder
Mixing rules and agents
A bank's onboarding process must verify documents with a fixed rules engine, then have an agent summarize risk, then route high-risk cases to a compliance officer for approval before account creation. The process can wait days for approval.
An Agent Framework workflow fits: a function executor calls the rules engine, an agent executor summarizes risk, a conditional edge routes high-risk cases to a human-in-the-loop request, and checkpointing persists the state while waiting. A single agent with all steps in its instructions would not guarantee the rules check or survive a multi-day wait.
How does Microsoft Agent Framework pause a tool call for human approval?
Show answer
The tool is declared with approval_mode="always_require", and the workflow waits for the approval before running it.
Exam Tips
Remember for the exam
- Agent Framework: agents, typed workflows, checkpointing, human-in-the-loop, built-in orchestrations.
- @tool(approval_mode="always_require") pauses for approval.
- Keep deterministic rules in function executors beside agents.