Recipes

TypeScript multi-agent chat framework forked from AutoGen

From README links · today

Research & KnowledgeSoftware & DevOps

Port AutoGen's multi-agent conversation pattern to TypeScript with channels.

What they did

They took Microsoft's AutoGen multi-agent conversation pattern and rebuilt it in TypeScript as AIbitat, a stateless and extensible framework where agents behave like members of a Slack workspace. Using Bun for the toolchain, they scaffolded a project, installed the aibitat package, and set an OPENAI_API_KEY in a .env file. In index.ts they constructed an AIbitat instance, attached the CLI plugin so a human could participate, and registered three agents: a 'client' human-assistant agent with interrupt set to ALWAYS, a 'mathematician' restricted to solving math problems raised by @client, and a 'reviewer' that only confirms the mathematician's result without solving anything itself. They then created a 'management' channel containing all three agents and kicked off the conversation with a single start() call from client to management asking 'How much is 2 + 2?'. Finally they logged aibitat.chats to inspect the full transcript. The framework handles agent selection, turn-taking, and termination via TERMINATE/INTERRUPT replies, with maxRounds guarding against loops.

How it went

The example runs end to end with bun run index.ts: the mathematician answers, the reviewer confirms, and the client agent terminates the chat, leaving a readable transcript in aibitat.chats. It is a working reference implementation rather than a polished product — the README is example-driven, and several roadmap items (web browsing, caching, file interaction, code execution, cost limits) are still marked as planned or in progress.

Worth knowing

Requires Bun and an OpenAI API key; defaults to gpt-3.5-turbo for conversation and gpt-4 for next-agent prediction, so costs can climb. Only OpenAI and Anthropic providers are marked ready; Cohere, Fireworks, Hugging Face, and Replicate are pending. Web browsing is in progress, and cache, file interaction, code execution, and cost limits are not yet shipped. Agent behavior depends heavily on prompt wording, and interrupt semantics (NEVER/ALWAYS plus TERMINATE/INTERRUPT keywords) need care to avoid runaway loops.

Wiring

Install Bun, run bun init, then bun install aibitat. Create .env with OPENAI_API_KEY. In index.ts, import {AIbitat} from 'aibitat' and {cli} from 'aibitat/plugins'. Chain .use(cli()) for human-in-the-loop, then .agent(name, {interrupt, role}) for each participant, then .channel('management', ['mathematician','reviewer','client']). Optionally attach aibitat.onMessage(console.log) for live streaming. Call await aibitat.start({from:'client', to:'management', content:'...'}) to begin; the framework picks the next speaker, routes messages, and stops on TERMINATE or INTERRUPT. Inspect aibitat.chats afterward. Configure provider/model either in the AIbitat constructor or per agent/channel; set maxRounds to cap turns.

Try it yourself

Set up a TypeScript multi-agent chat using the aibitat package with Bun. Create a project, add OPENAI_API_KEY to .env, and write index.ts that: (1) instantiates AIbitat with the cli plugin, (2) registers a 'client' agent with interrupt ALWAYS that replies TERMINATE when satisfied, (3) registers a 'mathematician' agent that only answers math questions from @client, (4) registers a 'reviewer' agent that only confirms the mathematician's answer, (5) creates a 'management' channel with all three, and (6) starts a conversation asking 'How much is 2 + 2?' then logs aibitat.chats. Run it with bun run index.ts and show me the transcript.

Source

Tools in this stack

Run this stack

Install the stack into this project. It writes AGENTS.md and the manifest, merges the MCP servers into .mcp.json, and — with --yes — runs the tool installs.

npx runchr install runchr/stack-aibitat-and-autogen
No CLI?curl -s https://api.runchr.com/api/recipes/runchr/stack-aibitat-and-autogen/manifest
System prompt
You are a setup assistant for a TypeScript multi-agent chat built on the aibitat framework, a port of AutoGen's multi-agent conversation pattern. You scaffold the project, wire agents and channels exactly as specified, and run it to show the transcript rather than guessing at behavior.

This system prompt was generated from this stack's copy and tools. A person has not reviewed it.

The manifest is also at api.runchr.com/api/recipes/runchr/stack-aibitat-and-autogen/manifest.