← Back to Home

Documentation

AgentGraph Kit is a production-ready SaaS boilerplate for building AI-powered multi-agent applications. Built with FastAPI (LangGraph Supervisor pattern), Next.js 14, Supabase, and integrated with Clerk authentication and Stripe payments.

Core Stack: LangGraph, FastAPI, Next.js 14, Supabase, Pinecone

Setup Guide

Follow these steps to get your agent application running in minutes.

1. Clone & Configure

git clone https://github.com/your-org/agentgraph-kit.git
cd agentgraph-kit

# Backend
cp backend/.env.example backend/.env

# Frontend
cp frontend/.env.example frontend/.env.local

2. Required Environment Variables

You need API keys for the following services:

  • OpenAI (LLM & Embeddings)
  • Tavily (Web Search)
  • Supabase (Database)
  • Pinecone (Vector DB)

Agent Architecture

We use the Supervisor Pattern where a central LLM router (GPT-4o) decides which specialized worker to call.

USER_MESSAGE ↓ SUPERVISOR NODE (Router) │ ├──► RESEARCHER (Tavily Web Search) │ ├──► RAG SPECIALIST (Pinecone Vector Search) │ └──► FINALIZE (Response Synthesis)

Adding a New Agent

To register a new worker capability:

  1. Create the agent function in backend/app/agents/workflow.py
  2. Add the tool definition
  3. Register the node in the LangGraph workflow:
workflow.add_node("MyNewAgent", create_my_agent())
workflow.add_edge("MyNewAgent", "supervisor")

Database Schema

Supabase (PostgreSQL) is used for persistence. The boilerplate includes 3 main tables:

users

ColumnTypeDesc
idTEXTClerk User ID (PK)
creditsINTBalance

Tools & RAG

RAG Pipeline

Documents are uploaded, chunked (1000 chars), embedded with text-embedding-3-small, and stored in Pinecone.

Defined Tools

  • rag_search: Queries Pinecone for similar vectors.
  • tavily_search: Performs live web searches.

Stripe Configuration

Webhooks handle credit top-ups automatically.

Running Locally: Use the Stripe CLI to forward webhooks to localhost:8000/api/webhook/stripe.

# Production Webhook Endpoint
https://your-domain.com/api/webhook/stripe