Skip to main content

composio-langchain

Adapts Composio tools to LangChain's StructuredTool format so a LangChain agent can call 1000+ apps through a single Composio session.

Installation

pip install composio composio-langchain langchain langchain-openai

Set COMPOSIO_API_KEY (get one from dashboard.composio.dev/settings) and OPENAI_API_KEY in your environment:

export COMPOSIO_API_KEY=xxxxxxxxx
export OPENAI_API_KEY=xxxxxxxxx

Quickstart

Create a session for your user, fetch its tools, and hand them to create_agent. LangChain runs the tool loop; each tool executes itself through Composio.

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")

# Each session is scoped to one of your users
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)

Error handling

Each wrapped tool builds its args_schema from the Composio tool's input schema. When argument validation fails, the tool does not raise; it returns a structured result:

{"successful": False, "error": "<validation message>", "data": None}

Check successful in tool output instead of wrapping calls in try/except.

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

composio_langchain-0.19.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

composio_langchain-0.19.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file composio_langchain-0.19.0.tar.gz.

File metadata

  • Download URL: composio_langchain-0.19.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for composio_langchain-0.19.0.tar.gz
Algorithm Hash digest
SHA256 b6d28f51c2b0a873784123c5185b0d0a18ab0c2f93b5ab618dbe7689896b247d
MD5 25699d14e86aa7476738c68e8022e7ef
BLAKE2b-256 337cca0be0dc970b9076eacf1813249bb68117fe058b98b46444d971e6456e1d

See more details on using hashes here.

File details

Details for the file composio_langchain-0.19.0-py3-none-any.whl.

File metadata

File hashes

Hashes for composio_langchain-0.19.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a5b480d00494ee372572828492937c3bc27e7e693e7200ee8b9fcd78a971e51
MD5 e5a71d04052228c9878f33bee3cfded6
BLAKE2b-256 c0fbba48b92e2ba7a3fe75eac3d388836b1deec2a038b68b9a0ca03cd711bce7

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page