π¦πΈοΈ Using Composio With LangGraph
Integrate Composio with LangGraph Agentic workfows & enable them to interact seamlessly with external apps, enhancing their functionality and reach.
Composio enables your LangGraph agents to connect with many tools!
Goal: Star a repository on GitHub using natural language commands through a LangGraph Agent.
Install Packages & Connect a Tool
Ensure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.
Goal: Use LangGraph Agent to Interact with Github using Composio
Connect GitHub account
- Connect user
Jessica
GitHub account to allow your agents to utilize GitHub functionalities.
Import Base Packages
- Prepare your environment by initializing necessary imports from LangGraph & LangChain for setting up your agent.
Fetch GitHub LangGraph Tools via Composio
- Access GitHub tools provided by Composio for LangGraph, initialize a
ToolNode
with necessary tools obtained fromComposioToolSet
.
Prepare the model
- Initialize the LLM class and bind obtained functions to the model.
Define the Graph Nodes
- LangGraph expects you to define different nodes of the agentic workflow as separate functions.
Define the Graph Nodes and Edges
-
We begin by initializing the workflow with
agent
andtools
nodes, followed by specifying the connecting edges between nodes, finally compiling the workflow. -
These edges can be straightforward or conditional, depending on the workflow requirements.
Invoke & Check Response
- After the compilation of workflow, we invoke the LLM with a task, and stream the response.