Theo Docs
TheoCodeTheoCreateTheoKitTheoKit-SDKTheoUITheo PaaS

Overview

The Next.js framework for Full-Stack AI Agents.

TheoKit is what you reach for when "I'll build a custom agent" turns into a real product. It is a Next.js framework with the agent surface already wired — chat UI, tool calls, server actions, streaming, persistence, and auth — so you can focus on the agent, not the plumbing.

If you have built a React app, you can build a TheoKit app.

Install

npx create-theokit my-app

The scaffolder asks two questions (model provider, persistence backend) and hands you a runnable project on the next prompt.

What you get out of the box

Agent chat UI

Streaming responses, message history, tool-call rendering, file uploads — all from TheoUI components, all themable.

Tool calling

Define a tool as a typed function. TheoKit handles routing, validation, error surfacing, and retries.

Server actions

Run agent steps on the server with full type safety. No client-side API keys, no proxy layer.

Persistence

Conversations, tool calls, and artifacts stored in your database of choice (Postgres, SQLite, Turso, Neon).

Auth

Drop-in providers for OAuth, magic links, and SSO. Per-conversation access control built in.

Deploy with one command

`theo deploy` reads the TheoKit conventions and ships to Theo PaaS. Or build the Docker image and ship anywhere.

Quick start

# 1. Scaffold
npx create-theokit my-agent

# 2. Walk in
cd my-agent

# 3. Add your model provider key
echo "OPENAI_API_KEY=sk-..." > .env.local

# 4. Run it
pnpm dev

Open http://localhost:3000 — you have a working agent with chat, tool calls, and persistence in under two minutes.

Built on Next.js, not in spite of it

TheoKit is a thin layer on Next.js 16 + App Router. Server components, edge runtime, Route Handlers, Middleware — they all work the way the Next.js docs describe. There is no proprietary build step, no fork, no custom router.

app/api/chat/route.ts
import { agent } from '@usetheo/kit/server';
import { z } from 'zod';

export const POST = agent({
  model: 'openai:gpt-4o',
  tools: {
    searchDocs: {
      description: 'Search the project documentation',
      input: z.object({ query: z.string() }),
      run: async ({ query }) => {
        return await db.docs.search(query);
      },
    },
  },
});

TheoKit is part of the funnel but not coupled to Theo PaaS. Deploy the output anywhere a Next.js app runs — Vercel, Cloudflare, Fly, Docker.

Where to go next

On this page