Registry / llm-agents / composio-langchain

composio-langchain

JSON →
library0.13.1pypypi✓ verified 88d ago

Composio-langchain integrates Composio's extensive library of AI tools with LangChain agents, enabling LLMs to interact with a wide range of external applications. Currently at version 0.11.5, the library is actively maintained with frequent updates, often aligning with LangChain's own rapid release cycle.

pip install composio-langchain
INSTALL
IMPORT
SIG · COMPOSIO-LANGCHAIN
C
composio-langchain
llm-agentspythonv0.13.1
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.13.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
4/8 runs
4/8 runs
py 3.11
4/8 runs
4/8 runs
py 3.12
4/8 runs
4/8 runs
py 3.13
4/8 runs
4/8 runs
py 3.9
4/8 runs
4/8 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LangchainProvider
✓ from composio_langchain import LangchainProvider
✗ from composio_langchain import ComposioToolkit
provider
✓ from composio_langchain import provider
✗ from composio_langchain import ComposioToolkit

This quickstart demonstrates how to integrate Composio tools with a LangChain agent using OpenAI's LLM. It initializes the `ComposioToolkit`, creates an OpenAI tools agent with the retrieved tools, and then executes a task that leverages one of the installed Composio tools. Requires `COMPOSIO_API_KEY` and `OPENAI_API_KEY` and prior installation of Composio toolkits via the Composio CLI.

import os from composio_langchain import ComposioToolkit from langchain.agents import AgentExecutor, create_openai_tools_agent from langchain_openai import ChatOpenAI from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder # Ensure you have your API keys set as environment variables # export COMPOSIO_API_KEY="your_composio_api_key" # export OPENAI_API_KEY="your_openai_api_key" # NOTE: You must install toolkits via Composio CLI first: # pip install composio-cli # composio install google_sheets # Example: install a specific toolkit if not os.environ.get("COMPOSIO_API_KEY") or not os.environ.get("OPENAI_API_KEY"): print("Please set COMPOSIO_API_KEY and OPENAI_API_KEY environment variables.") exit() # Initialize the Composio toolkit toolkit = ComposioToolkit() # Initialize the LLM llm = ChatOpenAI(temperature=0, model="gpt-4", openai_api_key=os.environ.get("OPENAI_API_KEY", "")) # Define the agent prompt prompt = ChatPromptTemplate.from_messages( [ ("system", "You are a helpful assistant with access to Composio tools."), MessagesPlaceholder("chat_history", optional=True), ("human", "{input}"), MessagesPlaceholder("agent_scratchpad"), ] ) # Create the agent with Composio tools agent = create_openai_tools_agent(llm, toolkit.get_tools(), prompt) # Create the agent executor agent_executor = AgentExecutor(agent=agent, tools=toolkit.get_tools(), verbose=True) # Invoke the agent with a task that uses a Composio tool (e.g., Google Sheets) # Ensure 'google_sheets' toolkit is installed via 'composio install google_sheets' result = agent_executor.invoke({"input": "Create a new Google Sheet named 'Monthly Report 2024'."}) print(result["output"])
Debug
Known issues
breakingComposio has a hard dependency on LangChain's 0.1.x series and above (using `langchain_core`). If you are using an older version of LangChain (e.g., 0.0.x), this library will not be compatible.
fix
Upgrade your LangChain installation to `langchain>=0.1.0` and `langchain_core>=0.1.0`.
affects: <0.1.0
gotchaComposio tools are not automatically available. You must first install them using the `composio-cli` (e.g., `composio install google_sheets`). Attempting to use a tool that hasn't been installed will result in a runtime error.
fix
Install the required `composio-cli` (`pip install composio-cli`) and then install the desired toolkits using `composio install <toolkit_name>`.
affects: All
gotchaThe `COMPOSIO_API_KEY` environment variable is mandatory for `ComposioToolkit` to function correctly. Without it, tool discovery and execution will fail.
fix
Set the `COMPOSIO_API_KEY` environment variable with your Composio API key before initializing `ComposioToolkit`.
affects: All
gotchaTo get the list of tools, you must call the `get_tools()` method on the `ComposioToolkit` instance. Directly accessing `toolkit.tools` is not the correct interface.
fix
Use `toolkit.get_tools()` when passing tools to your LangChain agent or executor.
affects: All
Upgrade
Version history
0.13.1latest on PyPI · released May 14, 2026
Audit
Dependencies
langchain_corerequiredFundamental LangChain components for agent and tool orchestration.
composio-pyrequiredThe core Python SDK for Composio, providing access to its tool registry.
langchainrequiredProvides higher-level LangChain constructs like agents.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
composio-langchain — pip install composio-langchain · libregistry