๐Ÿค–
Mac Playbook
โฑ 30 min

Multi-Agent Chatbot

Build a multi-agent system with LangGraph + local Ollama

Replaces DGX Spark: Multi-Agent Chatbot
agentslangchain

Basic idea

Multi-agent systems divide complex tasks among specialized AI agents that communicate through a shared message state. Instead of asking one LLM to do everything (research AND write AND critique), you route work to agents with focused system prompts. LangGraph models this as a directed graph where nodes are Python functions that call an LLM, and edges define the control flow between them. The graph's state โ€” a list of messages โ€” is passed through each node and updated. On Mac, all agents share the same local Ollama model via LangChain's Ollama integration, so no cloud API or API key is required.

What you'll accomplish

A working multi-agent pipeline where a researcher agent gathers information and a writer agent synthesizes it into structured output, orchestrated by LangGraph's state machine. You will also build a conditional routing example that branches based on agent output, demonstrating how to create more sophisticated agentic workflows.

What to know before starting

State machine: โ€” A system that transitions between named states based on defined conditions. LangGraph manages a message list as state; each agent node appends to it, and edges determine which node runs next.
MessagesState: โ€” LangGraph's built-in state type. It holds a list of messages (HumanMessage, AIMessage, SystemMessage) that grows as agents respond. Each node receives the full history and returns a message to append.
Nodes vs edges: โ€” Nodes are Python functions that take state and return a state update. Edges are directed connections between nodes. Conditional edges inspect the state and choose which node to route to next โ€” this is where branching logic lives.
StateGraph lifecycle: โ€” You define nodes, add edges, set an entry point, set a finish point, then call `compile()`. The compiled graph is an invokable object. `invoke()` runs synchronously; `stream()` yields step-by-step output for debugging.
Why temperature=0: โ€” LLM outputs for routing decisions (e.g., should we search or write?) must be deterministic. Setting `temperature=0` makes the model pick the highest-probability token at each step, reducing randomness in control-flow decisions.

Prerequisites

โ€ข Ollama installed and running (`ollama serve` in a background terminal)
โ€ข `qwen2.5:7b` or larger pulled (`ollama pull qwen2.5:7b`)
โ€ข Python 3.10+

Time & risk

Duration:: 30 minutes
Risk level:: Low โ€” pure Python, all models run locally
Rollback:: `pip uninstall langgraph langchain-ollama langchain-core`