Multi-Agent Patterns in Plain Python: Pipeline, Router, Loop
Build a pipeline and a router in plain Python with a local model, then test the four lines that guard a supervisor loop, using a scripted stand-in.
Video #12 ยท AI agents and MCP
Steps in the video
Files
- agents.py (32 lines)
- guard.py (12 lines)
- pipeline.py (8 lines)
- router.py (14 lines)
Tested with
Python 3.12.15 | ollama==0.6.3, pydantic==2.14.1
What this does not show
Wiring only: simple tasks on one small local model, nothing measured at scale. The supervisor loop is a scripted stand-in with no model call, so the guards are tested against a planned bad decision, not a real model failure. The pattern advice comes from agency and vendor pages.
Sources
- https://pypi.org/project/ollama/0.6.3/
- https://pypi.org/project/pydantic/2.14.1/
- https://www.anthropic.com/engineering/building-effective-agents
- https://www.dataiku.com/blog/agent-orchestration-explained
- https://www.groovyweb.co/blog/multi-agent-orchestration-patterns-supervisor-router-pipeline-swarm-2026
- https://www.metacto.com/blogs/ai-agent-orchestration-patterns
Learning IT by Example.