open-multi-agent/examples/with-vercel-ai-sdk
JackChen 8ecfc1504c feat: add Vercel AI SDK integration example (Next.js + runTeam)
Next.js App Router demo showing OMA + Vercel AI SDK working together:
- Backend: OMA runTeam() orchestrates researcher + writer agents
- Frontend: AI SDK useChat hook for streaming chat UI
- Uses DeepSeek via OpenAI-compatible provider
2026-04-16 00:49:49 +08:00
..
app feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
.gitignore feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
README.md feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
next-env.d.ts feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
next.config.ts feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
package-lock.json feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
package.json feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00
tsconfig.json feat: add Vercel AI SDK integration example (Next.js + runTeam) 2026-04-16 00:49:49 +08:00

README.md

with-vercel-ai-sdk

A Next.js demo showing open-multi-agent (OMA) and Vercel AI SDK working together:

  • OMA orchestrates a research team (researcher agent + writer agent) via runTeam()
  • AI SDK streams the result to a chat UI via useChat + streamText

How it works

User message
  │
  ▼
API route (app/api/chat/route.ts)
  │
  ├─ Phase 1: OMA runTeam()
  │    coordinator decomposes goal → researcher gathers info → writer drafts article
  │
  └─ Phase 2: AI SDK streamText()
       streams the team's output to the browser
  │
  ▼
Chat UI (app/page.tsx) — useChat hook renders streamed response

Setup

# 1. From repo root, install OMA dependencies
cd ../..
npm install

# 2. Back to this example
cd examples/with-vercel-ai-sdk
npm install

# 3. Set your API key
export ANTHROPIC_API_KEY=sk-ant-...

# 4. Run
npm run dev

npm run dev automatically builds OMA before starting Next.js (via the predev script).

Open http://localhost:3000, type a topic, and watch the research team work.

Prerequisites

  • Node.js >= 18
  • ANTHROPIC_API_KEY environment variable (used by both OMA and AI SDK)

Key files

File Role
app/api/chat/route.ts Backend — OMA orchestration + AI SDK streaming
app/page.tsx Frontend — chat UI with useChat hook
package.json References OMA via file:../../ (local link)