The Planning Pattern enables AI agents to decompose complex tasks into manageable subtasks that can be executed sequentially or in parallel. This pattern uses structured output schemas (typically Pydantic models) to ensure machine-readable task decomposition and agent assignment. The planning agent analyzes user requests, identifies required capabilities, and generates execution plans that route subtasks to specialized agents.
For information about tool invocation within planned tasks, see Tool Use Pattern. For multi-agent coordination after planning, see Multi-Agent Patterns.
Sources: 07-planning-design/README.md1-23 07-planning-design/README.md34-47
Planning begins with a clearly defined goal. Most real-world tasks are too complex for a single step, so an AI agent must decompose a concise objective into smaller, goal-oriented subtasks 07-planning-design/README.md24-36 This decomposition transforms ambiguous user requests into actionable steps.
Task Decomposition Example: For a "Generate a 3-day travel itinerary" goal, the agent might decompose it into:
Each subtask can then be tackled by dedicated agents specialized in those specific domains 07-planning-design/README.md37-44
Natural Language to Code Entity Space: Task Decomposition
Sources: 07-planning-design/README.md24-47
LLMs can generate structured output (e.g., JSON) that is easier for downstream agents or services to parse. This is critical in a multi-agent context to action tasks after the planning phase 07-planning-design/README.md48-51
Data Model Architecture:
Sources: 07-planning-design/README.md65-83 07-planning-design/README.md129-147
The schema defines the structure and validation rules for planning output. The AgentEnum constrains agent assignments to known capabilities, preventing invalid routing.
Sources: 07-planning-design/README.md65-83 07-planning-design/README.md129-147
The planning agent's system prompt acts as a "registry" of specialized agents. It provides descriptions of available agents so the LLM can decide which to assign to specific subtasks 07-planning-design/README.md87-100
Key Prompt Elements:
FlightBooking, HotelBooking) and their specializations.Sources: 07-planning-design/README.md87-100 07-planning-design/README.md163-170
In a typical implementation using the Microsoft Agent Framework, a Planner agent receives the user message and generates the structured plan.
Code-to-Execution Flow
Sources: 07-planning-design/README.md112-120 07-planning-design/README.md152-157
The AzureAIProjectAgentProvider is used to create the agent infrastructure 07-planning-design/README.md84 The response is generated by passing the user_message and system_prompt to the model client, followed by parsing the output_text into the Pydantic model 07-planning-design/README.md102-107
Sources: 07-planning-design/README.md84-107
Once the TravelPlan is received, the system must route the plan to the respective agents 07-planning-design/README.md118
| Field | Purpose |
|---|---|
main_task | The overall objective for context. |
subtasks | A list of specific actions to be taken. |
assigned_agent | The specific code entity/agent responsible for that subtask. |
task_details | The specific instructions for the assigned agent. |
Routing Scenarios:
GroupChatManager 07-planning-design/README.md118Sources: 07-planning-design/README.md112-120 07-planning-design/README.md138-147
Planning is often an iterative process. An agentic system evaluates subtask outcomes, measures performance, and iterates on actions to improve the final output 07-planning-design/README.md22
Sources: 07-planning-design/README.md17-22 09-metacognition/README.md84-89
Refresh this wiki