Skip to content

Repository files navigation

AI Agent Builder

A production-ready visual platform for designing, testing, and deploying custom AI agents with zero-code workflow automation


🎯 Project Overview

AI Agent Builder empowers users to create sophisticated AI-powered automation workflows through an intuitive visual interface. Built with modern full-stack architecture, it demonstrates enterprise-level patterns for real-time collaboration, serverless computing, and intelligent agent orchestration. Design complex multi-step workflows with drag-and-drop simplicity, integrate with external APIs, and deploy production-ready AI agentsβ€”all without writing a single line of code.

Author: Abhishek Gurjar β€” GitHub Profile | Portfolio


✨ Core Features

Visual Workflow Engine

  • Drag-and-drop Node Editor - Powered by @xyflow/react for intuitive agent design with smooth interactions
  • Custom Node Library - Pre-built nodes including API calls, conditional logic, loops, approval gates, and data transformations
  • Real-time Canvas - Auto-save functionality and collaborative editing capabilities for team workflows
  • Visual Debugging - Execution path highlighting, error tracking, and step-by-step workflow visualization
  • Node Connections - Smart connection validation ensuring logical workflow structure

Intelligent Agent System

  • LLM Integration - Seamless OpenAI API integration for natural language processing and understanding
  • Multi-step Workflows - Support for complex business logic with branching, loops, and conditional execution
  • API Orchestration - Built-in HTTP client for RESTful API calls with authentication and response handling
  • State Management - Context preservation across workflow execution with variable passing between nodes
  • Dynamic Responses - AI-powered decision making based on workflow context and user inputs

Production Infrastructure

  • Secure Authentication - Via Clerk with SSO, MFA support, and role-based access control
  • Serverless Backend - Using Convex for automatic scaling, zero maintenance, and global edge deployment
  • Real-time Sync - WebSocket-based instant updates across users and devices
  • Type-safe API Layer - End-to-end TypeScript coverage ensuring reliability and catching errors at compile time
  • Rate Limiting - Arcjet integration for security and abuse prevention

Developer Experience

  • Interactive Testing Environment - Live agent preview with mock data and real-time execution
  • Comprehensive Logging - Detailed execution logs for debugging workflow performance
  • Export/Import Workflows - Save workflows as JSON for version control and sharing
  • Responsive UI - Built with Tailwind CSS utility classes for optimal experience across devices
  • Keyboard Shortcuts - Power-user features for rapid workflow development

πŸ› οΈ Technical Architecture

Frontend Stack

Next.js 15 (App Router)     β†’ SSR/SSG hybrid rendering
React 19                    β†’ Modern concurrent features
TypeScript                  β†’ Type safety across codebase
Tailwind CSS                β†’ Utility-first styling
@xyflow/react               β†’ Flow-based visual editor
Lucide React                β†’ Consistent icon system
Recharts                    β†’ Data visualization
React Hook Form             β†’ Form state management
Zod                         β†’ Schema validation

Backend & Services

Convex                      β†’ Real-time serverless functions
Clerk                       β†’ Authentication & user management
OpenAI API                  β†’ LLM-powered intelligence
Arcjet                      β†’ Security & rate limiting

Key Architectural Decisions

Why Next.js App Router? Leverages React Server Components for optimal performance, streaming SSR for faster Time to First Byte (TTFB), and simplified data fetching patterns that reduce client-side JavaScript. The App Router enables powerful server-side capabilities while maintaining excellent client-side interactivity.

Why Convex? Provides automatic real-time subscriptions without complex WebSocket setup, optimistic updates out-of-the-box for instant UI feedback, and eliminates the need for separate REST/GraphQL API layer. Fully typed client-server communication prevents runtime errors and accelerates development.

Why Clerk? Production-ready authentication with zero backend code required, built-in UI components for consistent user experience, and seamless JWT integration with our serverless architecture. Supports social logins, magic links, and enterprise SSO.

Why @xyflow/react? Purpose-built for creating node-based interfaces with excellent performance, extensive customization options, and built-in features like minimap, controls, and background patterns. Superior to building from scratch with canvas APIs.


πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Client Layer                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚ Agent Builderβ”‚  β”‚ Dashboard UI β”‚  β”‚  Auth Pages  β”‚      β”‚
β”‚  β”‚  (@xyflow)   β”‚  β”‚   (Recharts) β”‚  β”‚   (Clerk)    β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β”‚ HTTP/WebSocket
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Next.js API Layer                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚ Agent Chat   β”‚  β”‚ Config Gen   β”‚  β”‚ Webhook API  β”‚      β”‚
β”‚  β”‚   Routes     β”‚  β”‚   Routes     β”‚  β”‚   Routes     β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Convex Backend     β”‚    β”‚   External APIs      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Agents Schema  β”‚  β”‚    β”‚  β”‚  OpenAI API    β”‚  β”‚
β”‚  β”‚ Users Schema   β”‚  β”‚    β”‚  β”‚  Custom APIs   β”‚  β”‚
β”‚  β”‚ Workflows DB   β”‚  β”‚    β”‚  β”‚  Webhooks      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow Architecture

User Action β†’ React Flow Canvas β†’ State Update β†’ Convex Mutation
                                                       ↓
User Feedback ← UI Re-render ← Optimistic Update ← Convex Query
                                                       ↓
                                               Real-time Sync β†’ Other Users

πŸš€ Full-Stack Skills Demonstrated

Frontend Engineering

  • Modern React Patterns - Server Components, Client Components, custom hooks, and context
  • Canvas Interactions - Complex drag-and-drop, node positioning, and connection handling
  • Performance Optimization - Code splitting, lazy loading, memoization, and virtual rendering
  • Advanced UI/UX - Keyboard shortcuts, real-time collaboration, undo/redo functionality
  • State Management - Local state, global state, and optimistic updates

Backend Development

  • Serverless Architecture - Convex functions for scalable, maintainable backend logic
  • Real-time Data - WebSocket connections for instant synchronization
  • API Integrations - External service orchestration and error handling
  • Database Design - Normalized schemas with efficient query patterns
  • Security - Rate limiting, input validation, and authentication

DevOps & Infrastructure

  • Environment Management - Separate dev, staging, and production configurations
  • Security Best Practices - API key management, CORS policies, and authentication flows
  • Deployment Automation - Vercel for frontend, Convex for backend with CI/CD
  • Monitoring - Error tracking and performance monitoring setup

Software Engineering Practices

  • Clean Code - Modular architecture with clear separation of concerns
  • Type Safety - Comprehensive TypeScript usage preventing runtime errors
  • Documentation - Inline comments, README, and API documentation
  • Version Control - Git workflow with meaningful commits and branches
  • Testing Strategy - Unit tests, integration tests, and E2E testing capabilities

πŸ“‚ Project Structure

ai-agent-builder/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/              # Authentication routes
β”‚   β”‚   β”œβ”€β”€ sign-in/         # Sign-in page
β”‚   β”‚   └── sign-up/         # Sign-up page
β”‚   β”œβ”€β”€ agent-builder/       # Main agent builder interface
β”‚   β”‚   └── [agentId]/       # Dynamic agent editing
β”‚   β”œβ”€β”€ api/                 # API routes
β”‚   β”‚   β”œβ”€β”€ agents/          # Agent CRUD operations
β”‚   β”‚   β”œβ”€β”€ execute/         # Workflow execution
β”‚   β”‚   └── webhooks/        # Webhook handlers
β”‚   β”œβ”€β”€ dashboard/           # User dashboard
β”‚   β”œβ”€β”€ provider.tsx         # Context providers
β”‚   β”œβ”€β”€ layout.tsx           # Root layout
β”‚   β”œβ”€β”€ page.tsx             # Landing page
β”‚   └── globals.css          # Global styles
β”œβ”€β”€ convex/
β”‚   β”œβ”€β”€ schema.ts            # Database schema
β”‚   β”œβ”€β”€ agents.ts            # Agent mutations/queries
β”‚   β”œβ”€β”€ workflows.ts         # Workflow logic
β”‚   β”œβ”€β”€ users.ts             # User management
β”‚   └── http.ts              # HTTP actions
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                  # Base UI components
β”‚   β”œβ”€β”€ nodes/               # Custom flow nodes
β”‚   β”œβ”€β”€ builder/             # Builder-specific components
β”‚   └── dashboard/           # Dashboard components
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ convex.ts            # Convex client setup
β”‚   β”œβ”€β”€ utils.ts             # Utility functions
β”‚   β”œβ”€β”€ validation.ts        # Zod schemas
β”‚   └── constants.ts         # App constants
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ images/              # Static images
β”‚   └── icons/               # Icon assets
β”œβ”€β”€ types/
β”‚   β”œβ”€β”€ nodes.ts             # Node type definitions
β”‚   β”œβ”€β”€ workflows.ts         # Workflow types
β”‚   └── index.ts             # Shared types
β”œβ”€β”€ hooks/                   # Custom React hooks
β”œβ”€β”€ .env.example             # Environment template
β”œβ”€β”€ convex.json              # Convex configuration
β”œβ”€β”€ next.config.js           # Next.js configuration
β”œβ”€β”€ tailwind.config.ts       # Tailwind configuration
β”œβ”€β”€ tsconfig.json            # TypeScript configuration
└── package.json             # Dependencies and scripts

