Skip to content

Export MultiProvider in public API (Fix #1325) #1326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 31, 2025

Conversation

kobol
Copy link
Contributor

@kobol kobol commented Jul 31, 2025

Description

Resolves #1325

This PR addresses the API inconsistency where MultiProvider is used as the default factory for RunConfig.model_provider but is not exported in the public API. The changes include:

  1. Export MultiProvider directly in __init__.py
  2. Maintain backward compatibility while providing more flexibility

Changes Made

1. Export MultiProvider in __init__.py

# Added import
from .models.multi_provider import MultiProvider

# Added to __all__ list
__all__ = [
    # ... existing exports
    "MultiProvider",
    # ...
]

Usage Examples

Before (not possible):

from agents import MultiProvider  # This would fail

After:

# Direct access
from agents import MultiProvider, RunConfig
config = RunConfig(model_provider=MultiProvider(openai_api_key="your-key"))

## Testing

- [x] Verified that MultiProvider can be imported directly
- [x] Verified that existing functionality is not broken

## Related Issue

Fixes #[1325] - MultiProvider not exported in public API but used as default in RunConfig 

- Add MultiProvider to __all__ list in __init__.py
Closes #[1325]
@kobol kobol changed the title Export MultiProvider in public API and add factory function(Fix #1325) Export MultiProvider in public API (Fix #1325) Jul 31, 2025
@seratch seratch merged commit d520535 into openai:main Jul 31, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MultiProvider not exported in public API but used as default in RunConfig
2 participants