A Data Analyst AI Agent with multi-framework support, supported by tool router via Composio, and persistent chat history. Built for connecting to multiple data sources like Hubspot, Attio, Google Sheets and analyzing data, generating insights, and creating visualizations through natural language conversations.
- Multi-Framework Support: Choose from Vercel AI SDK, LangChain, OpenAI Agents SDK, or Claude Agents SDK
- Multi-Model Support: Works with OpenAI (GPT-4o, GPT-4o Mini, GPT-5.2), Anthropic (Claude Opus 4.5, Sonnet 4.5, Haiku 4.5), and Google models
- Tool Integration: Seamless integration with external tools via Composio Tool Router
- Chat History: Persistent conversation history with database storage
- Authentication: Secure authentication flow with NextAuth v5 and Composio
- Database: PostgreSQL with Drizzle ORM for reliable data persistence
- Modern UI: Beautiful chat interface with dark mode, live previews, and responsive design
- Rate Limiting: Built-in rate limiting for API protection
- Security: Request validation, environment validation, and secure auth flows
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Database: PostgreSQL
- ORM: Drizzle ORM
- Auth: NextAuth.js (Auth.js v5)
- AI Frameworks:
- Vercel AI SDK (with MCP support)
- LangChain (with MultiServerMCPClient)
- OpenAI Agents SDK
- Claude Agents SDK
- Tool Integration: Composio Tool Router
- Styling: Tailwind CSS
- Validation: Zod (Env vars & Schema)
- Testing: Vitest
- Linting: ESLint + Prettier
- Node.js 18+
- PostgreSQL database (local or cloud like Neon/Supabase)
Create a .env file in the root directory:
# Database
DATABASE_URL="postgres://user:pass@localhost:5432/data_analyst_agent"
# NextAuth
AUTH_SECRET="your_generated_secret" # generate with `npx auth secret` or `openssl rand -base64 32`
AUTH_URL="http://localhost:3000" # Deployment URL
# Composio (Tools & Auth)
COMPOSIO_API_KEY="your_composio_api_key"
AUTH_CONFIG_ID="your_auth_config_id" # From Composio Dashboard at platform.composio.dev
# AI Providers (At least one required)
OPENAI_API_KEY="sk-..."
ANTHROPIC_API_KEY="sk-..."
GEMINI_API_KEY="sk-..."npm installPush the schema to your database (for local dev):
npm run db:pushFor production migrations:
npm run db:generate
npm run db:migratenpm run devOpen http://localhost:3000.
- User clicks "Sign in with Composio".
- App generates a unique
userIdand calls the Composio link API. - User authenticates with the external provider (e.g., Google/GitHub).
- Composio redirects back to
/auth/callback. - App verifies the
userIdand creates a NextAuth session.
The application supports four different AI frameworks, allowing you to choose the best one for your use case:
- Vercel AI SDK (default): Uses
streamTextwith MCP client for tool integration - LangChain: Uses
MultiServerMCPClientwith React Agent - OpenAI Agents SDK: Native OpenAI agent framework
- Claude Agents SDK: Native Anthropic agent framework
Tools are executed via Composio MCP on the server (app/api/chat/route.ts). The system automatically routes to the appropriate framework handler based on your selection. Rate limiting (10 requests per minute) is applied per user session.
Conversations are automatically saved to the database with full message history. Each chat session can be resumed, deleted, or managed through the sidebar interface. Messages include both text content and structured parts (tool calls, images, etc.).
Drizzle commands require DATABASE_URL to be set. Either export it or prefix the command:
# Option 1: Export in shell
export DATABASE_URL="postgres://..."
npm run db:push
# Option 2: Inline
DATABASE_URL="postgres://..." npm run db:pushnpm run db:push: Push schema changes directly (prototyping only).npm run db:generate: Generate SQL migration files (production).npm run db:migrate: Apply migration files to the DB.npm run db:studio: Open Drizzle Studio to view data.
- Build:
npm run build - Environment: Ensure all
.envvariables are set in your provider (Vercel/Railway). - Database: Run
npm run db:migrateduring the build process or as a post-deploy step.
npm run dev: Start development servernpm run build: Build for productionnpm run start: Start production servernpm run lint: Run ESLintnpm run format: Format code with Prettiernpm run format:check: Check code formattingnpm run test: Run tests with Vitestnpm run test:watch: Run tests in watch modenpm run db:push: Push schema changes to database (development)npm run db:generate: Generate migration files (production)npm run db:migrate: Apply migrations to databasenpm run db:studio: Open Drizzle Studio for database management
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Push to the branch.
- Open a Pull Request.
This project uses Composio for tool integrations and authentication.