πŸ”§ Local Development Setup

Prerequisites

  • Node.js 18.17 or later
  • npm, yarn, or pnpm
  • Git
  • Convex CLI (installed automatically)

Installation Steps

  1. Clone the repository

    git clone https://github.com/abhishekboadgurjar/BuildMyAiAgent.git
    cd BuildMyAiAgent
  2. Install dependencies

    npm install
    # or
    yarn install
    # or
    pnpm install
  3. Setup environment variables

    Create a .env.local file in the root directory:

    # Clerk Authentication
    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
    CLERK_SECRET_KEY=sk_test_...
    NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
    NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
    NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
    NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
    
    # Convex
    CONVEX_DEPLOYMENT=dev:...
    NEXT_PUBLIC_CONVEX_URL=https://....convex.cloud
    
    # OpenAI
    OPENAI_API_KEY=sk-...
    
    # Arcjet (Optional - for rate limiting)
    ARCJET_KEY=ajkey_...
  4. Initialize Convex

    npx convex dev

    This will:

    • Create a new Convex project (if needed)
    • Set up your database schema
    • Start the Convex development server
    • Generate your CONVEX_DEPLOYMENT and NEXT_PUBLIC_CONVEX_URL
  5. Start the Next.js development server

    Open a new terminal window:

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  6. Open your browser

    Navigate to http://localhost:3000

Additional Commands

# Run Convex in development mode
npx convex dev

# Deploy Convex to production
npx convex deploy

# View Convex dashboard
npx convex dashboard

# Build for production
npm run build

# Start production server (after build)
npm run start

# Run TypeScript type checking
npm run type-check

# Lint code
npm run lint

# Format code with Prettier
npm run format

🌐 Deployment Guide

Deploy to Vercel + Convex

Step 1: Deploy Convex Backend

  1. Login to Convex

    npx convex login
  2. Deploy to production

    npx convex deploy --prod

    This creates a production deployment and provides your production URLs.

  3. Set environment variables in Convex

    npx convex env set OPENAI_API_KEY sk-...
    npx convex env set ARCJET_KEY ajkey_...

Step 2: Deploy Next.js to Vercel

  1. Push your code to GitHub

    git add .
    git commit -m "Ready for deployment"
    git push origin main
  2. Connect to Vercel

    • Go to vercel.com
    • Click "New Project"
    • Import your GitHub repository
    • Vercel will auto-detect Next.js
  3. Configure environment variables Add these in Vercel's project settings:

    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_...
    CLERK_SECRET_KEY=sk_live_...
    NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
    NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
    NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
    NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
    CONVEX_DEPLOYMENT=prod:...
    NEXT_PUBLIC_CONVEX_URL=https://....convex.cloud
  4. Deploy

    • Click "Deploy"
    • Vercel builds and deploys your application
    • Future commits to main trigger automatic deployments

Step 3: Configure Production Settings

  1. Update Clerk Settings

    • Add your production URL to allowed origins
    • Configure webhooks if needed
  2. Test Your Deployment

    • Create a test workflow
    • Execute and verify functionality
    • Check real-time sync across devices

🎨 Usage Guide

Creating Your First AI Agent

  1. Sign In

    • Authenticate using Clerk (email, Google, GitHub, etc.)
  2. Create New Agent

    • Click "New Agent" on the dashboard
    • Give your agent a name and description
  3. Build Your Workflow

    • Drag nodes from the sidebar onto the canvas
    • Connect nodes to define execution flow
    • Configure each node with required parameters
  4. Available Node Types

    • Start Node - Entry point for your workflow
    • AI Node - OpenAI integration for intelligent responses
    • API Node - Call external REST APIs
    • Condition Node - Branch logic based on conditions
    • Loop Node - Iterate over data collections
    • Transform Node - Modify and format data
    • Approval Node - Human-in-the-loop checkpoints
    • End Node - Workflow termination points
  5. Test Your Agent

    • Click "Test" to open the preview panel
    • Provide sample inputs
    • Watch execution flow in real-time
    • Review logs for debugging
  6. Deploy & Share

    • Save your workflow (auto-saved continuously)
    • Export as JSON for version control
    • Share with team members

Advanced Features

Keyboard Shortcuts

  • Ctrl/Cmd + S - Save workflow
  • Ctrl/Cmd + Z - Undo
  • Ctrl/Cmd + Y - Redo
  • Delete - Remove selected nodes
  • Ctrl/Cmd + D - Duplicate selected nodes
  • Ctrl/Cmd + A - Select all nodes

Workflow Variables

  • Pass data between nodes using variables
  • Access previous node outputs
  • Store global workflow state

Error Handling

  • Add fallback paths for API failures
  • Configure retry logic
  • Set timeout parameters

🎯 Example Use Cases

Customer Support Automation

Build an agent that:

  1. Receives customer inquiry
  2. Analyzes sentiment with AI
  3. Routes to appropriate department
  4. Sends automated response
  5. Creates ticket in external system

Data Processing Pipeline

Create workflows that:

  1. Fetch data from APIs
  2. Transform and validate
  3. Apply business logic
  4. Store results
  5. Send notifications

Content Moderation

Design agents that:

  1. Receive user-generated content
  2. Analyze with AI for violations
  3. Flag inappropriate content
  4. Notify moderators
  5. Take automated actions

🀝 Contributing

Contributions are welcome! This project follows standard open-source contribution guidelines.

How to Contribute

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Make your changes
    • Follow existing code style
    • Add tests for new features
    • Update documentation
  4. Commit with clear messages
    git commit -m "feat: add amazing feature"
  5. Push to your fork
    git push origin feature/amazing-feature
  6. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Use meaningful variable and function names
  • Write descriptive commit messages (conventional commits)
  • Ensure all tests pass before submitting
  • Update README for significant changes
  • Add JSDoc comments for complex functions

πŸ“Š Performance & Scalability

  • Real-time Updates: < 100ms latency via Convex
  • Workflow Execution: Handles 1000+ concurrent executions
  • Canvas Performance: Smooth 60fps with 100+ nodes
  • Database: Auto-scaling with Convex infrastructure
  • API Rate Limits: Configurable via Arcjet

πŸ”’ Security

  • Authentication: Clerk with JWT tokens
  • Authorization: Role-based access control
  • Rate Limiting: Arcjet protection against abuse
  • Data Encryption: End-to-end encryption for sensitive data
  • API Security: CORS policies and request validation
  • Audit Logs: Track all workflow executions

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“¬ Contact & Support

Abhishek Gurjar

Get Help


πŸ™ Acknowledgments

  • Convex - For revolutionary real-time backend infrastructure
  • Vercel - For seamless deployment and edge network
  • Clerk - For authentication infrastructure
  • @xyflow - For powerful flow-based UI library
  • OpenAI - For cutting-edge AI capabilities
  • Arcjet - For security and rate limiting

πŸ“š Additional Resources


⬆ Back to Top

Made with ❀️ by Abhishek Gurjar

If you find this project helpful, please consider giving it a ⭐️

About

AI Agent Builder empowers users to create sophisticated AI-powered automation workflows through an intuitive visual interface. Built with modern full-stack architecture, it demonstrates enterprise-level patterns for real-time collaboration, serverless computing, and intelligent agent orchestration.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages