{"id":7105,"library":"composio-langchain","title":"Composio LangChain","description":"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.","status":"active","version":"0.11.5","language":"python","source_language":"en","source_url":"https://github.com/ComposioHQ/composio","tags":["langchain","tools","llm","agents","composio","ai"],"install":[{"cmd":"pip install composio-langchain","lang":"bash","label":"Install core library"},{"cmd":"pip install composio-cli","lang":"bash","label":"Install Composio CLI (for tool management)"}],"dependencies":[{"reason":"Fundamental LangChain components for agent and tool orchestration.","package":"langchain_core"},{"reason":"The core Python SDK for Composio, providing access to its tool registry.","package":"composio-py"},{"reason":"Provides higher-level LangChain constructs like agents.","package":"langchain"}],"imports":[{"wrong":"from composio_langchain import ComposioToolkit","symbol":"LangchainProvider","correct":"from composio_langchain import LangchainProvider"},{"wrong":"from composio_langchain import ComposioToolkit","symbol":"provider","correct":"from composio_langchain import provider"}],"quickstart":{"code":"import os\nfrom composio_langchain import ComposioToolkit\nfrom langchain.agents import AgentExecutor, create_openai_tools_agent\nfrom langchain_openai import ChatOpenAI\nfrom langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n\n# Ensure you have your API keys set as environment variables\n# export COMPOSIO_API_KEY=\"your_composio_api_key\"\n# export OPENAI_API_KEY=\"your_openai_api_key\"\n\n# NOTE: You must install toolkits via Composio CLI first:\n# pip install composio-cli\n# composio install google_sheets # Example: install a specific toolkit\n\nif not os.environ.get(\"COMPOSIO_API_KEY\") or not os.environ.get(\"OPENAI_API_KEY\"):\n    print(\"Please set COMPOSIO_API_KEY and OPENAI_API_KEY environment variables.\")\n    exit()\n\n# Initialize the Composio toolkit\ntoolkit = ComposioToolkit()\n\n# Initialize the LLM\nllm = ChatOpenAI(temperature=0, model=\"gpt-4\", openai_api_key=os.environ.get(\"OPENAI_API_KEY\", \"\"))\n\n# Define the agent prompt\nprompt = ChatPromptTemplate.from_messages(\n    [\n        (\"system\", \"You are a helpful assistant with access to Composio tools.\"),\n        MessagesPlaceholder(\"chat_history\", optional=True),\n        (\"human\", \"{input}\"),\n        MessagesPlaceholder(\"agent_scratchpad\"),\n    ]\n)\n\n# Create the agent with Composio tools\nagent = create_openai_tools_agent(llm, toolkit.get_tools(), prompt)\n\n# Create the agent executor\nagent_executor = AgentExecutor(agent=agent, tools=toolkit.get_tools(), verbose=True)\n\n# Invoke the agent with a task that uses a Composio tool (e.g., Google Sheets)\n# Ensure 'google_sheets' toolkit is installed via 'composio install google_sheets'\nresult = agent_executor.invoke({\"input\": \"Create a new Google Sheet named 'Monthly Report 2024'.\"})\nprint(result[\"output\"])","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your LangChain installation to `langchain>=0.1.0` and `langchain_core>=0.1.0`.","message":"Composio 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.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Install the required `composio-cli` (`pip install composio-cli`) and then install the desired toolkits using `composio install <toolkit_name>`.","message":"Composio 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.","severity":"gotcha","affected_versions":"All"},{"fix":"Set the `COMPOSIO_API_KEY` environment variable with your Composio API key before initializing `ComposioToolkit`.","message":"The `COMPOSIO_API_KEY` environment variable is mandatory for `ComposioToolkit` to function correctly. Without it, tool discovery and execution will fail.","severity":"gotcha","affected_versions":"All"},{"fix":"Use `toolkit.get_tools()` when passing tools to your LangChain agent or executor.","message":"To 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'0.11.5':31 'activ':35 'agent':16,52 'ai':12,54 'align':41 'applic':27 'composio':1,4,7,53 'composio-langchain':3 'current':28 'cycl':48 'enabl':17 'extens':9 'extern':26 'frequent':38 'integr':6 'interact':20 'langchain':2,5,15,43,49 'librari':10,33 'llm':51 'llms':18 'maintain':36 'often':40 'rang':24 'rapid':46 'releas':47 'tool':13,50 'updat':39 'version':30 'wide':23","created_at":"2026-04-16T13:43:41.255867+00:00","updated_at":"2026-04-16T13:43:41.255867+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.13.1","cli_name":"","cli_version":null,"type":"library","homepage":"https://composio.dev","github":"https://github.com/ComposioHQ/composio","docs":null,"changelog":null,"pypi":"https://pypi.org/project/composio-langchain/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["llm-agents","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}