AG2 Playground — Interactive Multi-Agent AI Demos
Building with AG2 in Claude Code, Codex, or Cursor?
AG2 Agent Skills for coding assistants:
npx skills add ag2ai/ag2-skills
The new ag2 stack — Core, Network & Evals
Core
The new ag2 Agent API — ask, tools, parallel sub-agents, context & memory.
Agent Ask
Try the new AG2 Agent API, start a conversation with Agent.ask().
Structured Output
Typed Pydantic output from the new AG2 Agent.
Middleware Stack
Stack LoggingMiddleware, RetryMiddleware and HistoryLimiter on one Agent — retries recover from a fault and a trimmed history makes the agent forget, live.
Ask the Web
Citation-backed web Q&A. A single AG2 Agent searches with Tavily, fetches the best sources, and answers with inline citations + live source cards.
Parallel Research
A lead AG2 agent fans out research to 3 specialist subagents in parallel, with live per-researcher progress lanes, then a cited synthesis.
Context Lens
Two synced panels show the raw stream history vs what the LLM actually sees after the assembly chain. Toggle ConversationPolicy / SlidingWindowPolicy / TokenBudgetPolicy live.
Compaction Cycle
TailWindowCompact (free) vs SummarizeCompact (1 LLM call) on the same scripted conversation. Watch the trigger fire, events drop, and the synthesised summary appear.
Working Memory
Cross-session memory round-trip: WorkingMemoryAggregate writes /memory/working.md after every turn; a brand-new Agent in session 2 has WorkingMemoryPolicy inject it back as a system block.
Network
The multi-agent runtime — hubs, channels, turn-taking adapters & governance.
Network Walkthrough
Join us for a journey through AG2's multi-agent runtime — build hubs, register agents, open channels, plug in turn-taking adapters, add governance, write your own adapter.
Consulting Channel
Strict 1-to-1 (1Q1R) between two agents on a hub-mediated channel. The ConsultingAdapter auto-closes after the respondent's reply.
Conversation Channel
Free-form 2-party chat with no turn order. The ConversationAdapter never auto-closes — the application caps the chain and calls channel.close() explicitly.
Discussion Channel
Three agents take turns round-robin. The DiscussionAdapter enforces order; out-of-turn agents skip the LLM call entirely via can_send.
Workflow Channel
A declarative TransitionGraph drives Researcher → Writer → Reviewer. The Reviewer's @tool calls (request_revision / approve) loop back or terminate.
Evals
Measure agents — scorers, LLM & human judges, A/B and head-to-head comparisons.
First Eval
The simplest evaluation: run one agent over a suite of tasks and grade each answer with a prebuilt scorer. The task board fills in one verdict at a time, then a pass rate.
Custom Scorer
Write your own @scorer — a function of the agent's answer. Its return type decides the aggregation: bool → pass rate, number → stats, string → label counts. Tweak the keyword and re-grade instantly.
LLM as a Judge
Grade subjective quality with a judge agent. agent_judge reads each answer and a criterion you write, and returns a 0-1 score with reasoning — rolling up into score_stats.
The Scorecard
Grade each answer on several criteria at once — a list of scorers becomes a tasks × criteria matrix. Two judge dimensions that trade off (helpfulness vs conciseness) plus a deterministic correctness check.
A/B Variants
Run two agent prompt variants over the same suite and compare them side by side, judged on the same criterion. The higher mean wins.
Head-to-Head
Compare two models head-to-head on the same prompt: an LLM comparator picks a winner per task (in both orders, to cancel position bias), and a win-rate with a Wilson confidence interval assembles.
You Judge
Be the judge: two models answer the same prompt, you see them blinded and nominate the better one. The run pauses for your vote, and a win-rate with a Wilson confidence interval assembles.
Pattern
Links
DemoCode