Repository navigation
Python: [BREAKING] Reduce core dependencies and simplify optional integrations - #4904
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 3 commits intoMar 25, 2026
Conversation
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
March 25, 2026 14:44
View session
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR slims down the Python agent-framework-core distribution by removing provider/SDK runtime dependencies, making MCP and OpenTelemetry SDK usage fail only when those integrations are invoked, and ensuring agent middleware time is excluded from agent telemetry latency measurements.
Changes:
- Move provider/SDK dependencies out of
agent-framework-coreinto the packages that require them, and refresh repo/dev dependency wiring. - Refactor MCP and observability code paths to use localized runtime imports and improved missing-dependency guidance; add/expand regression tests.
- Change
AgentandFoundryAgentbase-class ordering soAgentMiddlewareLayerwrapsAgentTelemetryLayer, with tests enforcing the MRO.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Updates locked dev/runtime dependencies to reflect moved integrations and removed OTEL semconv-ai dependency. |
| python/pyproject.toml | Adds dev-only dependencies for MCP websocket support and OpenTelemetry SDK. |
| python/packages/lab/pyproject.toml | Adds opentelemetry-sdk to the GAIA extra to keep integration working after core dep slimming. |
| python/packages/foundry/tests/test_foundry_agent.py | Adds a regression test ensuring middleware wraps telemetry in FoundryAgent. |
| python/packages/foundry/agent_framework_foundry/_foundry_agent.py | Reorders base classes to put middleware outside telemetry timing. |
| python/packages/devui/pyproject.toml | Adds opentelemetry-sdk since core no longer depends on it directly. |
| python/packages/core/tests/core/test_optional_dependencies.py | New tests validating optional dependency behavior for OTEL SDK and MCP. |
| python/packages/core/tests/core/test_observability.py | Avoids noisy OTEL exporter setup in tests; adds MRO regression test for Agent. |
| python/packages/core/tests/core/test_mcp.py | Expands MCP parsing/transport tests and updates patch targets to MCP’s runtime import locations. |
| python/packages/core/tests/conftest.py | Adjusts OTEL test fixture to create resources without relying on cached settings state. |
| python/packages/core/pyproject.toml | Removes provider/SDK deps from core; keeps MCP as an optional extra and adds openai package to “all”. |
| python/packages/core/agent_framework/observability.py | Localizes OTEL SDK imports, removes cached resource state, and inlines semantic convention names used by core. |
| python/packages/core/agent_framework/_mcp.py | Localizes MCP imports and refactors helper parsing into instance methods; improves missing-dependency errors. |
| python/packages/core/agent_framework/_agents.py | Localizes MCP server imports and reorders Agent base classes to wrap telemetry with middleware. |
| python/packages/azure-ai/pyproject.toml | Adds Azure Projects/Identity deps to the Azure package after removing them from core. |
Eduard van Valkenburg (eavanvalkenburg)
force-pushed
the
reduce_deps
branch
from
March 25, 2026 15:38
dff25d3 to
065ed45
Compare
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
March 25, 2026 15:38
Dmytro Struk (dmytrostruk)
approved these changes
Mar 25, 2026
Giles Odigwe (giles17)
approved these changes
Mar 25, 2026
Merged
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
Slim down
agent-framework-coreby removing provider- and SDK-specific runtime dependencies, make optional MCP/OpenTelemetry integrations fail only when they are actually used, and keep agent telemetry latency from including agent middleware overhead.Description
agent-framework-core, move direct runtime dependencies to the packages that actually use them (agent-framework-azure-ai,agent-framework-devui, and thegaialab extra), and refresh repo/dev dependency wiringTYPE_CHECKING, updating missing-dependency guidance to point directly tomcp/mcp[ws], and expanding MCP regression coverageAgentMiddlewareLayerwrapsAgentTelemetryLayerfor bothAgentandFoundryAgentContribution Checklist