MCPAdapter, follow the Python MCP research agent example. It connects to a hosted session endpoint and includes setup, execution, and cleanup.
- LangChain
- LangGraph
The LangChain provider transforms each Composio tool into a LangChain
DynamicStructuredTool with built-in execution. You can hand the tools to create_agent in Python or wire them into a graph node in TypeScript, and the framework runs the tool loop for you.1
Install
Install
- Python
- TypeScript
2
Configure API Keys
Configure API Keys
Set
COMPOSIO_API_KEY with your API key from Settings and OPENAI_API_KEY with your OpenAI API key..env
3
Create session and run
Create session and run
- Python
- TypeScript
Python argument validation
The Python LangChain and LangGraph providers build a Pydantic argument model from each tool’s JSON Schema. Object arguments that declare no properties accept and preserve arbitrary nested keys. For objects that declare named properties, undeclared keys are rejected unless the schema allows them withadditionalProperties.
Schemas that use patternProperties or schema-valued additionalProperties validate dynamic keys before execution. The providers also preserve whether an optional argument was omitted or explicitly set to None. By default, declared defaults are included, while optional arguments without defaults stay absent. Set schema_config={"skip_defaults": True} when creating the provider to leave declared defaults absent too.
When validation fails, the tool does not run. LangChain surfaces the failure as a tool error observation so the agent can correct its arguments and retry.