AgentKit is a production-ready starter template for building AI agents with web search capabilities. It's designed to help developers quickly build AI chat applications with authentication, database persistence, and a beautiful UIβeverything you need to launch fast.
- π AI-Powered Web Search: Toggle web search on/off with a single click. Your AI agent can search the web for current information, recent events, and up-to-date data when needed.
- π¬ Modern Chat Interface: Pre-built chat UI with streaming responses, file uploads, message history, and tool call visualization. Built with shadcn/ui and Tailwind CSS.
- π User Authentication: Integrated Clerk authentication with email/password and OAuth support. User-scoped chat history with secure database persistence.
- πΎ Database Persistence: PostgreSQL with Prisma ORM. All conversations are automatically saved with user-scoped data for easy querying and management.
- π¨ Beautiful UI: Built with shadcn/ui components and Tailwind CSS for a modern, responsive design.
- β‘ Real-time Streaming: See your agent's search process in real-time with collapsible source citations and tool call visualization.
- π‘οΈ Production Ready: Includes error handling, loading states, responsive design, and optimized for Vercel deployment.
- π TypeScript: Full type safety throughout the codebase for better developer experience.
- π§ Developer Experience: Clean architecture, easy to customize, and well-documented code.
- Next.js 16.1.1
- React 19.2.3
- TypeScript
- Vercel AI SDK
- Anthropic (Claude Sonnet 4.5)
- Clerk (Authentication)
- Prisma + PostgreSQL
- shadcn/ui
- Tailwind CSS
- Magic UI (Landing page components)
- ExaLabs AI SDK (Web search tool)
- Biome (Linting and formatting)
- Husky (Git hooks)
- Commitlint (Commit message linting)
- lint-staged (Pre-commit checks)
- Node.js 18+ (recommended: 20+)
- pnpm, npm, yarn, or bun
- PostgreSQL database (local or cloud)
- Clerk account (for authentication)
- Anthropic API key (for AI model)
- Clone the repository:
git clone https://github.com/anayatkhan1/agentkit-starter.git
cd agentkit-starter- Install dependencies:
pnpm install
# or
npm install
# or
yarn install-
Set up environment variables (see Environment Variables section below).
-
Set up the database:
# Generate Prisma client
pnpm prisma generate
# Run database migrations
pnpm prisma migrate dev- Start the development server:
pnpm dev
# or
npm run dev
# or
yarn devOpen http://localhost:3000 with your browser to see the result.
To run the project locally, you need to set up the following environment variables. Create a .env.local or .env file in the root directory of the project:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL=/chat
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL=/chat
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/agentkit
# Anthropic AI
ANTHROPIC_API_KEY=your_anthropic_api_key
# Optional: Production URL
NEXT_PUBLIC_APP_URL=http://localhost:3000- Clerk: Sign up at clerk.com and create a new application. Copy your publishable key and secret key from the dashboard.
- Anthropic: Get your API key from console.anthropic.com.
- PostgreSQL: Use a local PostgreSQL instance or a cloud provider like Neon, Supabase, or Vercel Postgres.
This project uses Prisma as the ORM with PostgreSQL. The database schema includes:
- Chat: Represents a conversation thread with user ID, title, and timestamps
- Message: Represents individual messages in a chat with role, content (JSON), and timestamps
After setting up your DATABASE_URL, run:
# Generate Prisma client
pnpm prisma generate
# Create and apply migrations
pnpm prisma migrate dev
# (Optional) View your database in Prisma Studio
pnpm prisma studioagentkit-starter/
βββ src/
β βββ agents/ # AI agent implementations
β β βββ web-search-agent/ # Web search agent with tool integration
β βββ app/ # Next.js app router
β β βββ api/ # API routes (chat, chats)
β β βββ chat/ # Chat pages
β β βββ page.tsx # Landing page
β βββ components/ # React components
β β βββ chat-ui/ # Chat interface components
β β βββ sections/ # Landing page sections
β β βββ ui/ # shadcn/ui components
β βββ lib/ # Utilities and configurations
β β βββ chat-store.ts # Chat persistence logic
β β βββ config.tsx # Site configuration
β β βββ prisma.ts # Prisma client instance
β βββ tools/ # AI SDK tools
β βββ web-search/ # Web search toolset
βββ prisma/ # Database schema and migrations
β βββ schema.prisma # Prisma schema
β βββ migrations/ # Database migrations
βββ public/ # Static assetsThe chat interface includes a search toggle button. When enabled, the AI agent will use web search to find current information. When disabled, the agent responds using its training knowledge only.
All conversations are automatically saved to PostgreSQL. Each chat is associated with a user ID (from Clerk), allowing for user-scoped chat history. Chats are loaded automatically when you navigate to a chat page.
You can customize the AI agent by:
- Modifying the system prompt: Edit
src/agents/web-search-agent/prompt.ts - Adding new tools: Create tools in
src/tools/and integrate them in the agent - Changing the AI model: Update the model in
src/agents/web-search-agent/agent.tsorsrc/app/api/chat/route.ts
To request a feature, open a GitHub issue.
Thank you for considering contributing to AgentKit! Please follow these guidelines to ensure smooth collaboration:
-
Fork the repository to your GitHub account.
-
Clone the forked repository to your local machine:
git clone https://github.com/your-username/agentkit-starter.git
cd agentkit-starter- Create a new branch for your changes:
git checkout -b feature/your-feature-name-
Make your changes and ensure they adhere to the project's coding style and guidelines.
-
Test your changes thoroughly to avoid introducing bugs.
-
Commit your changes with clear and descriptive commit messages:
git commit -m 'feat: Add your descriptive commit message'Note: Before committing changes, ensure you include one of these tags in your commit message: feat, fix, wip, patch, build.
- Push your changes to your forked repository:
git push origin feature/your-feature-name-
Open a pull request against the
mainbranch of the original repository. -
Provide a clear and concise description of your changes in the pull request, along with any relevant information.
-
Ensure your pull request passes all checks and tests before requesting a review.
This project uses Biome for linting and formatting. Before committing, run:
pnpm lint
pnpm formatThis project is licensed under the MIT License. See the LICENSE file for details.
Built with β€οΈ by Anayat Khan