Python: Fixed Anthropic and GitHub Copilot samples#4025
Merged
eavanvalkenburg merged 9 commits intomicrosoft:mainfrom Feb 18, 2026
Merged
Python: Fixed Anthropic and GitHub Copilot samples#4025eavanvalkenburg merged 9 commits intomicrosoft:mainfrom
eavanvalkenburg merged 9 commits intomicrosoft:mainfrom
Conversation
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes several issues in Python samples and improves Anthropic client functionality to enhance session management, correct API usage, and add support for new Anthropic API features.
Changes:
- Fixed
BaseAgent.create_session()to forwardservice_session_idparameter, enabling proper session resumption in ClaudeAgent and GitHubCopilotAgent samples - Corrected custom agent sample to use string literal
"assistant"instead of invalidRole.ASSISTANTenum usage and fixed session state key to useInMemoryHistoryProvider.DEFAULT_SOURCE_ID - Enhanced Anthropic client with MCP tool call/result message preparation, signature support for thinking blocks, and name parameter for hosted tools
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
python/packages/core/agent_framework/_agents.py |
Added service_session_id parameter forwarding in BaseAgent.create_session() to enable session resumption |
python/samples/02-agents/providers/custom/custom_agent.py |
Fixed invalid Role.ASSISTANT usage to "assistant" string and corrected session state key to use InMemoryHistoryProvider.DEFAULT_SOURCE_ID |
python/samples/02-agents/providers/anthropic/anthropic_skills.py |
Reduced token budgets and slide count for faster sample execution |
python/samples/02-agents/providers/anthropic/anthropic_claude_with_shell.py |
Changed query to list .md files instead of .py files for more meaningful output |
python/samples/02-agents/providers/anthropic/anthropic_advanced.py |
Added null check for content.text before printing reasoning to handle signature-only deltas |
python/packages/anthropic/agent_framework_anthropic/_chat_client.py |
Added MCP tool call/result preparation, signature support for thinking blocks, name parameter for hosted tools, and improved streaming delta handling |
python/packages/anthropic/tests/test_anthropic_client.py |
Added tests for signature handling in thinking blocks, signature_delta parsing, and name parameter in hosted tools |
python/packages/core/agent_framework/_types.py |
Formatting change to simplify tools type annotation |
python/samples/04-hosting/azure_functions/12_workflow_hitl/function_app.py |
Reordered imports alphabetically |
eavanvalkenburg
requested changes
Feb 18, 2026
TaoChenOSU
approved these changes
Feb 18, 2026
eavanvalkenburg
approved these changes
Feb 18, 2026
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.
Motivation and Context
Contribution Checklist