Skip to content

Blog#

A2UIAgent: Rich UI from Your AG2 Agents

Your AG2 agent can reason, call tools, and stream text. But what if it could also generate a full UI — cards, forms, buttons, images — from a single prompt?

A2UIAgent is a new reference agent in AG2 that produces rich, interactive user interfaces using the A2UI protocol. Instead of returning plain text, the agent generates structured JSON that client-side renderers transform into native UI components. The same agent serves web, mobile, and desktop clients — all through standard protocols.

In this post, we'll walk through what A2UIAgent does, how it works under the hood, and how to build a working demo that generates marketing preview cards served over A2A.

Connect AG2 Agents to 8,000+ Tools with Arcade.dev

AG2 x Arcade.dev

Overview

Arcade.dev is a tool execution runtime that provides 8,000+ pre-built integrations with just-in-time authorization. It sits between your agents and enterprise systems: your agent calls a tool, the user authenticates once through Arcade, and Arcade handles token management, scope negotiation, and credential storage from that point on. No service accounts, no secrets in your codebase.

This solves common problems when connecting agents to external services:

  • Building and maintaining OAuth flows for each API (Gmail, Linear, Slack, etc.)
  • Managing token lifecycle: refresh, rotation, expiry
  • Storing credentials securely and isolating them from the LLM layer
  • Handling scope negotiation and incremental authorization

In this post, we'll build a Gmail assistant using AG2 and the Arcade SDK. The agent will list, search, read threads, send, reply, and archive emails using AG2's AssistantAgent + UserProxyAgent, pattern while Arcade handles all the authentication and API complexity behind the scenes.

AG2 Beta: Stronger Foundation for Real-World Agents

AG2 Beta

The original AutoGen and later AG2 architecture helped define the early agent ecosystem. It enabled real systems, shaped how many developers thought about agent orchestration, and gave us firsthand experience building and operating agent applications in practice.

That experience also made the limits of the original design clearer over time. As the agent ecosystem matured, expectations changed. Agents increasingly needed to fit into real application environments with concurrent users, explicit session boundaries, platform identities, persistence layers, and integration points that could not be treated as incidental details.

We found that some of these needs were challenging to address cleanly inside the original framework model. In many cases, shipping more production-suitable behavior meant adding complexity around the edges instead of improving the core abstraction itself, taking the focus of developers away from building agentic capabilities. That is a big part of why we decided to create AG2 Beta: a new framework track built around lessons we learned from the original AG2 to better support modern, real-world agentic systems.

You can read more about the motivation behind AG2 Beta in the AG2 Beta overview.

Jump into the AG2 Playground

AG2 Playground

Time for our AG2 agents to let their robotic hair down and have some fun. Jump in with agent orchestrations in the AG2 Playground: watch the flow between agents as they work, execute tools, and hand off to one another.

What's Inside

Interactive demos covering orchestration patterns and integrations. Pick one, select or type a prompt, hit Run, and watch agents light up as they think, stream responses, and coordinate in real time.

Want to do something similar, grab the code snippets on the Code tab for each demo or see the links to the topic in our documentation.

No account required, jump into playground.ag2.ai.

Intelligent Agent Handoffs: Routing Control in Multi-Agent Systems with AG2

Intelligent Agent Handoffs

A customer messages your support system: "My laptop keeps shutting down randomly." The triage agent routes it to technical support. So far, so good. But the tech agent doesn't know whether this is a hardware or software issue, doesn't check the customer's account tier, and when it can't solve the problem, it hallucinates an answer instead of escalating. The customer leaves frustrated. The agent never knew it was supposed to hand off.

This is the handoff problem. And it's harder than it looks.

Deep Web Research with AG2 and GPT Researcher

GPT Researcher x AG2

Ask an LLM to research a topic and write a report. It'll produce something -- sometimes quite good. But probe the sources, check the claims, or ask for substantial revisions and the limitations show up fast. The agent that searched the web is also the one drawing conclusions from it. There's no review step between research and writing. Errors and gaps pass straight through to the final document.

The fix isn't a better prompt. It's division of labor.

