惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
S
SegmentFault 最新的问题
腾讯CDC
博客园 - 叶小钗
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
Jina AI
Jina AI
A
About on SuperTechFans
博客园 - 司徒正美
C
Check Point Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
小众软件
小众软件
Spread Privacy
Spread Privacy
阮一峰的网络日志
阮一峰的网络日志
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
K
Kaspersky official blog
Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
D
DataBreaches.Net
A
Arctic Wolf
I
InfoQ
量子位
IT之家
IT之家
Security Latest
Security Latest
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
Google Developers Blog
P
Proofpoint News Feed
P
Privacy International News Feed
T
Threatpost
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
G
GRAHAM CLULEY
V
Vulnerabilities – Threatpost
Martin Fowler
Martin Fowler
C
Cyber Attacks, Cyber Crime and Cyber Security
PCI Perspectives
PCI Perspectives
F
Full Disclosure

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to Build a Supervisor Agent Architecture Without Frameworks
Rafael Tedes · 2026-05-23 · via DEV Community

A few days ago, I wrote about building an agentic pipeline from scratch in pure Python. The idea was intentionally simple: receive a task, invoke tools, and generate a response.

That architecture works surprisingly well for linear workflows. But real-world AI systems become complicated much faster than most tutorials suggest.

Eventually, one agent is no longer enough. A single reasoning loop starts accumulating too many responsibilities. The prompt grows uncontrollably, tool definitions pile up, execution logic becomes tangled, and debugging turns into a nightmare. What started as a clean “AI agent” slowly becomes a monolith trying to do everything at once.

This is where the Supervisor Pattern becomes useful.

Instead of relying on one giant agent, we introduce a central orchestrator responsible for coordinating specialized executors. Some executors may be tools, others may be reusable workflows, and others may be autonomous agents focused on a specific domain.

Conceptually, this is much closer to how modern AI systems operate internally. Systems like GitHub Copilot, Claude, and many enterprise AI platforms are not simply “one prompt talking to one model.” A significant part of the engineering complexity comes from orchestration: deciding what should execute, when it should execute, and how results should be combined.

In this article, we will build a simplified supervisor-based multi-agent architecture entirely in pure Python without relying on orchestration frameworks.


From Single Agents to Execution Runtimes

Most beginner agent tutorials follow roughly the same structure. A user sends a task, the agent reasons about it, invokes tools when necessary, and eventually produces an answer.

At small scale, this works well enough.

But imagine a more realistic request:

Research vector databases,
generate implementation examples,
analyze project files,
and review the generated solution.

Enter fullscreen mode Exit fullscreen mode

A single agent now has to:

  • reason about research,
  • inspect files,
  • generate code,
  • review output,
  • manage tools,
  • maintain context,
  • and orchestrate execution order.

The problem is not necessarily model capability. The problem is architecture.

At some point, the “agent” stops being just a reasoning unit and accidentally becomes a workflow engine.

The Supervisor Pattern solves this by separating orchestration from execution.

Instead of one overloaded agent, we create specialized executors coordinated by a supervisor.

The architecture looks like this:

                    Supervisor
                         |
        +----------------+----------------+
        |                |                |
     Tools            Skills           Agents
        |                |                |
   File Search      Ticket Workflow   Coding Agent
   Web Search       Log Analysis      Research Agent

Enter fullscreen mode Exit fullscreen mode

The important idea here is that the supervisor does not care whether it is invoking a tool, a workflow, or another agent. Everything follows the same execution contract.


Creating a Common Execution Interface

One of the simplest but most important architectural decisions is standardizing how execution works.

Instead of creating separate orchestration logic for tools, agents, and workflows, we can define a shared interface:

from abc import ABC, abstractmethod

class Executable(ABC):

    @abstractmethod
    async def execute(self, task: str, context: dict):
        pass

Enter fullscreen mode Exit fullscreen mode

This abstraction becomes surprisingly powerful.

