This example shows how to use Workflow to make RAG agents more durable and reliable. It is based on the Retrieval-Augmented Generation (RAG) guide.
- An API key from Vercel AI Gateway
- A PostgreSQL database
-
Clone the repository and install dependencies:
git clone https://github.com/vercel/workflow-examples cd workflow-examples/rag-agent pnpm install -
Create a
.env.localfile inexamples/rag-agent/:touch .env.local
-
Add your Vercel AI Gateway API key and database URL to the
.env.localfile:AI_GATEWAY_API_KEY=your_api_key_here DATABASE_URL=your_database_url_here
-
Run the migrations:
pnpm db:migrate
-
Start the development server:
pnpm dev
-
Open http://localhost:3000 to see the app
This project uses the following stack:
- Next.js 15 (App Router)
- Vercel AI SDK
- Vercel AI Gateway
- Drizzle ORM
- Postgres with pgvector
- shadcn-ui and TailwindCSS for styling