GPT Researcher, created by Assaf Elovic, is built on this idea: specialized agents, each with a distinct job, working through a staged pipeline. A researcher gathers, an editor outlines, a reviewer challenges the findings, a revisor incorporates the feedback, and a writer only touches finalized content. Every handoff is a quality check.

This post walks through the build-with-ag2 example, which runs the full pipeline with AG2 as the orchestration layer. The example ships with two run modes -- a terminal script and a web UI built on AG-UI that shows pipeline progress in real time and includes a human-in-the-loop review step before writing begins.

Give Your AG2 Agent its own UI with AG-UI

AG2 x AG-UI

You've built an agent with AG2. It reasons, calls tools, and streams responses. But right now it lives in a terminal or a script. The moment you want to put it in front of a user (like for a blog, perhaps) and stream text token by token, show tool activity as it happens, and handle errors gracefully you're building custom plumbing: WebSocket handlers, bespoke JSON formats, state synchronization logic.

AG-UI (Agent-User Interaction Protocol) is an open, lightweight, event-based protocol that standardizes this agent-to-UI layer. AG2 now supports AG-UI natively, meaning you can connect any ConversableAgent to an AG-UI-compatible frontend with just a couple of lines of code.

In this post, we'll look under the hood at how the protocol works by building a working agent chat application from scratch using a ConversableAgent with a weather tool, sending AG-UI events to a browser frontend that renders streaming text and an interactive tool card. Simple HTML, no frontend framework required.

AG2 Agent Chat powered by AG-UI

AG2 OpenTelemetry Tracing: Full Observability for Multi-Agent Systems

AG2 OpenTelemetry Tracing

Multi-agent systems are powerful -- but when something goes wrong, figuring out where and why is painful. Which agent made the bad decision? Was the LLM call slow, or did the tool fail? How many tokens did that group chat actually use?

AG2 now has built-in OpenTelemetry tracing that gives you full visibility into your multi-agent workflows. Every conversation, agent turn, LLM call, tool execution, and speaker selection is captured as a structured span -- connected by a shared trace ID and exportable to any OpenTelemetry-compatible backend.

Key highlights:

  • Four simple API functions to instrument agents, LLM calls, group chats, and A2A servers
  • Hierarchical traces that mirror how agents process conversations
  • Distributed tracing across services using W3C Trace Context propagation
  • Works with any backend -- Jaeger, Grafana Tempo, Datadog, Honeycomb, Langfuse, and more
  • Follows OpenTelemetry GenAI Semantic Conventions for standard interoperability

AG2 Gemini Thinking Configuration: Enhanced Reasoning Control with ThinkingConfig

AG2 v0.10.3 introduces native support for Google Gemini's Thinking Configuration, enabling fine-grained control over how Gemini models approach complex reasoning tasks. With thinking_budget, thinking_level, and include_thoughts parameters, you can now customize the depth and transparency of your agent's reasoning process, making it ideal for complex problem-solving, research tasks, and scenarios where you need insight into the model's internal reasoning.

This article explores how to leverage Gemini Thinking Configuration in AG2 for enhanced reasoning capabilities, with practical examples for different use cases and model variants.

Google Gemini models support advanced reasoning features that allow them to "think" through problems before providing answers. This internal reasoning process can significantly improve performance on complex tasks, but until now, controlling this behavior in AG2 required custom configurations or workarounds.

AG2 v0.10.3's native ThinkingConfig support solves this by providing direct access to Gemini's thinking parameters through the standard LLMConfig interface, making it easy to:

  • Control the amount of reasoning tokens allocated to complex problems
  • Adjust thinking intensity for different task complexities
  • Reveal the model's internal reasoning process when needed
  • Optimize cost and performance based on your specific use case

AG2 Multi-MCP Session Management: Dynamic Server Connections with MCPClientSessionManager

AG2's MCPClientSessionManager revolutionizes how you connect to multiple MCP (Model Context Protocol) servers by enabling on-demand session creation within your agent workflows. Instead of maintaining persistent connections, you can now dynamically open sessions to different servers—whether they use stdio or SSE transports—right inside your tool functions.

This article explores how to leverage MCPClientSessionManager for flexible, resource-efficient multi-server agent architectures, with practical examples for building research assistants, data pipelines, and intelligent routing systems.