@devries-cameron20 / composio-1 / commits / f1fdf7962
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: code formatting

angrybayblade committed Jun 25, 2025 at 09:45 UTC f1fdf7962606928e1e78dba888ce61bd7356458b
30 files changed +42 -153
python/config/mypy.ini
+1 -76
@@ -1,79 +1,4 @@
1 [mypy]
2 strict_optional=True
3 -exclude=apps/composio|utils|\.nox
3 +exclude=apps/composio|utils|\.nox|.*/setup\.py
4 disable_error_code=var-annotated
5 -
6 -[mypy-jsonref.*]
7 -ignore_missing_imports=true
8 -
9 -[mypy-pytest.*]
10 -ignore_missing_imports=true
11 -
12 -[mypy-e2b.*]
13 -ignore_missing_imports=true
14 -
15 -[mypy-boto3.*]
16 -ignore_missing_imports=true
17 -
18 -[mypy-apscheduler.*]
19 -ignore_missing_imports=true
20 -
21 -[mypy-instructor.*]
22 -ignore_missing_imports=true
23 -
24 -[mypy-googleapiclient.*]
25 -ignore_missing_imports=true
26 -
27 -[mypy-botocore.*]
28 -ignore_missing_imports=true
29 -
30 -[mypy-requests_toolbelt.*]
31 -ignore_missing_imports=true
32 -
33 -[mypy-composio_openai.*]
34 -ignore_missing_imports=true
35 -
36 -[mypy-pg8000.*]
37 -ignore_missing_imports=true
38 -
39 -[mypy-e2b_code_interpreter.*]
40 -ignore_missing_imports=true
41 -
42 -[mypy-composio_langgraph.*]
43 -ignore_missing_imports=true
44 -
45 -[mypy-semver.*]
46 -ignore_missing_imports=true
47 -
48 -[mypy-redis.*]
49 -ignore_missing_imports=true
50 -
51 -[mypy-yaml.*]
52 -ignore_missing_imports=true
53 -
54 -[mypy-dateutil.*]
55 -ignore_missing_imports=true
56 -
57 -[mypy-pysher.*]
58 -ignore_missing_imports=true
59 -
60 -[mypy-httpx.*]
61 -ignore_missing_imports=true
62 -
63 -[mypy-openai.*]
64 -ignore_missing_imports=true
65 -
66 -[mypy-pydantic.*]
67 -ignore_missing_imports=true
68 -
69 -[mypy-fastapi.*]
70 -ignore_missing_imports=true
71 -
72 -[mypy-requests.*]
73 -ignore_missing_imports=true
74 -
75 -[mypy-tomli.*]
76 -ignore_missing_imports=true
77 -
78 -[mypy-click.*]
79 -ignore_missing_imports=true
python/noxfile.py
+2 -1
@@ -6,9 +6,10 @@ nox.options.default_venv_backend = "uv"
6
7 modules = [
8 "composio/",
9 + "providers/",
10 + "tests/",
11 "examples/",
12 "scripts/",
11 - "tests/",
13 ]
14
15 ruff = ["ruff", "--config", "config/ruff.toml"]
python/providers/anthropic/anthropic_demo.py
+1 -2
@@ -3,10 +3,9 @@ Anthropic claude demo.7
3 """
4
5 import anthropic
6 -
7 -from composio import Composio
6 from composio_anthropic import AnthropicProvider
7
8 +from composio import Composio
9
10 # Initialize tools.
11 anthropic_client = anthropic.Anthropic()
python/providers/anthropic/composio_anthropic/__init__.py
+1 -4
@@ -1,6 +1,3 @@
1 from composio_anthropic.provider import AnthropicProvider
2
3 -
4 -__all__ = (
5 - "AnthropicProvider",
6 -)
3 +__all__ = ("AnthropicProvider",)
python/providers/anthropic/composio_anthropic/provider.py
+4 -5
@@ -1,10 +1,9 @@
1 import typing as t
2
3 -from anthropic.types.tool_use_block import ToolUseBlock
4 -from anthropic.types.tool_param import ToolParam
5 -from anthropic.types.message import Message as ToolsBetaMessage
3 from anthropic.types.beta.beta_tool_use_block import BetaToolUseBlock
7 -
4 +from anthropic.types.message import Message as ToolsBetaMessage
5 +from anthropic.types.tool_param import ToolParam
6 +from anthropic.types.tool_use_block import ToolUseBlock
7
8 from composio.core.provider import NonAgenticProvider
9 from composio.types import Modifiers, Tool, ToolExecutionResponse
@@ -58,7 +57,7 @@ class AnthropicProvider(
57 """
58 Handle tool calls from Anthropic Claude chat completion object.
59
61 - :param response: Chat completion object from
60 + :param response: Chat completion object from
61 `anthropic.Anthropic.beta.tools.messages.create` function call.
62 :param user_id: User ID to use for executing function calls.
63 :param modifiers: Modifiers to use for executing function calls.
python/providers/anthropic/setup.py
-1
@@ -6,7 +6,6 @@ from pathlib import Path
6
7 from setuptools import setup
8
9 -
9 setup(
10 name="composio_anthropic",
11 version="1.0.0-rc5",
python/providers/crewai/composio_crewai/__init__.py
+1 -1
@@ -1,3 +1,3 @@
1 from composio_crewai.providers import CrewAIProvider
2
3 -__all__ = ("CrewAIProvider",)
\ No newline at end of file
3 +__all__ = ("CrewAIProvider",)
python/providers/crewai/composio_crewai/providers.py
-4
@@ -1,11 +1,8 @@
1 import typing as t
2
3 import pydantic
4 -import pydantic.error_wrappers
5 -import typing_extensions as te
4 from crewai.tools import BaseTool
5
8 -
6 from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
7 from composio.types import Tool
8 from composio.utils.pydantic import parse_pydantic_error
@@ -25,7 +22,6 @@ class CrewAIProvider(AgenticProvider[BaseTool, list[BaseTool]], name="crewai"):
22 """Wrap a tool as a CrewAI tool."""
23
24 class Wrapper(BaseTool):
28 -
25 def _run(self, **kwargs):
26 try:
27 return execute_tool(slug=tool.slug, arguments=kwargs)
python/providers/crewai/crewai_demo.py
+1 -4
@@ -2,14 +2,11 @@
2 CrewAI demo.
3 """
4
5 -import os
6 -
5 +from composio_crewai import CrewAIProvider
6 from crewai import Agent, Crew, Task
7 from langchain_openai import ChatOpenAI
8
9 from composio import Composio
11 -from composio_crewai import CrewAIProvider
12 -
10
11 # Initialize tools.
12 openai_client = ChatOpenAI()
python/providers/crewai/setup.py
+1
@@ -1,6 +1,7 @@
1 """Setup configuration for the composio crewai toolset"""
2
3 from pathlib import Path
4 +
5 from setuptools import setup
6
7 setup(
python/providers/gemini/composio_gemini/__init__.py
+1 -4
@@ -1,6 +1,3 @@
1 from .provider import GeminiProvider
2
3 -
4 -__all__ = (
5 - "GeminiProvider",
6 -)
3 +__all__ = ("GeminiProvider",)
python/providers/gemini/gemini_demo.py
+1 -2
@@ -1,9 +1,8 @@
1 -from composio import Composio
1 from composio_gemini import GeminiProvider
3 -
2 from google import genai
3 from google.genai import types
4
5 +from composio import Composio
6
7 # Create composio client
8 composio = Composio(provider=GeminiProvider())
python/providers/gemini/setup.py
-1
@@ -6,7 +6,6 @@ from pathlib import Path
6
7 from setuptools import setup
8
9 -
9 setup(
10 name="composio_gemini",
11 version="1.0.0-rc5",
python/providers/google/composio_google/__init__.py
+1 -4
@@ -1,6 +1,3 @@
1 from composio_google.provider import GoogleProvider
2
3 -
4 -__all__ = (
5 - "GoogleProvider",
6 -)
3 +__all__ = ("GoogleProvider",)
python/providers/google/composio_google/provider.py
-1
@@ -10,7 +10,6 @@ from vertexai.generative_models import (
10 FunctionDeclaration,
11 GenerationResponse,
12 Part,
13 - Tool,
13 )
14
15 from composio.core.provider import NonAgenticProvider
python/providers/google/google_demo.py
+1 -2
@@ -3,11 +3,10 @@ Google AI Python Gemini demo.
3 """
4
5 import dotenv
6 -
7 -from composio import Composio
6 from composio_google import GoogleProvider
7 from vertexai.generative_models import GenerativeModel
8
9 +from composio import Composio
10
11 # Load environment variables from .env
12 dotenv.load_dotenv()
python/providers/google/setup.py
-1
@@ -6,7 +6,6 @@ from pathlib import Path
6
7 from setuptools import setup
8
9 -
9 setup(
10 name="composio_google",
11 version="1.0.0-rc5",
python/providers/langchain/composio_langchain/__init__.py
+1 -4
@@ -1,6 +1,3 @@
1 from composio_langchain.provider import LangchainProvider
2
3 -
4 -__all__ = (
5 - "LangchainProvider",
6 -)
3 +__all__ = ("LangchainProvider",)
python/providers/langchain/composio_langchain/provider.py
+10 -6
@@ -2,22 +2,21 @@
2
3 import types
4 import typing as t
5 -
5 from inspect import Signature
6
7 import pydantic
8 from langchain_core.tools import StructuredTool as BaseStructuredTool
9
10 +from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
11 +from composio.types import Tool
12 from composio.utils.pydantic import parse_pydantic_error
13 from composio.utils.shared import (
14 get_signature_format_from_schema_params,
15 json_schema_to_model,
16 )
16 -from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
17 -from composio.types import Tool
17
19 -class StructuredTool(BaseStructuredTool):
18
19 +class StructuredTool(BaseStructuredTool):
20 def run(self, *args, **kwargs):
21 try:
22 return super().run(*args, **kwargs)
@@ -25,7 +24,10 @@ class StructuredTool(BaseStructuredTool):
24 return {"successful": False, "error": parse_pydantic_error(e), "data": None}
25
26
28 -class LangchainProvider(AgenticProvider[StructuredTool, t.List[StructuredTool]], name="langchain",):
27 +class LangchainProvider(
28 + AgenticProvider[StructuredTool, t.List[StructuredTool]],
29 + name="langchain",
30 +):
31 """
32 Composio toolset for Langchain framework.
33 """
@@ -57,7 +59,9 @@ class LangchainProvider(AgenticProvider[StructuredTool, t.List[StructuredTool]],
59 action_func.__doc__ = description
60 return action_func
61
60 - def wrap_tool(self, tool: Tool, execute_tool: AgenticProviderExecuteFn) -> StructuredTool:
62 + def wrap_tool(
63 + self, tool: Tool, execute_tool: AgenticProviderExecuteFn
64 + ) -> StructuredTool:
65 """Wraps composio tool as Langchain StructuredTool object."""
66 return t.cast(
67 StructuredTool,
python/providers/langchain/langchain_demo.py
+1 -2
@@ -2,13 +2,12 @@
2 Langchain demo.
3 """
4
5 -from composio import Composio
5 from composio_langchain import LangchainProvider
7 -
6 from langchain import hub # type: ignore
7 from langchain.agents import AgentExecutor, create_openai_functions_agent
8 from langchain_openai import ChatOpenAI
9
10 +from composio import Composio
11
12 # Pull relevant agent model.
13 prompt = hub.pull("hwchase17/openai-functions-agent")
python/providers/langchain/setup.py
-1
@@ -6,7 +6,6 @@ from pathlib import Path
6
7 from setuptools import setup
8
9 -
9 setup(
10 name="composio_langchain",
11 version="1.0.0-rc5",
python/providers/openai/composio_openai/__init__.py
-1
@@ -1,4 +1,3 @@
1 from composio_openai.provider import OpenAIProvider
2
3 -
3 __all__ = ("OpenAIProvider",)
python/providers/openai/composio_openai/provider.py
+1 -1
@@ -4,4 +4,4 @@ OpenAI Provider for composio SDK.
4
5 from composio.core.provider._openai import OpenAIProvider
6
7 -__all__ = ["OpenAIProvider"]
\ No newline at end of file
7 +__all__ = ["OpenAIProvider"]
python/providers/openai/openai_assistant_demo.py
+1 -2
@@ -1,10 +1,9 @@
1 from datetime import datetime
2
3 +from composio_openai import OpenAIProvider
4 from openai import OpenAI
5
6 from composio import Composio
6 -from composio_openai import OpenAIProvider
7 -
7
8 # Initialize tools.
9 openai_client = OpenAI()
python/providers/openai/openai_demo.py
+2 -3
@@ -2,10 +2,10 @@
2 OpenAI demo.
3 """
4
5 -from openai import OpenAI
6 -from composio import Composio
5 from composio_openai import OpenAIProvider
6 +from openai import OpenAI
7
8 +from composio import Composio
9
10 # Initialize tools.
11 openai_client = OpenAI()
@@ -31,4 +31,3 @@ print(response)
31 # Execute the function calls.
32 result = composio.provider.handle_tool_calls(response=response, user_id="default")
33 print(result)
34 -
python/providers/openai/setup.py
-1
@@ -6,7 +6,6 @@ from pathlib import Path
6
7 from setuptools import setup
8
9 -
9 setup(
10 name="composio_openai",
11 version="1.0.0-rc5",
python/providers/openai_agents/composio_openai_agents/__init__.py
+1 -5
@@ -1,7 +1,3 @@
1 from composio_openai_agents.provider import OpenAIAgentsProvider
2
3 -
4 -
5 -__all__ = (
6 - "OpenAIAgentsProvider",
7 -)
3 +__all__ = ("OpenAIAgentsProvider",)
python/providers/openai_agents/composio_openai_agents/provider.py
+7 -12
@@ -1,16 +1,13 @@
1 -import json
1 import asyncio
2 +import json
3 import typing as t
4 -from inspect import Signature
5 -from typing import List, cast
4
5 import pydantic
8 -import pydantic.error_wrappers
9 -from agents import FunctionTool, Tool
6 +from agents import FunctionTool
7
8 +from composio.core.provider import AgenticProvider
9 from composio.core.provider.agentic import AgenticProviderExecuteFn
10 from composio.types import Tool
13 -from composio.core.provider import AgenticProvider
11 from composio.utils.pydantic import parse_pydantic_error
12
13
@@ -21,9 +18,7 @@ def _remove_examples_from_schema(schema_obj: t.Dict[str, t.Any]) -> None:
18 schema, including nested ones. Also ensure that any 'items' object has a 'type' key.
19 """
20 # Handle properties directly
24 - if "properties" in schema_obj and isinstance(
25 - schema_obj["properties"], dict
26 - ):
21 + if "properties" in schema_obj and isinstance(schema_obj["properties"], dict):
22 for _, prop_value in schema_obj["properties"].items():
23 if isinstance(prop_value, dict):
24 # Remove examples, pattern, and default from this property
@@ -35,9 +30,7 @@ def _remove_examples_from_schema(schema_obj: t.Dict[str, t.Any]) -> None:
30 del prop_value["default"]
31
32 # Ensure 'items' has a 'type' key
38 - if "items" in prop_value and isinstance(
39 - prop_value["items"], dict
40 - ):
33 + if "items" in prop_value and isinstance(prop_value["items"], dict):
34 if "type" not in prop_value["items"]:
35 # Default to string type for items if not specified
36 prop_value["items"]["type"] = "string"
@@ -67,6 +60,7 @@ def _remove_examples_from_schema(schema_obj: t.Dict[str, t.Any]) -> None:
60 if isinstance(item, dict):
61 _remove_examples_from_schema(item)
62
63 +
64 class OpenAIAgentsProvider(
65 AgenticProvider[FunctionTool, list[FunctionTool]],
66 name="openai_agents",
@@ -81,6 +75,7 @@ class OpenAIAgentsProvider(
75 execute_tool: AgenticProviderExecuteFn,
76 ) -> FunctionTool:
77 """Wrap a tool as a FunctionTool."""
78 +
79 # Create a function that accepts explicit JSON string for parameters
80 # This avoids the issue with **kwargs in schema validation
81 async def execute_tool_wrapper(_ctx, payload):
python/providers/openai_agents/openai_agents_demo.py
+2 -1
@@ -1,9 +1,9 @@
1 import asyncio
2
3 from agents import Agent, Runner
4 +from composio_openai_agents import OpenAIAgentsProvider
5
6 from composio import Composio
6 -from composio_openai_agents import OpenAIAgentsProvider
7
8 # Initialize Composio toolset
9 composio = Composio(provider=OpenAIAgentsProvider())
@@ -21,6 +21,7 @@ agent = Agent(
21 tools=tools,
22 )
23
24 +
25 # Run the agent
26 async def main():
27 result = await Runner.run(
python/providers/openai_agents/setup.py
-1
@@ -6,7 +6,6 @@ from pathlib import Path
6
7 from setuptools import find_packages, setup
8
9 -
9 setup(
10 name="composio_openai_agents",
11 version="1.0.0-rc5",