Skip to content

Python: fix anthropic code interpreter tool repr#2244

Merged
eavanvalkenburg merged 6 commits intomicrosoft:mainfrom
eavanvalkenburg:fix_anthropic_code
Nov 17, 2025
Merged

Python: fix anthropic code interpreter tool repr#2244
eavanvalkenburg merged 6 commits intomicrosoft:mainfrom
eavanvalkenburg:fix_anthropic_code

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Nov 15, 2025

Motivation and Context

Fixes anthropic code interpreter tool representation
Adds a sample demonstrating skills
Adds integration test for all hosted tools.

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the Anthropic code interpreter tool representation by correcting the tool name from "code_interpreter" to "code_execution" to align with Anthropic's API requirements. It also adds comprehensive integration tests for all hosted tools (web search, code interpreter, and MCP).

  • Fixed the name field for HostedCodeInterpreterTool in Anthropic's tool conversion from "code_interpreter" to "code_execution"
  • Added integration test test_anthropic_client_integration_hosted_tools to verify hosted tools functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
python/packages/anthropic/agent_framework_anthropic/_chat_client.py Updates the name field for code interpreter tool from "code_interpreter" to "code_execution" to match Anthropic API requirements
python/packages/anthropic/tests/test_anthropic_client.py Adds integration test for hosted tools (web search, code interpreter, MCP)

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Nov 15, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/anthropic/agent_framework_anthropic
   _chat_client.py26110161%234, 255, 293, 297–298, 304–305, 309, 339–340, 349, 351–352, 354, 371–372, 403, 418, 422–423, 469–471, 473, 483–484, 490–492, 496–498, 502–505, 516, 518, 546–548, 558–560, 568, 573–574, 582–584, 587, 595–597, 605–608, 617–628, 631–638, 644–651, 654–664, 667–670
TOTAL14970222685% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2040 130 💤 0 ❌ 0 🔥 38.945s ⏱️

@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Nov 17, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Nov 17, 2025
Merged via the queue into microsoft:main with commit fcc3f1b Nov 17, 2025
24 checks passed
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
* fix anthropic code interpreter tool repr

* fixes

* added skills and sample

* test fix

* add new sample to readme

* fixes tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants