Repository
llamaindex-composio-hackathon-sample
LlamaIndex + Composio Hackathon - Sample Submission
README
LlamaIndex Composio Hackathon Project
A full-stack AI-powered story generation application built with Next.js, LlamaIndex, and Composio. This project combines a modern React frontend with an AI agent backend that can integrate with external services through Composio tools.
🚀 Quick Start
Prerequisites
- Node.js 18+ and pnpm (for frontend)
- Python 3.9-3.13 and uv (for backend agent)
- OpenAI API Key (required)
Installation
-
Clone the repository
git clone <repository-url> cd llamaindex-composio-hackathon -
Install dependencies
# Install frontend dependencies pnpm install # Install backend dependencies npm run install:agent # or manually: cd agent && uv sync -
Set up environment variables (see Environment Variables section below)
-
Run the development server
# Run both frontend and backend concurrently pnpm run dev # Or run them separately: pnpm run dev:ui # Frontend only (http://localhost:3000) pnpm run dev:agent # Backend only (http://localhost:9000)
📋 Environment Variables
Create a .env file in the project root or in the agent/ directory with the following variables:
Required Variables
# OpenAI API Key (Required)
OPENAI_API_KEY=sk-your-openai-api-key-here
Environment File Locations
The application will automatically load environment variables from these locations (in order of precedence):
/.env.local(project root)/.env(project root)/agent/.env.local(agent directory)/agent/.env(agent directory)
🏗️ Project Structure
llamaindex-composio-hackathon/
├── src/ # Next.js frontend
│ ├── app/
│ │ ├── api/copilotkit/ # CopilotKit API endpoint
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Main page
│ └── components/ # React components
│ ├── canvas/ # Canvas-related components
│ └── ui/ # UI components
├── agent/ # Python backend agent
│ ├── agent/
│ │ ├── agent.py # Main agent logic
│ │ ├── prompts.py # System prompts
│ │ └── server.py # FastAPI server
│ └── pyproject.toml # Python dependencies
├── package.json # Node.js dependencies
└── README.md # This file
🛠️ Available Scripts
Frontend (Next.js)
npm run dev:ui # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
Backend (Python Agent)
npm run dev:agent # Start agent development server
npm run install:agent # Install agent dependencies
Combined
npm run dev # Run both frontend and backend
npm run dev:debug # Run with debug logging (LOG_LEVEL=debug)
🤖 How It Works
- Frontend: A Next.js application with a canvas-based story creation interface
- Backend Agent: A LlamaIndex-powered AI agent that:
- Generates stories based on user input
- Provides angle selection for story direction
- Can integrate with external services via Composio tools
- Integration: CopilotKit connects the frontend and backend, enabling real-time AI interactions
🎥 Demo Video
Click the image above to watch the demo video
Direct Video Link: Watch Demo Video