Executors, edges, and events
Single-agent systems are limited to one prompt and model. Orchestration assigns distinct skills to each agent, combines their outputs, and routes control dynamically. A workflow is built from three parts.
| Component | Role |
|---|---|
| Executors | The workers — AI agents or custom logic that receive input, act, and produce output. |
| Edges | Define message flow: direct (in sequence), conditional (only when a condition holds), switch-case (route by value), fan-out (one message to many), fan-in (combine many into one). |
| Events | Observability hooks — WorkflowStarted/Output/Error, ExecutorInvoke/Complete, RequestInfo. |
One interface, five strategies
| Pattern | How it works | Use for |
|---|---|---|
| Concurrent | Broadcast the same task to many agents; aggregate results independently. | Parallel analysis, ensemble decisions. |
| Sequential | Agent A's output becomes B's input, in a fixed order. | Pipelines, progressive refinement. |
| Handoff | Control transfers between agents by rules; only one is active at a time. | Escalation, fallback, expert routing. |
| Group chat | Agents share a conversation; a chat manager chooses who speaks next. | Brainstorming, consensus, multi-perspective. |
| Magentic | A manager plans, delegates, and adapts across specialists. | Complex, open-ended problems. |
Key concept · The unified orchestration workflow
All patterns share one developer interface: define agents → select/create an orchestration pattern (add a manager if needed) → optionally configure callbacks/transforms → start a runtime → invoke with your task → retrieve results asynchronously. Because the interface is shared, you can experiment with different strategies without rewriting agent logic or learning new APIs.
Manager-driven planning
Magentic orchestration is the flexible, general-purpose pattern for complex, open-ended tasks with no predetermined solution path. A Magentic manager maintains shared context, tracks progress on a dynamic task ledger, and decides which specialist acts next — emphasizing planning over speed and producing a documented approach for human review.
Key concept · When (not) to use Magentic
Use it when the problem is open-ended, multiple specialists are needed, a documented plan aids review, and a step-by-step plan built dynamically adds value. Avoid it when the path is fixed/deterministic, no planning ledger is needed, the task is simple, or speed is the priority. Build it with the MagenticBuilder, configure round/stall limits on the standard manager, and stream results.
Chapter 14 quiz
Fifteen questions on the building blocks, the five orchestration patterns, and Magentic. Answer first, then expand Show answer.
Part A · Multiple choice
In a workflow, what are the main "workers"?
- A Edges
- B Executors (AI agents or custom logic)
- C Events
- D Content filters
Show answer
B — Executors. They receive input, act, and produce output.
Which edge type sends one message to multiple executors at once?
- A Direct edge
- B Fan-out edge
- C Fan-in edge
- D Conditional edge
Show answer
B — Fan-out. Fan-in combines many messages into one.
Which orchestration pattern broadcasts the same task to many agents in parallel?
- A Sequential
- B Concurrent
- C Handoff
- D Magentic
Show answer
B — Concurrent. Results are aggregated independently.
Which pattern transfers control between agents so only one is active at a time?
- A Handoff
- B Concurrent
- C Group chat
- D Sequential
Show answer
A — Handoff. Good for escalation, fallback, and expert routing.
In group chat orchestration, who decides which agent speaks next?
- A A chat manager
- B The user only
- C Random selection
- D The first agent
Show answer
A — a chat manager. It orchestrates turn-taking in the shared conversation.
Which pattern uses a manager that plans, delegates, and adapts on a task ledger?
- A Sequential
- B Magentic
- C Concurrent
- D Handoff
Show answer
B — Magentic. For complex, open-ended problems.
When should you AVOID Magentic orchestration?
- A When the solution path is fixed and speed matters
- B When the problem is open-ended
- C When a documented plan is needed
- D When multiple specialists are required
Show answer
A. Magentic emphasizes planning over speed; use a lightweight pattern for deterministic tasks.
Part B · True or false
All orchestration patterns share the same core developer interface.
Show answer
True. You can swap strategies without rewriting agent logic.
Conditional edges trigger only when specified conditions are met.
Show answer
True. Switch-case edges route by value; direct edges run in sequence.
Events like WorkflowStartedEvent exist for observability and debugging.
Show answer
True. Built-in events trace execution across the workflow.
Sequential orchestration passes one agent's output as the next agent's input.
Show answer
True. A fixed order for pipelines and progressive refinement.
Part C · Short answer
Name the five orchestration patterns.
Show answer
Concurrent, sequential, handoff, group chat, and Magentic.
Name the three workflow components.
Show answer
Executors, edges, and events.
Name the five edge types.
Show answer
Direct, conditional, switch-case, fan-out, and fan-in.
What does the Magentic manager maintain to track the plan?
Show answer
A dynamic task ledger — recording goals, subgoals, and execution plans, built progressively.