Claude python sample - #275
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR modernizes the Claude Python sample agent by aligning configuration and runtime behavior with the Agent 365 SDK, simplifying MCP tool discovery/registration, and updating observability context propagation.
Changes:
- Refactors observability context helpers to use newer SDK models (e.g.,
UserDetails,InvokeAgentScopeDetails) and updated agent identity resolution. - Replaces custom MCP server/tool discovery/execution logic with an SDK-backed discovery wrapper that exposes Claude-compatible MCP config.
- Updates sample configuration and dependencies to use canonical env var keys and normalized package names.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| python/claude/sample-agent/turn_context_utils.py | Updates observability detail builders and agent identity extraction to match newer SDK types. |
| python/claude/sample-agent/pyproject.toml | Renames Agent 365 dependency distributions to dash-separated names and updates comments. |
| python/claude/sample-agent/mcp_tool_registration_service.py | Replaces custom MCP logic with a thin SDK-backed wrapper returning Claude MCP server configs + allowed tool patterns. |
| python/claude/sample-agent/host_agent_server.py | Improves handler robustness, switches agent ID resolution to get_agentic_instance_id(), and reads auth config from canonical CONNECTIONS__... keys. |
| python/claude/sample-agent/agent.py | Simplifies MCP setup to rely on the SDK wrapper; adjusts observability scope construction to new APIs. |
| python/claude/sample-agent/.env.template | Clarifies canonical auth/service-connection env vars and updates MCP/observability knobs. |
| .github/workflows/python-claude-sample.yml | Fixes indentation for import validation step. |
…crosoft/Agent365-Samples into users/gwharris7/claude-python
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Grant Harris (gwharris7)
enabled auto-merge (squash)
April 17, 2026 02:36
Pujarini Mohapatra (biswapm)
approved these changes
Apr 17, 2026
ajmfehr
approved these changes
Apr 17, 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.
Update the Claude python sample to use the SDK, clarify setup, and remove custom code when possible.
This pull request refactors and simplifies the configuration, authentication, and observability setup for the Claude sample agent, aligning environment variables and SDK usage with current best practices. It removes deprecated or redundant configuration options, streamlines MCP (Model Context Protocol) tool discovery, and updates dependencies and code to use canonical sources and naming conventions. The changes also improve error handling and robustness in agent message processing.
Configuration and Environment Variable Refactoring:
.env.templateto remove deprecated MCP and authentication variables, consolidate configuration under canonicalCONNECTIONS__SERVICE_CONNECTION__SETTINGS__*keys, and clarify usage for agentic authentication and observability. Updated connection map and MCP configuration to use double-underscore naming for compatibility. [1] [2]create_auth_configurationto read client credentials from the canonicalCONNECTIONS__SERVICE_CONNECTION__SETTINGS__*environment variables, eliminating duplication and potential misconfiguration.MCP Tooling and Agent Logic Simplification:
agent.pyby removing unused code, unnecessary comments, and redundant tool listing logic. Now relies on the SDK for agent identity resolution and tool registration. [1] [2]host_agent_server.pyto useget_agentic_instance_id()for consistency with the SDK.Observability and Dependency Updates:
pyproject.tomlto use the correct dash-separated format for Agent 365 SDK dependencies. [1] [2] [3]Message Processing and Error Handling Improvements:
These changes collectively modernize the sample agent, reduce configuration errors, and improve maintainability and clarity for future development.