Repository navigation
Python: Fix AG-UI examples server import and getting-started client calls - #9755
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Conversation
- The examples server imported the removed AzureOpenAIChatClient, so python -m agent_framework_ag_ui_examples failed with ImportError. Use OpenAIChatCompletionClient, which reads the AZURE_OPENAI_* settings, and add AZURE_OPENAI_MODEL to the examples .env template. - client_advanced.py, the getting-started README and the AGUIChatClient docstring passed metadata= and tools= directly to get_response, which raises TypeError; pass them through options instead. - Describe the client_with_agent.py session as AgentSession, not AgentThread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:46 — with
GitHub Actions
Inactive
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:46 — with
GitHub Actions
Inactive
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:48 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes match the current client contracts and Azure configuration behavior, with no unresolved findings.
No open issues 🎉
What changed in this PR
Repairs AG-UI example entry points after the deprecated Azure client removal in #4990 and aligns sample calls with the current client API. Library runtime behavior is unchanged.
Changes:
- Replaces the removed Azure client with
OpenAIChatCompletionClientand documents the required Azure model setting. - Passes metadata and tools through
optionsin examples and documentation. - Updates session terminology to
AgentSession.
| File | Description |
|---|---|
python/packages/ag-ui/getting_started/README.md |
Corrects streaming calls and session documentation. |
python/packages/ag-ui/getting_started/client_advanced.py |
Moves metadata and tools into request options. |
python/packages/ag-ui/agent_framework_ag_ui/_client.py |
Corrects the metadata argument in the docstring example. |
python/packages/ag-ui/agent_framework_ag_ui_examples/server/main.py |
Replaces the removed Azure client with its supported successor. |
python/packages/ag-ui/agent_framework_ag_ui_examples/.env.example |
Adds the required Azure model environment variable. |
Review effort: Balanced
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Two AG-UI entry points fail on
main.Examples server.
python -m agent_framework_ag_ui_examplesis the documented way to start the AG-UI examples server, which ships in theagent-framework-ag-uiwheel. It crashes at import:AzureOpenAIChatClientwas removed with the other deprecated OpenAI/Azure surfaces in #4990.server/main.pystill imports it at module level for its Azure OpenAI default.Getting-started client.
getting_started/client_advanced.pypassesmetadata=andtools=directly toAGUIChatClient.get_response().get_responseaccepts these only insideoptions, so the script stops at its second example:The
tool_exampleandconversation_examplesteps fail the same way ontools=. The streaming client snippet ingetting_started/README.mdand theAGUIChatClientclass docstring also usemetadata=.Description & Review Guide
server/main.py: the default client is nowOpenAIChatCompletionClient(). WithoutOPENAI_API_KEY, it routes to Azure OpenAI fromAZURE_OPENAI_ENDPOINT,AZURE_OPENAI_API_KEYandAZURE_OPENAI_MODEL. The comment names those variables, and.env.examplegainsAZURE_OPENAI_MODEL, which the client requires.client_advanced.py, the README snippet and theAGUIChatClientdocstring now passmetadataandtoolsthroughoptions, asclient.pyand the streaming example in the same file already do.getting_started/README.mddescribesclient_with_agent.py's session asAgentSession, which the script uses, instead ofAgentThread/thread.message_store.OpenAIChatCompletionClientfor Azure or to another client, such asFoundryChatClient.Verification:
AZURE_OPENAI_*variables set,agent_framework_ag_ui_examples.server.mainimports. It builds anOpenAIChatCompletionClientbacked byAsyncAzureOpenAIand registers all example routes.client_advanced.pyagainst a local AG-UI endpoint (add_agent_framework_fastapi_endpointwith a stub agent, overhttpx.ASGITransport). Onmain,non_streaming_exampleandtool_exampleraise theTypeError. With this change, all four examples complete, the server side receives the two tool definitions, and thethread_idround-trips.ag-uitest suite passes: 1776 passed.Related Issue
N/A - trivial change: replaces a removed class with its documented successor and moves
metadataandtoolsintooptions, as the API requires.AI Assistance
AI assistance details: Claude Code helped find these while checking examples for removed APIs, run the AG-UI client examples against a local endpoint, make the edits, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code