Skip to content

.NET: Add Anthropic-backed live tests for the OpenAI Responses hosting helpers - #7362

Merged
rogerbarreto merged 2 commits into
microsoft:mainfrom
ANcpLua:anthropic-responses-hosting-live-tests
Jul 28, 2026
Merged

.NET: Add Anthropic-backed live tests for the OpenAI Responses hosting helpers#7362
rogerbarreto merged 2 commits into
microsoft:mainfrom
ANcpLua:anthropic-responses-hosting-live-tests

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

#7000 introduced the app-owned hosting helper surface (OpenAIResponses plus AgentSessionStore) and covered it with an OpenAI-backed live test (OpenAIResponsesHostingLiveTests). The helper surface is provider-agnostic by design, but no test currently exercises it with a non-OpenAI backend. This PR adds the Anthropic-backed variant so the same consumption paths are confirmed end to end against a second provider.

Description & Review Guide

  • Adds AnthropicResponsesHostingLiveTests to the existing Microsoft.Agents.AI.Hosting.OpenAI.IntegrationTests project, mirroring OpenAIResponsesHostingLiveTests: request conversion, an agent run, Responses-shaped rendering, and multi-turn session continuity. The hosted agent is built with AnthropicClient.AsAIAgent(...) from Microsoft.Agents.AI.Anthropic.
  • One ProjectReference (Microsoft.Agents.AI.Anthropic) added to the test project. No production code or public API changes.
  • The tests skip via Assert.SkipWhen unless ANTHROPIC_API_KEY is configured — the same pattern as the OpenAI-backed variant and AnthropicChatCompletion.IntegrationTests — so CI runs without the secret stay green. Verified locally against the live API: 2/2 pass on net10.0. The default model is claude-haiku-4-5 (matching the Anthropic samples), overridable via ANTHROPIC_CHAT_MODEL_NAME.

Related Issue

N/A — small test-only addition; no new APIs or behavior changes.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is a breaking change — it is not; this is additive test coverage only.

🤖 Generated with Claude Code

…lpers

Mirrors OpenAIResponsesHostingLiveTests with the hosted agent backed by an
Anthropic chat client, confirming the app-owned hosting helper surface
(OpenAIResponses + AgentSessionStore) is provider-agnostic end to end.
Skipped unless ANTHROPIC_API_KEY is configured.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ANcpLua
ANcpLua temporarily deployed to github-app-auth July 28, 2026 12:33 — with GitHub Actions Inactive
@ANcpLua
ANcpLua temporarily deployed to github-app-auth July 28, 2026 12:33 — with GitHub Actions Inactive
@ANcpLua
ANcpLua temporarily deployed to github-app-auth July 28, 2026 12:33 — with GitHub Actions Inactive
@agent-framework-automation agent-framework-automation Bot added the .NET Usage: [Issues, PRs], Target: .Net label Jul 28, 2026
@ANcpLua
ANcpLua temporarily deployed to github-app-auth July 28, 2026 12:34 — with GitHub Actions Inactive
@ANcpLua

ANcpLua commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@rogerbarreto rogerbarreto self-assigned this Jul 28, 2026
@ANcpLua
ANcpLua temporarily deployed to github-app-auth July 28, 2026 17:37 — with GitHub Actions Inactive
ANcpLua added a commit to ANcpLua/DotNetTests that referenced this pull request Jul 28, 2026
The Anthropic-backed Responses-hosting live tests existed in three places at
once. Two of them are better than this one:

- microsoft/agent-framework#7362 folds the same two tests into the existing
  Microsoft.Agents.AI.Hosting.OpenAI.IntegrationTests project, next to the
  OpenAI variant they mirror, using upstream's injected TestSettings and the
  cheap claude-haiku-4-5 default. Approved, CI green.
- ANcpLua/TUnit-1.61.38 carries the TUnit port, which is the live .NET
  testing reference for the workspace.

This copy was the weakest of the three: xUnit v3 on a parked repo, with
TestSettings vendored as a trimmed subset of upstream's shared file, and four
package references carried solely for it. DotNetTests keeps its value as the
six-way framework comparison; it does not need a third copy of these tests.

Suite is 10/10 green after the removal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ANcpLua added a commit to ANcpLua/TUnit-1.61.38 that referenced this pull request Jul 28, 2026
…onical copy

These two live tests (non-streaming Responses render, multi-turn session
continuity over AgentSessionStore, both Anthropic-backed) existed in three
places at once. The upstream one is better than either local copy:

- It sits in Microsoft.Agents.AI.Hosting.OpenAI.IntegrationTests, directly
  beside the OpenAI variant it mirrors, so the provider-agnostic claim about
  the Responses hosting surface is visible as a pair rather than asserted in
  a fork.
- It uses upstream's MSBuild-injected TestSettings instead of a vendored
  trim of it, and defaults to claude-haiku-4-5 rather than claude-opus-5.
- It is a two-file diff against upstream, approved with CI green.

This copy carried the whole Microsoft.Agents.AI + Anthropic + Hosting +
Hosting.OpenAI package set into a test-patterns playground for one folder,
and the vendored TestSettings could only ever drift from the real one.
AdvancedPatterns keeps the five deterministic pattern folders it is actually
for; the live-service exception belongs upstream.

Suite is 10/10 green after the removal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rogerbarreto
rogerbarreto enabled auto-merge July 28, 2026 20:53
@rogerbarreto
rogerbarreto added this pull request to the merge queue Jul 28, 2026
Merged via the queue into microsoft:main with commit 8d22bb9 Jul 28, 2026
27 checks passed
ANcpLua added a commit to ANcpLua/TUnit-1.61.38 that referenced this pull request Jul 30, 2026
…contained copy

Alex restored the two Anthropic-backed live tests (Responses render, session
continuity) alongside the upstream microsoft/agent-framework#7362 copy.
Build clean; suite 12 tests: 10 pass, 2 live tests skip without ANTHROPIC_API_KEY.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants