-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
Description
SDK Language
Python SDK (composio package)
SDK Version
composio-langgraph=0.10.9
Runtime Environment
Python3.12
Environment
Production Deployment
Describe the Bug
When using the composio-langgraph provider with ToolRouter, calling session.tools() results in a hard crash (TypeError).
The issue occurs during the conversion of a Tool's JSON schema to a Pydantic model. Specifically, when the json_schema_to_model utility encounters a nested object schema (inside an array) that lacks a title or name field, it passes None as the model_name to Pydantic's create_model, which strictly requires a string.
This seems to happen specifically when a tool parameter is a List[Object] where the inner object is anonymous in the schema.
Steps to Reproduce
- pip install composio composio-langgraph
- initialise composio client with LanggraphProvider
- create a session for a user
- get tools using session.tools()
Minimal Reproducible Example
from composio import Composio
from composio_langgraph import LanggraphProvider
client = Composio(provider=LanggraphProvider())
session = client.create(user_id="test-user", toolkits=["slack"])
tools = session.tools() # Crashes hereError Output / Stack Trace
File "/app/.venv/lib/python3.14/site-packages/composio/utils/shared.py", line 194
return create_model(model_name, **field_definitions)
^
model_name is None (should be a string)
File "/app/src/color/agent/tools.py", line 36, in get_tool_router_for_user
tools = session.tools()
File "/app/.venv/lib/python3.14/site-packages/composio/core/models/tool_router.py", line 669, in tools_fn
return t.cast(AgenticProvider, self._provider).wrap_tools(
File "/app/.venv/lib/python3.14/site-packages/composio_langgraph/provider.py", line 93, in wrap_tools
return [self.wrap_tool(tool=tool, execute_tool=execute_tool) for tool in tools]
File "/app/.venv/lib/python3.14/site-packages/composio_langgraph/provider.py", line 69, in wrap_tool
args_schema=json_schema_to_model(
File "/app/.venv/lib/python3.14/site-packages/composio/utils/shared.py", line 187, in json_schema_to_model
updated_name, pydantic_type, pydantic_field = json_schema_to_pydantic_field(
File "/app/.venv/lib/python3.14/site-packages/composio/utils/shared.py", line 140, in json_schema_to_pydantic_field
json_schema_to_pydantic_type(
File "/app/.venv/lib/python3.14/site-packages/composio/utils/shared.py", line 79, in json_schema_to_pydantic_type
ItemType = json_schema_to_pydantic_type(items_schema)
File "/app/.venv/lib/python3.14/site-packages/composio/utils/shared.py", line 86, in json_schema_to_pydantic_type
nested_model = json_schema_to_model(json_schema)
File "/app/.venv/lib/python3.14/site-packages/composio/utils/shared.py", line 194, in json_schema_to_model
return create_model(model_name, **field_definitions) # type: ignore
File "/app/.venv/lib/python3.14/site-packages/pydantic/main.py", line 1809, in create_model
return meta(
File "<frozen abc>", line 106, in __new__
TypeError: type.__new__() argument 1 must be str, not NoneReproducibility
- Always reproducible
- Intermittent / Sometimes
- Happened once, can’t reproduce
Additional Context or Screenshots
No response
Reactions are currently unavailable