Implementation:Microsoft Agent framework DeepResearch Workflow Definition
| Knowledge Sources | |
|---|---|
| Domains | Multi_Agent_Orchestration, Declarative_Workflows, Deep_Research |
| Last Updated | 2026-02-11 17:00 GMT |
Overview
Sample declarative YAML workflow implementing the Magentic orchestration pattern to coordinate multiple specialized agents for deep research tasks.
Description
The DeepResearch.yaml workflow defines a complex multi-agent orchestration that addresses user requests through coordinated agent collaboration. It uses seven specialized agents organized into two tiers:
Coordination agents:
- ResearchAgent: Analyzes the current task and correlates relevant facts
- PlannerAgent: Devises an overall plan based on facts and team capabilities
- ManagerAgent: Evaluates progress via a "progress ledger" and delegates tasks
- SummaryAgent: Generates the final response when the request is satisfied
Capability agents:
- KnowledgeAgent: Performs generic web searches
- CoderAgent: Writes and executes Python code
- WeatherAgent: Provides weather information
The workflow implements a loop with stall detection: if the ManagerAgent determines progress has stalled or the system is in a loop, it re-analyzes facts and re-plans. After exceeding a stall threshold, it restarts entirely. After exceeding a restart threshold, it terminates gracefully.
Usage
Use this workflow definition as a reference pattern when building complex multi-agent orchestrations that require iterative planning, fact-gathering, and dynamic task delegation with failure recovery.
Code Reference
Source Location
- Repository: Microsoft_Agent_framework
- File: workflow-samples/DeepResearch.yaml
- Lines: 1-379
Signature
kind: Workflow
trigger:
kind: OnConversationStart
id: workflow_demo
actions:
# 1. Initialize available agents list
- kind: SetVariable
variable: Local.AvailableAgents
value: =[{name: "WeatherAgent", ...}, {name: "CoderAgent", ...}, {name: "KnowledgeAgent", ...}]
# 2. Gather facts via ResearchAgent
- kind: InvokeAzureAgent
agent:
name: ResearchAgent
# 3. Create plan via PlannerAgent
- kind: InvokeAzureAgent
agent:
name: PlannerAgent
# 4. Main loop: ManagerAgent evaluates progress ledger
- kind: InvokeAzureAgent
agent:
name: ManagerAgent
output:
responseObject: Local.ProgressLedger
# 5. Conditional branching: done / stalling / delegate
- kind: ConditionGroup
conditions:
- condition: =Local.ProgressLedger.is_request_satisfied.answer
- condition: =Local.ProgressLedger.is_in_loop.answer || Not(Local.ProgressLedger.is_progress_being_made.answer)
# 6. Delegate to next agent and loop back
- kind: GotoAction
actionId: question_o3BQkf
Import
from agent_framework_declarative import AgentFactory
# Load the DeepResearch workflow from YAML
factory = AgentFactory(...)
agent = await factory.create_agent_from_yaml("workflow-samples/DeepResearch.yaml")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| System.LastMessage.Text | string | Yes | The user's research query that triggers the workflow |
| Agent definitions | Azure agents | Yes | ResearchAgent, PlannerAgent, ManagerAgent, SummaryAgent, WeatherAgent, CoderAgent, KnowledgeAgent must be configured |
Outputs
| Name | Type | Description |
|---|---|---|
| Final response | ChatMessage | Generated by SummaryAgent after ManagerAgent determines request is satisfied |
| Progress activities | SendActivity | Intermediate status updates sent during research (fact analysis, plan creation, agent delegation) |
Usage Examples
Running the DeepResearch Workflow
from agent_framework_declarative import AgentFactory
from agent_framework_core import Agent
# Set up the factory with required agents
factory = AgentFactory(
client=azure_client,
tools=[],
)
# Load and run the workflow
agent = await factory.create_agent_from_yaml("workflow-samples/DeepResearch.yaml")
async with agent:
response = await agent.run("What are the latest advances in quantum computing?")
async for event in response:
print(event)