Skip to content

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

Intercept httpx2 in the Microsoft Bot's Anthropic endpoint test (#761)

David McKay99a329de54ae
diff --git a/agent-microsoft/tests/test_main.py b/agent-microsoft/tests/test_main.py
index bc0a0337..9063d011 100644
--- a/agent-microsoft/tests/test_main.py
+++ b/agent-microsoft/tests/test_main.py
@@ -191,11 +191,13 @@ def test_an_anthropic_key_uses_the_official_endpoint_when_compose_sets_a_blank_u
seen.append(
(request.url.scheme, request.url.host, request.url.path, request.headers.get("x-api-key"))
)
- async with httpx.ASGITransport(app=provider_app) as local_provider:
+ async with httpx2.ASGITransport(app=provider_app) as local_provider:
return await local_provider.handle_async_request(request)
- # Keep the real framework and Anthropic clients; replace only the network transport.
- monkeypatch.setattr(httpx.AsyncHTTPTransport, "handle_async_request", respond)
+ # Keep the real framework and Anthropic clients; replace only the network transport. The
+ # Anthropic SDK sends through httpx2 (pydantic's fork) since 1.x, not httpx, so that is the
+ # transport to intercept; patching httpx here lets the request reach the real API.
+ monkeypatch.setattr(httpx2.AsyncHTTPTransport, "handle_async_request", respond)
monkeypatch.setenv("MANAGED_AGENT_TOKEN", TOKEN)
monkeypatch.setenv("BOT_PROVIDER", "anthropic")
monkeypatch.setenv("BOT_MODEL", "claude-sonnet-4-5")