Repository navigation
Updated Claude Python to use A365 oservability SDK and MCP tooling - #148
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the Claude Python sample to use the Agent 365 Observability SDK directly (matching the OpenAI Python sample pattern) and removes configuration complexity by eliminating environment variable flags like ENABLE_OBSERVABILITY and USE_AGENTIC_AUTH. The migration simplifies the codebase by removing the observability_helpers.py abstraction layer and adopting a direct SDK configuration approach.
Changes:
- Removed
observability_helpers.pyand optional observability import patterns, replacing them with direct SDK usage viaconfigure()method - Added
auth_handler_nameparameter to agent methods (process_user_messageandhandle_agent_notification_activity) to eliminate hardcoded auth handler strings - Integrated optional MCP tooling support with graceful fallback for enterprise M365 tool integration
- Updated dependencies to include
microsoft_agents_a365_toolingand reorganized package specifications inpyproject.toml - Simplified
.env.templateby removingENABLE_OBSERVABILITYandUSE_AGENTIC_AUTHflags - Added
BaggageBuildercontext propagation in message handlers for proper observability tracing
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updated project description, added authors section, and reorganized dependencies to include MCP tooling and observability packages |
| observability_helpers.py | Deleted entire helper file as observability now uses SDK directly |
| host_agent_server.py | Added auth_handler_name property, integrated BaggageBuilder context in message handler, updated token caching to use auth handler name, and removed conditional observability configuration |
| agent.py | Added _setup_observability() and token_resolver() methods, integrated optional MCP tooling, updated method signatures to accept auth_handler_name, removed manual scope creation code |
| .env.template | Removed ENABLE_OBSERVABILITY and USE_AGENTIC_AUTH flags, updated observability configuration comments |
@microsoft-github-policy-service agree company="Microsoft" |
Rahul Devikar (rahuldevikar761)
left a comment
There was a problem hiding this comment.
Looks good. Seems Julio has already looked at it from Obs point of view. Thanks for updating the Sample
ae6e26c
…age- Initialize SDK once at module load to prevent duplicate configurations- Add flag to track initialization state
Nikhil Navakiran (nikhilNava)
left a comment
There was a problem hiding this comment.
Please consider fixing these in a follow up PR
Migrate Claude Python Sample to Observability SDK and Remove Configuration Flags
Summary
Migrates Claude Python sample to use Observability SDK directly (matching OpenAI Python sample) and addresses previous PR feedback by removing hardcoded auth handler names and configuration flags.
**Key Changes
Removed:**
❌ ENABLE_OBSERVABILITY and USE_AGENTIC_AUTH environment variable flags
❌ observability_helpers.py file (replaced by direct SDK usage)
❌ OBSERVABILITY_AVAILABLE and NOTIFICATIONS_AVAILABLE optional import flags
❌ Hardcoded "AGENTIC" auth handler strings
❌ Manual InvokeAgentScope and InferenceScope creation
Added:
✅ _setup_observability() method with configure() pattern (like OpenAI sample)
✅ token_resolver() method for Agent 365 Observability exporter
✅ self.auth_handler_name as configurable property
✅ BaggageBuilder context in message handlers
✅ auth_handler_name parameter to agent methods
Updated:
Method signatures: process_user_message() and handle_agent_notification_activity() now accept auth_handler_name
Dependencies: Added microsoft_agents_a365_tooling for MCP support
.env.template: Simplified observability configuration
Addresses PR Feedback
✅ Removed USE_AGENTIC_AUTH env var - auth type determined by SDK config
✅ No hardcoded auth handler names - uses configurable property
✅ Notifications always imported (not optional)
✅ Auth handler ID properly passed to exchange_token()
Breaking Changes
ENABLE_OBSERVABILITY and USE_AGENTIC_AUTH env vars no longer used
process_user_message() and handle_agent_notification_activity() signatures changed
observability_helpers.py removed
Testing
Test with agentic auth, bearer token, and client credentials
Verify observability traces generated correctly
Test notifications (email, Word @mentions)
Test with Agents Playground and Teams