Skip to content

Python: AG-UI protocol support - #1826

Merged
Evan Mattson (moonbox3) merged 8 commits into
microsoft:mainfrom
moonbox3:ag-ui-integration
Nov 5, 2025
Merged

Python: AG-UI protocol support#1826
Evan Mattson (moonbox3) merged 8 commits into
microsoft:mainfrom
moonbox3:ag-ui-integration

Conversation

@moonbox3

@moonbox3 Evan Mattson (moonbox3) commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

Motivation and Context

Implements AG-UI (Agent-User Interaction) protocol support for the Python Agent Framework, enabling standardized streaming communication with AG-UI-compatible frontends. This is the Python equivalent of .NET PR #1776.

The AG-UI protocol is an open, event-based protocol that standardizes how AI agents connect to user-facing applications. Without AG-UI support, Python agents cannot interoperate with the growing ecosystem of AG-UI-compatible frontends (CopilotKit, LangGraph Studio, etc.).

Implementation
New Package: agent-framework-ag-ui (v0.1.0) -> will update to the latest package version at next release.

Architecture:

  • Orchestrator pattern: Clean separation of execution flows (human-in-the-loop, standard chat)
  • Strategy pattern: Customizable confirmation message generation
  • Event bridge: Bidirectional conversion between Agent Framework and AG-UI events
  • FastAPI integration: Server-Sent Events (SSE) streaming via add_agent_framework_fastapi_endpoint()

Supported AG-UI Features (all 7):

  1. Agentic chat with text streaming
  2. Backend tool rendering
  3. Human-in-the-loop (function approval)
  4. Agentic generative UI (async tools)
  5. Tool-based generative UI (custom components)
  6. Shared state (StateSnapshot/StateDelta events)
  7. Predictive state updates (optimistic UI)

Quality

  • Test Coverage: 96% (150 tests passing)

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@moonbox3 Evan Mattson (moonbox3) added the python Usage: [Issues, PRs], Target: Python label Oct 31, 2025
Copilot AI review requested due to automatic review settings October 31, 2025 06:01
@markwallace-microsoft Mark Wallace (markwallace-microsoft) added the documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs label Oct 31, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new agent-framework-ag-ui package that provides AG-UI protocol integration for the Agent Framework. The implementation adds comprehensive support for all AG-UI features including agentic chat, backend tool rendering, human-in-the-loop, shared state, and predictive state updates.

Key Changes:

  • Added new packages/ag-ui package with orchestrator-based architecture
  • Implemented event bridge for translating Agent Framework events to AG-UI protocol
  • Added comprehensive test coverage for all features
  • Included example agents and FastAPI server implementation

Reviewed Changes

Copilot reviewed 49 out of 50 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
python/uv.lock Added ag-ui-protocol dependency and agent-framework-ag-ui package entry
python/pyproject.toml Registered new package in workspace and added to test coverage
python/packages/ag-ui/pyproject.toml Package configuration with dependencies and build settings
python/packages/ag-ui/agent_framework_ag_ui/* Core implementation files for AG-UI integration
python/packages/ag-ui/tests/* Comprehensive test suite covering all features
python/packages/ag-ui/examples/* Example agents and FastAPI server

Comment thread python/packages/ag-ui/examples/server/main.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_endpoint.py Outdated
Comment thread python/packages/ag-ui/tests/test_agent_wrapper_comprehensive.py
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_message_adapters.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_orchestrators.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some quick notes

Comment thread python/packages/ag-ui/pyproject.toml Outdated
Comment thread python/packages/ag-ui/pyproject.toml Outdated
Comment thread python/packages/ag-ui/examples/pyproject.toml Outdated
@markwallace-microsoft

Mark Wallace (markwallace-microsoft) commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/ag-ui/agent_framework_ag_ui
   _agent.py34294%94, 154
   _confirmation_strategies.py670100% 
   _endpoint.py350100% 
   _events.py249797%143, 269, 288, 319, 543–544, 575
   _message_adapters.py85989%43, 45–46, 48, 53–54, 56–57, 90
   _orchestrators.py1751094%129, 150, 185, 233–236, 377–379
   _types.py110100% 
   _utils.py29196%57
TOTAL12770190785% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
1668 107 💤 0 ❌ 0 🔥 32.265s ⏱️

Comment thread python/packages/ag-ui/agent_framework_ag_ui/_utils.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_agent.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_orchestrators.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_events.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/py.typed
@moonbox3
Evan Mattson (moonbox3) added this pull request to the merge queue Nov 5, 2025
Merged via the queue into microsoft:main with commit 35a8565 Nov 5, 2025
21 checks passed
Aris Nguyen (arisng) pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
* Add AG-UI integration

* Fix tests. PR feedback

* Cleanup

* PR Feedback

* Improve README and getting started experience

* Fix links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Python: Add AG-UI support for Python

7 participants