LangChain
The LangChain provider formats Composio tools for LangChain and LangGraph agents. Pick the tab that matches your setup.
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.
Install
uv add composio composio_langchain langchain langchain_openaiConfigure API Keys
Set COMPOSIO_API_KEY with your API key from Settings and OPENAI_API_KEY with your OpenAI API key.
COMPOSIO_API_KEY=xxxxxxxxx
OPENAI_API_KEY=xxxxxxxxxCreate session and run
from composio import Composio
from composio_langchain import LangchainProvider
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
composio = Composio(provider=LangchainProvider())
llm = ChatOpenAI(model="gpt-5.2")
# Create a session for your user
session = composio.create(user_id="user_123")
tools = session.tools()
agent = create_agent(tools=tools, model=llm)
result = agent.invoke({"messages": [("user", "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'")]})
print(result["messages"][-1].content)Next
What is a session?
How sessions scope users, tools, and auth, and how to reuse them across requests.