Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Troupekit and AutoGen

AutoGen is Microsoft's Python framework for multi-agent applications. We compared its AgentChat API at release python-v0.7.5, checked on 2026-11-28.

AutoGen is archived. Its README says "This project has been archived and is no longer actively maintained by Microsoft" and points new users to Microsoft Agent Framework as its successor (README). We could not pin Microsoft Agent Framework's source on the day we checked, so it is not compared here. This page is for teams that run AutoGen today.

The same agent

The test agent is small on purpose: a persona, one tool, a run that is killed and resumed, and a spend cap.

In AutoGen

From the AgentChat quickstart (quickstart.ipynb):

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient

# Define a model client. You can use other model client that implements
# the `ChatCompletionClient` interface.
model_client = OpenAIChatCompletionClient(
    model="gpt-4o",
    # api_key="YOUR_API_KEY",
)


# Define a simple function tool that the agent can use.
# For this example, we use a fake weather tool for demonstration purposes.
async def get_weather(city: str) -> str:
    """Get the weather for a given city."""
    return f"The weather in {city} is 73 degrees and Sunny."


# Define an AssistantAgent with the model, tool, system message, and reflection enabled.
# The system message instructs the agent via natural language.
agent = AssistantAgent(
    name="weather_agent",
    model_client=model_client,
    tools=[get_weather],
    system_message="You are a helpful assistant.",
    reflect_on_tool_use=True,
    model_client_stream=True,  # Enable streaming tokens from the model client.
)

To survive a restart, you save the state yourself and load it into a new team. From the state tutorial (state.ipynb):

import json

## save state to disk

with open("coding/team_state.json", "w") as f:
    json.dump(team_state, f)

## load state from disk
with open("coding/team_state.json", "r") as f:
    team_state = json.load(f)

new_agent_team = RoundRobinGroupChat([assistant_agent], termination_condition=MaxMessageTermination(max_messages=2))
await new_agent_team.load_state(team_state)

State is saved when you call save_state(), so a process killed in the middle of a run loses everything since the last save. For the cap, TokenUsageTermination stops a team once a token count is reached (source). It is a termination condition checked on the message stream, and there is none for money.

In troupekit

The persona is the doc comment and the tool is a #[tool] function. This is the tool_agent example:

#![allow(unused)]
fn main() {
/// Adds numbers with the add tool.
#[agent(model = "openai/gpt-6-luna", tools = [add])]
fn calc() {}
}

A role, a goal, evals, a spend cap of 5 000 millionths of a dollar per run and the checkpoint store are keys on the same macro. This one is from a test of the kit:

#![allow(unused)]
fn main() {
#[agent(
    model = "fake/m",
    role = "Checks facts.",
    goal = "A short answer.",
    display_name = "Fact Checker",
    evals = ["min_items(items, 1)"],
    limits = Limits { run: Some(5_000), ..Limits::default() },
    checkpoints = Storage::memory(),
    max_turns = 3,
    max_tokens = 256,
    retries = 1,
    laws = "tests/fixtures/rules.bend",
    auto_laws = false,
)]
}

In 0.4 the laws key is validated at build and not enforced by the run (Proofs and laws). With the SQLite store as checkpoints, a new process resumes a killed run by its id. This is the kill_model_call example, which is killed in the middle of a local model call:

#![allow(unused)]
fn main() {
("resume", Some(id)) => {
    let run_id: RunId = serde_json::from_str(&format!("\"{id}\""))?;
    let text = built.resume(run_id).await?;
    println!("RESUMED {}", text.len());
}
}

Nothing else is needed: no server, no second process to run the engine, no Python. Durable runs and Spend limits say what each part guarantees.

Side by side

AutoGen 0.7.5Troupekit 0.4
DurabilityManual save_state() and load_state() to your own storage; no per-step checkpoint (state.ipynb)Checkpoint after every step and resume by run id, once checkpoints use Storage::sqlite; the default in-memory store is lost when the process exits
Spend limitsToken counts, as a termination condition (source)USD per call, per run and per period, when you set them; checked before each call
TracingOpenTelemetry, to any compatible backend (tracing.ipynb)Built-in tracer, JSONL and an HTML viewer
EvalsAutoGenBench works with the 0.1 and 0.2 APIs only (README)Evals on the persona, checked on every run
Offline and on-devicellama.cpp in process through LlamaCppChatCompletionClient (source), and Ollamallama.cpp in process, Ollama, and a route policy per call
MobileNo iOS or Android docs foundBuilds for iOS and Android in CI; Swift and Kotlin bindings since 0.4, built from source
Single binaryNeeds Python 3.10 or newer (pyproject.toml)Compiles into your program

Where AutoGen is better

It ships multi-agent team patterns (round robin, swarm and an experimental GraphFlow) and MCP tools today (README), both of which troupekit plans for 0.5 and 0.6.

Where troupekit is different

Once you set Storage::sqlite checkpoints, a run is checkpointed for you after every step, and a cap you set is in money and checked before a call is made, not after the tokens are spent. And it is maintained.