Learning Objectives
- Describe the actor model: agents as actors, messages as the only IPC, failure isolation per actor.
- Name AutoGen v0.4's three API layers — Core, AgentChat, Extensions — and what each is for.
- Explain why decoupling message delivery from handling gives fault isolation and natural concurrency.
- Implement a stdlib actor runtime in Python and port a two-agent code-review flow onto it.
The Problem
Most agent frameworks are synchronous: one agent produces, one agent consumes, in a call stack. Failures crash the stack. Concurrency is bolted on. Distribution requires rewriting.
AutoGen v0.4's answer: the actor model. Each agent is an actor with a private inbox. Messages are the only interaction. The runtime decouples delivery from handling. Failures isolate to one actor. Concurrency is native. Distribution is just different transport.
The Concept
Actors
An actor has:
- A private state (never directly touched from outside).
- An inbox (message queue).
- A handler:
receive(message) -> effectswhere effects can be "reply," "send to other actor," "spawn new actor," "update state," "stop self."
Two actors cannot share memory. They can only send messages.
Three API layers
AutoGen v0.4 splits its surface into three:
- Core. Low-level actor framework.
AgentRuntime,Agent,Message,Topic. Async message exchange, event-driven. - AgentChat. Task-driven high-level API (replacement for v0.2's ConversableAgent).
AssistantAgent,UserProxyAgent,RoundRobinGroupChat,SelectorGroupChat. - Extensions. Integrations — OpenAI, Anthropic, Azure, tools, memory.
Why decoupling matters
In the v0.2 model, calling agent_a.chat(agent_b) synchronously blocks agent_a until agent_b returns. In v0.4, send(agent_b, msg) puts the message in agent_b's inbox and returns. The runtime delivers later. Three consequences:
- Fault isolation. Agent B crashing does not crash Agent A — the runtime catches the failure in B's handler and decides what to do (log, retry, dead-letter).
- Natural concurrency. Many messages in flight at once; actors process their inbox concurrently.
- Distribution-ready. Inbox + transport is the same abstraction whether the actor is in-process or on another host.
Topologies
- RoundRobinGroupChat. Agents take turns in a fixed rotation.
- SelectorGroupChat. A selector agent picks who goes next based on conversation context.
- Magentic-One. Reference multi-agent team for web browsing, code execution, file handling. Built on AgentChat.
Observability
OpenTelemetry support is built in. Every message emits a span; tool calls carry gen_ai.* attributes per the 2026 OTel GenAI semantic conventions (Lesson 23).
Status: maintenance mode
Early 2026: AutoGen v0.7.x is stable for research and prototyping. Microsoft has shifted active development to the Microsoft Agent Framework, the production successor (public preview Oct 1 2025; 1.0 GA was targeted for end of Q1 2026). AutoGen patterns port forward cleanly — the actor model is the durable idea.
Interactive figure coming later.
Build It
code/main.py implements a stdlib actor runtime:
Message— typed payload withsender,recipient,topic,body.Actor— abstract withreceive(message, runtime).Runtime— event loop with a shared queue, delivery, failure isolation.- A two-actor demo:
ReviewerAgentreviews code,ChecklistAgentruns a checklist; they exchange messages until consensus.
Run it:
python3 code/main.py
The trace shows message delivery, a simulated failure in one actor that does not crash the other, and convergence on a shared verdict.
Use It
- AutoGen v0.4/v0.7 (maintenance) — stable for research, prototyping, multi-agent patterns.
- Microsoft Agent Framework — the production successor (public preview Oct 2025); same actor-model ideas in a refreshed API.
- LangGraph swarm topology (Lesson 13) — similar pattern via shared-tool handoffs.
- Custom actor runtime — when you need specific transport (NATS, RabbitMQ, gRPC).
Ship It
outputs/skill-actor-runtime.md generates a minimal actor runtime plus a team template (RoundRobin or Selector) for a given multi-agent task.
Exercises
- Add a dead-letter queue: when a handler raises, park the failing message for human inspection. How often does DLQ get hit in your toy?
- Implement
SelectorGroupChat: a selector actor picks who processes the next message based on conversation state. - Add distributed transport: swap the in-process queue for a JSON-over-HTTP server so actors can run in separate processes.
- Wire an OTel span per message (or a no-op stand-in). Emit
gen_ai.agent.name,gen_ai.operation.nameper Lesson 23. - Read AutoGen v0.4's architecture post. Port your toy to the real
autogen_coreAPI. What did you skip that matters in production?
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| Actor | "Agent" | Private state + inbox + handler; no shared memory |
| Message | "Event" | Typed payload; the only way actors interact |
| Inbox | "Mailbox" | Per-actor queue of pending messages |
| Runtime | "Agent host" | Event loop that routes messages and isolates failures |
| Topic | "Channel" | Named publish-subscribe route between actors |
| Fault isolation | "Let it crash" | One actor failing does not crash others |
| RoundRobinGroupChat | "Fixed-rotation team" | Agents take turns in order |
| SelectorGroupChat | "Context-routed team" | Selector picks who goes next |
| Magentic-One | "Reference team" | Multi-agent squad for web + code + files |
Further Reading
- AutoGen v0.4, Microsoft Research — the redesign post
- LangGraph overview — graph-shaped alternative
- OpenTelemetry GenAI semantic conventions — spans AutoGen emits by default
Code
Take-away files
skill-actor-runtime.md
--- name: actor-runtime description: Build an AutoGen v0.4-shaped actor runtime with private state, inbox-per-actor, message-only IPC, fault isolation, and a dead-letter queue. version: 1.0.0 phase: 14 lesson: 14 tags: [autogen, actor-model, messaging, fault-isolation, dead-letter] --- Given a multi-agent task, produce an actor runtime and the agent actors needed. Produce: 1. A `Message` type with `sender`, `recipient`, `topic`, `body`, `mid`. 2. An `Actor` base class with `receive(message, runtime)`. Actor state is private. 3. A `Runtime` with a shared queue, `send()`, `run_until_idle()`, and a dead-letter queue. Exceptions in handlers go to DLQ; do not propagate. 4. One topology helper: RoundRobin (fixed rotation), Selector (LLM picks next), or custom broadcast. 5. Observability hooks per message: emit OTel spans with `gen_ai.agent.name` and `gen_ai.operation.name` per Lesson 23. Hard rejects: - Synchronous message passing that blocks the sender until the recipient returns. That is the v0.2 model; it breaks fault isolation. - Shared mutable state across actors. Actors read state via messages or not at all. - A runtime that propagates handler exceptions. Failures belong in the DLQ; let other actors keep running. Refusal rules: - If the task has only two actors with a fixed back-and-forth, refuse the actor framing and suggest a prompt chain (Lesson 12). Actors earn cost when there are >=3 actors or async concurrency. - If the user wants "synchronous mode" for "easier debugging," refuse. Suggest logging + tracing (Lesson 23) instead. - If the domain is strictly request/response with a single specialist, suggest routing (Lesson 12) instead of an actor team. Output: `message.py`, `actor.py`, `runtime.py`, `teams.py`, `README.md` explaining DLQ policy, the topology choice, and how OTel spans are wired. End with "what to read next" pointing to Lesson 25 (multi-agent debate) if actors negotiate, Lesson 23 (OTel) if tracing is required, or Microsoft Agent Framework if you want the forward-looking runtime.