Skip to main content

Type-Safe get_tools() for Python SDK

The Python SDK’s Composio class is now generic over the provider type. When you pass a provider to Composio(), the return type of tools.get() is automatically inferred based on that provider.

SDK Versions

What Changed

Before: The return type of tools.get() was always untyped or required manual type annotations. After: Type checkers (mypy, Pyright) automatically infer the correct tool type from the provider you pass. Before (untyped):
After (type-safe):

Automatic Type Inference

The Composio class now uses Python generics to provide type-safe return values:

Custom Provider Support

Custom providers automatically get proper type inference without requiring any changes to the Composio SDK:

Supported Providers

Type inference is supported for all built-in providers:

Backward Compatibility

This change is fully backward compatible:
  • Existing code continues to work without modifications
  • Type inference is opt-in via static type checkers
  • No runtime behavior changes
  • No migration required