Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Integrate Composio with LangChain agents to let them seamlessly interact with external apps
Install Packages
pip install composio-langchain langchain_openai
Import Libraries & Initialize ComposioToolSet & LLM
from langchain.agents import create_openai_functions_agent, AgentExecutor from langchain import hub from langchain_openai import ChatOpenAI from composio_langchain import ComposioToolSet, App llm = ChatOpenAI() composio_toolset = ComposioToolSet()
Connect Your GitHub Account
composio login composio add github
COMPOSIO_API_KEY
OPENAI_API_KEY
Get All GitHub Tools
tools = composio_toolset.get_tools(apps=[App.GITHUB])
Define the Agent
prompt = hub.pull("hwchase17/openai-functions-agent") agent = create_openai_functions_agent(llm, tools, prompt) agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
Execute the Agent
task = "Star a repo composiohq/composio on GitHub" agent_executor.invoke({"input": task})
Was this page helpful?