Contents

Agentic Ai

Architecture Patterns

View as:

Code Labs - 02: Architecture Patterns

Seven multi-agent coordination patterns, each implemented in all four frameworks using the same mock task. Builds directly on 01 - Agent Types.

Back to Overview: Agentic AI · Back to Concepts: Architectural Patterns


Pattern Overview

Sequential          Parallel            Hierarchical
A → B → C           A ─┬─ B             Orchestrator
(pipeline)            └─ C               ├── SubAgent-1
                        ↓                └── SubAgent-2
                      Aggregate               ↓
                                        SubAgent-3

Orchestrator-       Pipeline            Adversarial         Reflexion
Subagent            (data-flow)         Debate              (self-critique)
Planner             Stage1→Stage2       Proposer            Agent
  ├── Worker-1      (no shared state)   vs Critic           ↓ critique
  └── Worker-2                          → Judge             ↓ revise
                                                            ↓ done?

Pattern Reference Table

#PatternKey ConceptWhen to UseNotes Link
01SequentialA→B→C pipeline, output feeds nextLinear multi-step workflowsArchitectural Patterns
02ParallelFan-out + aggregateIndependent subtasks, reduce latencyArchitectural Patterns
03HierarchicalNested orchestration tiersComplex delegation, team-of-teamsArchitectural Patterns
04Orchestrator-SubagentPlanner + specialized workersDynamic task decompositionArchitectural Patterns
05PipelineData-flow, no shared stateETL-style transformation chainsArchitectural Patterns
06Adversarial DebateProposer vs Critic vs JudgeHigh-stakes decisions, quality gatesArchitectural Patterns
07ReflexionSelf-critique + iterative revisionOutput quality, agentic planningDesign Patterns

Files by Pattern and Framework

Each pattern lives in 06-Agentic-AI/CodeLabs/02-Architectures/<pattern-name>/<Framework>/:

PatternLangChainLangGraphCrewAIADK
Sequentialsequential.py + .ipynbsamesamesame
Parallelparallel.py + .ipynbsamesamesame
Hierarchicalhierarchical.py + .ipynbsamesamesame
Orchestrator-Subagentorchestrator.py + .ipynbsamesamesame
Pipelinepipeline.py + .ipynbsamesamesame
Adversarial-Debatedebate.py + .ipynbsamesamesame
Reflexionreflexion.py + .ipynbsamesamesame

28 total implementations - every pattern × every framework.


  1. Sequential - start here; simplest pattern, clear A→B→C structure
  2. Parallel - fan-out to multiple agents, then aggregate results
  3. Orchestrator-Subagent - dynamic planning; the most commonly used pattern in production
  4. Hierarchical - nested orchestration; builds on Orchestrator-Subagent
  5. Pipeline - data-flow style; useful for ETL and document processing
  6. Adversarial-Debate - quality through disagreement; challenging but powerful
  7. Reflexion - self-improvement loop; combines with most other patterns

Pattern Selection Guide

RequirementRecommended Pattern
Fixed sequence of stepsSequential or Pipeline
Reduce wall-clock timeParallel
Dynamic task decompositionOrchestrator-Subagent
Multiple teams/layersHierarchical
High-quality output requiredAdversarial-Debate or Reflexion
Iterative refinementReflexion

Getting Started

# Start with Sequential in LangGraph (most readable)
jupyter notebook 06-Agentic-AI/CodeLabs/02-Architectures/01-Sequential/LangGraph/sequential.ipynb

# Then compare the same pattern in CrewAI
jupyter notebook 06-Agentic-AI/CodeLabs/02-Architectures/01-Sequential/CrewAI/sequential.ipynb

What to Read Alongside


Next: Agentic Systems

After mastering individual patterns, see how they combine in 03 - Agentic Systems - full end-to-end production system designs.