This repo includes an agentic workflow for generating node-graphs for the workflow automation app, Magpai. But, the ideas presented here should be applicable to other node graph building apps like ComfyUI, Zapier, etc.
For a high level overview of the project I've recorded a video explaining the process.
This repo includes a subset of the nodes/functions and workflows available in Magpai so you have an idea of how this setup works.
You can run the jupyter notebook to install the requirements or:
pip install dotenv
pip install pydantic
pip install claudette
pip install gradio
pip install anthropic
pip install toolslm
You’ll need to set the ANTHROPIC_API_KEY
environment variable to the key provided to you by Anthropic in order to use this library.
I've used Claudette which is wrapper for Anthropic's python SDK. I'd suggest reading through their excellent documentation to understand how requests, system prompts, tool calling and streaming is handled.
The notebook has headings to help you navigate the code. You should be able to run all the cells in order to launch the gradio chat interface.
I'd suggest running all the cells and then when you want to iterate on the agent and chat interface:
- Run the
GraphAgent
class cell. - Instantiate the agent -
graph_agent = GraphAgent(...)
- Run the Gradio cell to start the chat interface.
- When you're finished testing or want to make changes stop the gradio server -
demo.close()