Python custom provider
This guide shows how to create custom providers for the Composio Python SDK. Custom providers enable integration with different AI frameworks and platforms.
Provider architecture
The Composio SDK uses a provider architecture to adapt tools for different AI frameworks. The provider handles:
- Tool format transformation: Converting Composio tools into formats compatible with specific AI platforms
- Platform-specific integration: Providing helper methods for seamless integration
Types of providers
There are two types of providers:
- Non-agentic providers: Transform tools for platforms that don’t have their own agency (e.g., OpenAI, Anthropic)
- Agentic providers: Transform tools for platforms that have their own agency (e.g., LangChain, CrewAI)
Provider class hierarchy
Quick start
The fastest way to create a new provider is using the provider scaffolding script:
This will create a new provider in the specified directory (default: python/providers/<provider-name>/
) with:
- Complete package structure with
pyproject.toml
- Provider implementation template
- Demo script
- README with usage examples
- Type annotations and proper inheritance
The scaffolding script creates a fully functional provider template. You just need to implement the tool transformation logic specific to your platform. You can maintain your provider implementation in your own repository.
Generated structure
The create-provider script generates the following structure:
After generation, you can:
- Navigate to the provider directory:
cd python/providers/<provider-name>
- Install in development mode:
uv pip install -e .
- Implement your provider logic in
composio_<provider-name>/provider.py
- Test with the demo script:
python <provider-name>_demo.py
Creating a non-agentic provider
Non-agentic providers inherit from the NonAgenticProvider
abstract class:
Creating an agentic provider
Agentic providers inherit from the AgenticProvider
abstract class:
Using your custom provider
After creating your provider, use it with the Composio SDK:
Non-agentic provider example
Agentic provider example
Example: Anthropic Claude provider
Here’s a complete example for Anthropic’s Claude:
Example: OpenAI Agents provider
Here’s an example for OpenAI Agents framework:
Best practices
- Keep providers focused: Each provider should integrate with one specific platform
- Handle errors gracefully: Catch and transform errors from tool execution
- Follow platform conventions: Adopt naming and structural conventions of the target platform
- Use type annotations: Leverage Python’s typing system for better IDE support and documentation
- Cache transformed tools: Store transformed tools when appropriate to improve performance
- Add helper methods: Provide convenient methods for common platform-specific operations
- Document your provider: Include docstrings and usage examples
- Set meaningful provider names: Use the name parameter for telemetry and debugging