Custom Providers
This guide provides a comprehensive walkthrough of creating custom providers for the Composio SDK, enabling 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
- Tool Execution: Managing the flow of tool execution and results
- 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)
- Agentic Providers: Transform tools for platforms that have their own agency (e.g., LangChain, AutoGPT)
Provider Class Hierarchy
Creating a Non-Agentic Provider
Non-agentic providers implement the BaseNonAgenticProvider
abstract class:
Creating an Agentic Provider
Agentic providers implement the BaseAgenticProvider
abstract class:
Using Your Custom Provider
After creating your provider, use it with the Composio SDK:
Provider State and Context
Your provider can maintain state and context:
Advanced: Provider Composition
You can compose functionality by extending existing providers:
Example: Anthropic Claude Provider
Here’s a more complete example for Anthropic’s Claude:
Example: LangChain Provider
Here’s an example for LangChain:
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
- Optimize for performance: Cache transformed tools when possible
- Add helper methods: Provide convenient methods for common platform-specific operations
- Provide clear documentation: Document your provider’s unique features and usage
- Use telemetry: Set a meaningful provider name for telemetry insights