A search tool can implement it. A coding agent can implement it. A reusable workflow can implement it. To the supervisor, everything becomes just another executable component.

That greatly simplifies orchestration.


Building Specialized Executors

Now let’s create a few executors with different responsibilities.

We will start with a simple search tool:

class SearchTool(Executable):

    async def execute(self, task, context):

        return f"""
        Searching documentation for:
        {task}
        """

Enter fullscreen mode Exit fullscreen mode

Then a file analysis tool:

class FileAnalysisTool(Executable):

    async def execute(self, task, context):

        return f"""
        Analyzing project files for:
        {task}
        """

Enter fullscreen mode Exit fullscreen mode

These tools are intentionally small and focused. They represent atomic capabilities.

Now we can create specialized agents.

A research agent:

class ResearchAgent(Executable):

    async def execute(self, task, context):

        return f"""
        Research findings for:
        {task}
        """

Enter fullscreen mode Exit fullscreen mode

A coding agent:

class CodingAgent(Executable):

    async def execute(self, task, context):

        return f"""
        Generated implementation for:
        {task}
        """

Enter fullscreen mode Exit fullscreen mode

And finally, a review agent:

class ReviewAgent(Executable):

    async def execute(self, task, context):

        return f"""
        Code review completed for:
        {task}
        """

Enter fullscreen mode Exit fullscreen mode

This separation of concerns is one of the biggest advantages of supervisor architectures. Each executor remains isolated and focused, which makes the overall system easier to scale and debug.


Dynamic Registration

Hardcoding dependencies quickly becomes painful as the number of executors grows.

Instead, we can create a registry capable of dynamically storing and discovering executors at runtime.

class Registry:

    def __init__(self):

        self.executables = {}

    def register(
        self,
        name,
        description,
        executable_type,
        instance
    ):

        self.executables[name] = {
            "description": description,
            "type": executable_type,
            "instance": instance
        }

    def get(self, name):

        return self.executables[name]

    def list(self):

        return self.executables

Enter fullscreen mode Exit fullscreen mode

Now we can register everything dynamically:

registry = Registry()

registry.register(
    "search_tool",
    "Searches technical documentation",
    "tool",
    SearchTool()
)

registry.register(
    "file_analysis_tool",
    "Analyzes project files",
    "tool",
    FileAnalysisTool()
)

registry.register(
    "research_agent",
    "Performs research tasks",
    "agent",
    ResearchAgent()
)

registry.register(
    "coding_agent",
    "Generates code",
    "agent",
    CodingAgent()
)

registry.register(
    "review_agent",
    "Reviews implementations",
    "agent",
    ReviewAgent()
)

Enter fullscreen mode Exit fullscreen mode

At this point, the system starts feeling much more like a runtime instead of a simple chatbot wrapper.


Building the Supervisor

The supervisor is the heart of the architecture.

Its responsibility is not necessarily to solve the task directly, but rather to decide which executors should participate in solving it.

We will start with a very simple planner:

class Supervisor:

    def __init__(self, registry):

        self.registry = registry

    async def plan(self, task):

        selected = []

        lower_task = task.lower()

        if "research" in lower_task:
            selected.append("research_agent")

        if "implement" in lower_task:
            selected.append("coding_agent")

        if "review" in lower_task:
            selected.append("review_agent")

        if "search" in lower_task:
            selected.append("search_tool")

        return selected

Enter fullscreen mode Exit fullscreen mode

This planner is intentionally primitive. In production systems, this planning phase is often delegated to an LLM that returns structured execution plans.

But even this simplified version already demonstrates the architecture.

The supervisor receives a goal and decides dynamically which executors should participate.


Parallel Execution

Now comes the most interesting part.

Instead of executing everything sequentially, the supervisor can orchestrate independent tasks concurrently.

import asyncio

