Building LLM-Enabled Multi Agent Applications from Scratch
Building LLM-Enabled Multi Agent Applications from Scratch
Official code repository for Designing Multi-Agent Systems: Principles, Patterns, and Implementation for AI Agents by Victor Dibia. Learn to build effective multi-agent systems from first principles through complete, tested implementations. This repository includes PicoAgents—a full-featured multi-agent framework built entirely from scratch for the sole purpose of teaching you how multi-agent systems work. Every component, from agent reasoning loops to orchestration patterns, is implemented with clarity and transparency.
Buy Digital Edition | Paperback on Amazon | Hardcover on Amazon
As the AI agent space evolves rapidly, clear patterns are emerging for building effective multi-agent systems. This book focuses on identifying these patterns and providing practical guidance for applying them effectively.
What makes this approach unique:
The book is organized across 4 parts, taking you from theory to production:
| Chapter | Title | Code | Learning Outcome |
|---|---|---|---|
| Ch 1 | Understanding Multi-Agent Systems | Poet/critic example, references yc_analysis/ |
Understand when multi-agent systems are needed |
| Ch 2 | Multi-Agent Patterns | - | Master coordination strategies (workflows vs autonomous) |
| Ch 3 | UX Design Principles for Multi-Agent Systems | - | Principles for building intuitive agent interfaces |
| Chapter | Title | Code | Learning Outcome |
|---|---|---|---|
| Ch 4 | Building Your First Agent | agents/_agent.py, basic-agent.py, memory.py, middleware.py, structured-output.py, agent_as_tool.py, otel/, memory/, tools/approval_example.py |
|
| Build agents with tools, memory, streaming, middleware, observability, and human-in-the-loop | |||
| Ch 5 | Computer Use Agents | agents/_computer_use/, computer_use.py |
Build browser automation agents with multimodal reasoning |
| Ch 6 | Building Multi-Agent Workflows | workflow/, workflows/ |
Build type-safe workflows with streaming observability |
| Ch 7 | Autonomous Multi-Agent Orchestration | orchestration/, round-robin.py, ai-driven.py, plan-based.py |
Implement GroupChat, LLM-driven, and plan-based orchestration (Magentic One patterns) |
| Ch 8 | Building Modern Agent UX Applications | app/ (minimal FastAPI+SSE example), webui/ (production React UI) |
Build interactive agent applications with web UI, auto-discovery, and real-time streaming |
| Ch 9 | Multi-Agent Frameworks | frameworks/ (Microsoft Agent Framework, Google ADK, LangGraph comparisons) |
Evaluate and choose the right multi-agent framework |
| Chapter | Title | Code | Learning Outcome |
|---|---|---|---|
| Ch 10 | Evaluating Multi-Agent Systems | eval/, agent-evaluation.py |
Build evaluation frameworks with LLM-as-judge and metrics |
| Chapter | Title | Code | Learning Outcome |
|---|---|---|---|
| Ch 14 | Business Questions from Unstructured Data | yc_analysis/ |
Production case study: Analyze 5,000+ companies with cost optimization and checkpointing |
| Ch 17 | Software Engineering Agent | swe_agent/ |
Build a complete software engineering agent with coding tools and workspace management |
Click Colab badges in the chapter tables above to run examples in your browser. No installation required.
Pre-configured development environment in your browser. Once open:
export OPENAI_API_KEY='your-key'python examples/agents/basic-agent.pypicoagents uiFree tier: 60 hours/month
…In this book, we will cover the fundamentals of building multi-agent systems, and incrementally build up the Agents abstractions shown below:
from picoagents import Agent, OpenAIChatCompletionClient
def get_weather(location: str) -> str:
"""Get current weather for a given location."""
return f"The weather in {location} is sunny, 75°F"
# Create an agent
agent = Agent(
name="assistant",
instructions="You are helpful. Use tools when appropriate.",
model_client=OpenAIChatCompletionClient(model="gpt-4.1-mini"),
tools=[get_weather]
)
# Use the agent
response = await agent.run("What's the weather in Paris?")
print(response.messages[-1].content)**Want a simpl
No open issues yet, or sync has not completed.