MCPcopy
hub / github.com/ComposioHQ/composio / Composio

Class Composio

python/composio/sdk.py:49–241  ·  view source on GitHub ↗

Composio SDK for Python. Generic parameters: TTool: The individual tool type returned by the provider (e.g., ChatCompletionToolParam for OpenAI). TToolCollection: The collection type returned by get_tools (e.g., list[ChatCompletionToolParam]). The generic types are aut

Source from the content-addressed store, hash-verified

47
48
49class Composio(t.Generic[TTool, TToolCollection], WithLogger):
50 """
51 Composio SDK for Python.
52
53 Generic parameters:
54 TTool: The individual tool type returned by the provider (e.g., ChatCompletionToolParam for OpenAI).
55 TToolCollection: The collection type returned by get_tools (e.g., list[ChatCompletionToolParam]).
56
57 The generic types are automatically inferred from the provider passed to __init__.
58 When no provider is passed, defaults to OpenAI types.
59
60 Examples:
61 # Implicit type inference - recommended
62 composio = Composio(provider=OpenAIProvider()) # Composio[OpenAITool, list[OpenAITool]]
63 composio = Composio(provider=AnthropicProvider()) # Composio[ToolParam, list[ToolParam]]
64 composio = Composio() # Composio[OpenAITool, list[OpenAITool]] (default)
65
66 # Custom provider - types are inferred automatically
67 composio = Composio(provider=MyCustomProvider()) # Composio[MyTool, list[MyTool]]
68 """
69
70 tools: "Tools[TTool, TToolCollection]"
71
72 @t.overload
73 def __init__(
74 self: "Composio[OpenAITool, OpenAIToolCollection]",
75 provider: None = None,
76 **kwargs: te.Unpack[SDKConfig],
77 ) -> None:
78 """Initialize with default OpenAI provider."""
79 ...
80
81 @t.overload
82 def __init__(
83 self,
84 provider: BaseProvider[TTool, TToolCollection],
85 **kwargs: te.Unpack[SDKConfig],
86 ) -> None:
87 """Initialize with an explicit provider. Types are inferred from the provider."""
88 ...
89
90 def __init__(
91 self,
92 provider: t.Optional[BaseProvider[t.Any, t.Any]] = None,
93 **kwargs: te.Unpack[SDKConfig],
94 ) -> None:
95 """
96 Initialize the Composio SDK.
97
98 :param provider: The provider to use for the SDK. Defaults to OpenAIProvider.
99 :param environment: The environment to use for the SDK.
100 :param api_key: The API key to use for the SDK.
101 :param base_url: The base URL to use for the SDK.
102 :param timeout: The timeout to use for the SDK.
103 :param max_retries: The maximum number of retries to use for the SDK.
104 :param toolkit_versions: A dictionary mapping toolkit names to specific versions:
105 - A dictionary mapping toolkit names to specific versions
106 - A string (e.g., 'latest', '20250906_01') to use the same version for all toolkits

Callers 15

gemini_demo.pyFile · 0.90
google_adk_demo.pyFile · 0.90
langgraph_demo.pyFile · 0.90
llamaindex_demo.pyFile · 0.90
mainFunction · 0.90
anthropic_demo.pyFile · 0.90
mainFunction · 0.90
google_demo.pyFile · 0.90
openai_demo.pyFile · 0.90

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…