class Supervisor:

    def __init__(self, registry):

        self.registry = registry

    async def plan(self, task):

        selected = []

        lower_task = task.lower()

        if "research" in lower_task:
            selected.append("research_agent")

        if "implement" in lower_task:
            selected.append("coding_agent")

        if "review" in lower_task:
            selected.append("review_agent")

        if "search" in lower_task:
            selected.append("search_tool")

        return selected

    async def execute(self, task, context):

        selected = await self.plan(task)

        executions = []

        for name in selected:

            executable = self.registry.get(name)["instance"]

            executions.append(
                executable.execute(task, context)
            )

        results = await asyncio.gather(*executions)

        return results

Enter fullscreen mode Exit fullscreen mode

This changes the nature of the system completely.

We are no longer building a linear tool-calling loop. We are building an orchestration runtime capable of coordinating distributed execution.

That distinction matters a lot.


Running the System

Now we can execute the entire pipeline:

async def main():

    supervisor = Supervisor(registry)

    result = await supervisor.execute(
        """
        Research vector databases,
        search implementation examples,
        implement a prototype,
        and review the generated code
        """,
        {}
    )

    for item in result:
        print(item)

asyncio.run(main())

Enter fullscreen mode Exit fullscreen mode

The interesting part is not the mock outputs themselves. The interesting part is the orchestration model emerging underneath.

The supervisor analyzes the task, dynamically selects executors, parallelizes execution, and aggregates results back into a unified workflow.

That is much closer to how modern AI systems actually operate internally.


The Architectural Shift

At this point, the system has evolved far beyond a simple “AI chatbot.”

The supervisor is acting simultaneously as:

  • planner,
  • router,
  • scheduler,
  • orchestrator.

This is also why many production AI systems are significantly more complicated than “send prompt, receive response.”

A large portion of the engineering complexity comes from:

  • orchestration,
  • execution management,
  • concurrency,
  • state propagation,
  • retries,
  • failure isolation,
  • observability.

The model itself is only one piece of the system.


Moving Toward LLM-Based Planning

Our planner currently uses simple rule matching:

if "review" in task:
    selected.append("review_agent")

Enter fullscreen mode Exit fullscreen mode

But modern systems usually replace this with an LLM planner capable of generating structured execution plans.

Something like:

prompt = f"""
Task:
{task}

Available executors:
- research_agent
- coding_agent
- review_agent
- search_tool

Return the executors required.
"""

Enter fullscreen mode Exit fullscreen mode

The LLM might return:

{
  "executors": [
    "research_agent",
    "coding_agent",
    "review_agent"
  ],
  "parallel": true
}

Enter fullscreen mode Exit fullscreen mode

At that point, the runtime becomes significantly more autonomous.

The supervisor is no longer following hardcoded execution paths. It is dynamically constructing execution graphs at runtime.


Production Realities

This is where things become genuinely difficult.

Once agents can invoke tools, workflows, and even other agents,
the runtime itself becomes the primary engineering challenge.

You suddenly need to think about:

  • recursion protection,
  • concurrency limits,
  • cancellation,
  • retries,
  • structured outputs,
  • tracing,
  • execution graphs,
  • timeout management.

For example, agents invoking agents can accidentally create infinite loops:

Supervisor -> ResearchAgent
ResearchAgent -> Supervisor
Supervisor -> ResearchAgent

Enter fullscreen mode Exit fullscreen mode

You quickly realize that the difficult part of AI systems is often not model invocation.

The difficult part is building reliable orchestration around the model.


Final Thoughts

Once you understand the Supervisor Pattern, you stop thinking about AI agents as isolated chatbots.

You start thinking in terms of execution runtimes, orchestration graphs, distributed reasoning, and autonomous workflows.

That shift in perspective changes everything.

And interestingly, none of this requires a framework.

Underneath most orchestration libraries, the core execution model is still surprisingly simple:

await executable.execute(task, context)

Enter fullscreen mode Exit fullscreen mode

Everything else is architecture layered on top.