Repository navigation
Python: declare the two integration exports the runtime already serves - #10201
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 3 commits intoNov 11, 2026
Conversation
`agent_framework.anthropic` serves RawClaudeAgent and `agent_framework.foundry` serves FoundryAgentOptions through the lazy namespace, but neither stub lists them, so type checkers reject an import that works at runtime. Both names are added to the matching `from ... import` block and to `__all__`.
Hyacinth-of-Security (lxcxjxhx)
temporarily deployed
to
github-app-auth
November 9, 2026 13:36 — with
GitHub Actions
Inactive
Hyacinth-of-Security (lxcxjxhx)
temporarily deployed
to
github-app-auth
November 9, 2026 13:36 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the optional-integration type-stub export updates.
No open issues 🎉
What changed in this PR
Aligns two optional-integration type stubs with exports already available at runtime, allowing type checkers to recognize valid imports.
Changes:
- Adds
RawClaudeAgentto the Anthropic stub’s imports and__all__. - Adds
FoundryAgentOptionsto the Foundry stub’s imports and__all__. - Changes declarations only; runtime behavior remains unchanged.
| File | Description |
|---|---|
python/packages/core/agent_framework/foundry/__init__.pyi |
Declares the existing FoundryAgentOptions export. |
python/packages/core/agent_framework/anthropic/__init__.pyi |
Declares the existing RawClaudeAgent export. |
Review effort: Balanced
Hyacinth-of-Security (lxcxjxhx)
temporarily deployed
to
github-app-auth
November 10, 2026 00:06 — with
GitHub Actions
Inactive
Hyacinth-of-Security (lxcxjxhx)
temporarily deployed
to
github-app-auth
November 10, 2026 08:17 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Nov 11, 2026
This branch was previously deployed
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.
Two optional-integration stubs omit names their runtime already serves, so type checkers reject imports that work.
agent_framework.anthropic:agent_framework.foundry:Both resolve at runtime through
__getattr__, but neither appears in the corresponding__init__.pyi, soty/mypy/pyrightreport them as unknown.RawClaudeAgentis also listed in the module docstring's "Supported classes" and belongs to theagent_framework_claudegroup, which is where the stub's gap shows most clearly:Change
anthropic/__init__.pyi:RawClaudeAgentadded to theagent_framework_claudeimport (the module the runtime maps it to) and to__all__.foundry/__init__.pyi:FoundryAgentOptionsadded to theagent_framework_foundryimport and to__all__.Two files,
+4/−1, no runtime code touched.How these were found
Every
__init__.pyiis compared against its__init__.py, both parsed withast: the stub's symbols are the names in itsfrom … importstatements plus__all__; the runtime's are the keys of_IMPORTSwhen it maps symbol →(module, distribution), or its entries when it is a plain list, plus__all__. Stdlib imports are excluded — without that,from typing import Finalin the core stub is reported as a "stub-only export".After this change the sweep is:
Before it, three names were reported: these two, and that false positive. Every other namespace package under
python/packages/corematches its stub exactly.Run against the parent of #10170, the same comparison reproduces the six names that PR added, so it is known to catch this class rather than merely agreeing with the current state.