Skip to content

The agent engineering platform.

fix(anthropic): update integration tests (#35396)

ccurme2fa460d325d0
diff --git a/libs/partners/anthropic/tests/cassettes/test_agent_loop.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_agent_loop.yaml.gz
index 5bba3864cd..facb0e335c 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_agent_loop.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_agent_loop.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_agent_loop_streaming.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_agent_loop_streaming.yaml.gz
index 7dc728333b..cdda77a3dc 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_agent_loop_streaming.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_agent_loop_streaming.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_citations.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_citations.yaml.gz
index dd957413da..72ed6e1965 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_citations.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_citations.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_code_execution.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_code_execution.yaml.gz
index dd71c3d67e..01285d5648 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_code_execution.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_code_execution.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_code_execution_old.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_code_execution_old.yaml.gz
new file mode 100644
index 0000000000..f5c4dcb809
Binary files /dev/null and b/libs/partners/anthropic/tests/cassettes/test_code_execution_old.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_code_execution_old[v0].yaml.gz b/libs/partners/anthropic/tests/cassettes/test_code_execution_old[v0].yaml.gz
deleted file mode 100644
index f3e5eab068..0000000000
Binary files a/libs/partners/anthropic/tests/cassettes/test_code_execution_old[v0].yaml.gz and /dev/null differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_code_execution_old[v1].yaml.gz b/libs/partners/anthropic/tests/cassettes/test_code_execution_old[v1].yaml.gz
deleted file mode 100644
index 56bf786f3d..0000000000
Binary files a/libs/partners/anthropic/tests/cassettes/test_code_execution_old[v1].yaml.gz and /dev/null differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_search_result_tool_message.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_search_result_tool_message.yaml.gz
index 4f80f56903..416277a2cd 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_search_result_tool_message.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_search_result_tool_message.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_web_fetch.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_web_fetch.yaml.gz
index a9a0a51b9b..48db86a79c 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_web_fetch.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_web_fetch.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_web_fetch_v1.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_web_fetch_v1.yaml.gz
index a2a4679c15..2b33be19dd 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_web_fetch_v1.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_web_fetch_v1.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/cassettes/test_web_search.yaml.gz b/libs/partners/anthropic/tests/cassettes/test_web_search.yaml.gz
index e8e4dea5bf..a9186820fc 100644
Binary files a/libs/partners/anthropic/tests/cassettes/test_web_search.yaml.gz and b/libs/partners/anthropic/tests/cassettes/test_web_search.yaml.gz differ
diff --git a/libs/partners/anthropic/tests/integration_tests/test_chat_models.py b/libs/partners/anthropic/tests/integration_tests/test_chat_models.py
index 74b624a94c..899f1f4a46 100644
--- a/libs/partners/anthropic/tests/integration_tests/test_chat_models.py
+++ b/libs/partners/anthropic/tests/integration_tests/test_chat_models.py
@@ -486,14 +486,7 @@ def test_tool_use() -> None:
assert content_blocks[1]["args"] == tool_call["args"]
# Test streaming
- llm = ChatAnthropic(
- model="claude-sonnet-4-5-20250929", # type: ignore[call-arg]
- temperature=0,
- # Add extra headers to also test token-efficient tools
- model_kwargs={
- "extra_headers": {"anthropic-beta": "token-efficient-tools-2025-02-19"},
- },
- )
+ llm = ChatAnthropic(model="claude-sonnet-4-5-20250929") # type: ignore[call-arg]
llm_with_tools = llm.bind_tools([tool_definition])
first = True
chunks: list[BaseMessage | BaseMessageChunk] = []
@@ -535,15 +528,6 @@ def test_tool_use() -> None:
assert content_blocks[1]["name"] == "get_weather"
assert content_blocks[1]["args"]
- # Testing token-efficient tools
- # https://platform.claude.com/docs/en/agents-and-tools/tool-use/token-efficient-tool-use
- assert gathered.usage_metadata
- assert response.usage_metadata
- assert (
- gathered.usage_metadata["total_tokens"]
- < response.usage_metadata["total_tokens"]
- )
-
# Test passing response back to model
stream = llm_with_tools.stream(
[
@@ -1654,6 +1638,7 @@ def test_web_fetch_v1(output_version: Literal["v0", "v1"]) -> None:
)
[email protected]_cassette("test_code_execution_old.yaml.gz")
@pytest.mark.vcr
@pytest.mark.parametrize("output_version", ["v0", "v1"])
def test_code_execution_old(output_version: Literal["v0", "v1"]) -> None:
@@ -1752,7 +1737,6 @@ def test_code_execution(output_version: Literal["v0", "v1"]) -> None:
assert block_types == {
"text",
"server_tool_use",
- "text_editor_code_execution_tool_result",
"bash_code_execution_tool_result",
}
else:
@@ -1770,7 +1754,6 @@ def test_code_execution(output_version: Literal["v0", "v1"]) -> None:
assert block_types == {
"text",
"server_tool_use",
- "text_editor_code_execution_tool_result",
"bash_code_execution_tool_result",
}
else: