Start the Microsoft Agent Framework Bot on an Anthropic key - #613
Merged
davidmckayv merged 2 commits intoSep 19, 2026
Merged
davidmckayv merged 2 commits into
davidmckayv merged 2 commits into
Conversation
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 18, 2026 22:44
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The Microsoft Agent Framework Bot built `OpenAIChatClient(BOT_MODEL)` whatever the setup screen chose and never read `BOT_PROVIDER`. The catalogue offers every harness it installs with any model the screen offers, so this one can be picked with an Anthropic key: the desktop then writes `BOT_PROVIDER=anthropic`, `BOT_MODEL=claude-sonnet-4-5` and an empty `OPENAI_API_KEY`. The OpenAI client refused to be built without a key, so the module failed at import with `OpenAIError: Missing credentials` and the container never served a run. Agent Framework reaches Anthropic through its own `AnthropicClient`, published as `agent-framework-anthropic` and re-exported from `agent_framework.anthropic`, which reads `ANTHROPIC_API_KEY` and `ANTHROPIC_BASE_URL`. The harness now builds that client when the provider is `anthropic` and `OpenAIChatClient` otherwise, so an OpenAI key and an OpenAI-compatible endpoint behave as they did. The test follows the LlamaIndex Bot's, with the Responses API faked because that is the route `OpenAIChatClient` takes. Before this change the Anthropic key choice fails at import and the other two pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
davidmckayv
force-pushed
the
microsoft-agent-framework-anthropic-key
branch
from
September 19, 2026 01:27
b39b621 to
fa7175a
Compare
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.
What this changes
Picked with an Anthropic key, the Microsoft Agent Framework Bot exits on startup.
The harness built
OpenAIChatClient(BOT_MODEL)whatever the setup screen chose, and never readBOT_PROVIDER. The desktop catalogue gives every harness it installsCredential::AnyProvider, and this row's own summary is "Microsoft's, model-agnostic by design", so it can be paired with an Anthropic key. The desktop then writesBOT_PROVIDER=anthropicandBOT_MODEL=claude-sonnet-4-5, and leavesOPENAI_API_KEYempty. The OpenAI client refuses to be built without a key, and it is built at module level, so the import failed and the container never served/health:Agent Framework has its own Anthropic client.
AnthropicClientis published asagent-framework-anthropicand re-exported fromagent_framework.anthropic, the same wayagent_framework.openaire-exports the OpenAI one. It readsANTHROPIC_API_KEYandANTHROPIC_BASE_URL. The harness now builds that client when the provider isanthropic, andOpenAIChatClientas before otherwise, so the OpenAI key and OpenAI-compatible endpoint choices are unchanged.One thing to weigh:
agent-framework-anthropichas only ever been published as a pre-release. Its newest is1.0.0b260918, and PyPI lists no final version. pip installs it from a plain requirement because nothing else satisfies it, which is what the Linux run below did.agent-framework-openaiandagent-framework-ag-uiare final releases. Google is left out: the setup screen offers no Google key, and Compose passes the harness noGOOGLE_API_KEY.Where it runs
python-harness.Boundary and audit
Changelog
CHANGELOG.mdunderUnreleased.Proof
agent-microsoft/tests/test_main.pyfollowsagent-llamaindex/tests/test_main.py. It starts a local fake provider, imports the harness under the environment the desktop writes for each of the three choices, and posts an AG-UI run to/. It asserts HTTP 200,RUN_FINISHED, noRUN_ERROR, the provider's answer in the stream, and that the provider got the chosen model on the chosen route. The fake serves/v1/responsesbecauseOpenAIChatClientis Agent Framework's Responses API client. It also serves/v1/messages.ubuntu-latest, Python 3.12, a throwaway workflow on my fork running the same commands as the new CI step). This branch:3 passed. Withagent-microsoft/srcfrommain(2d09a08):1 failed, 2 passed.[an Anthropic key]fails at import with theOpenAIErrorabove.agent-framework-core1.19.0,agent-framework-openai1.14.4,agent-framework-anthropic1.0.0b260918,agent-framework-ag-ui1.4.0,anthropic0.116.0.This adds a step at the end of
python-harnessand an entry at the top ofUnreleased, which #609 to #612 also touch. Whichever lands later needs a rebase, and I'll do it.Default endpoint regression
The default Compose environment sets
ANTHROPIC_BASE_URLto an empty string. Microsoft Agent Framework's Anthropic client passed that through instead of selecting the official endpoint. The harness now explicitly useshttps://api.anthropic.comfor a blank override and preserves a nonblank custom URL.The additional authenticated AG-UI regression uses the real framework and Anthropic SDK, replacing only HTTP transport. It checks the official URL, API-key header, chosen model, answer, and successful run completion. All four tests pass locally, including the original provider cases. This is SDK integration coverage; no live Anthropic account or published image was exercised.
🤖 Generated with Claude Code