Templates

LLM council

A Next.js LLM council that sends one prompt to four models in parallel, streams their answers, and asks a judge model for a concise answer with per-model agreement scores.

View Source
  • Web chat
agent/agent.tstypescript
import { defineAgent } from "eve";

export default defineAgent({
  model: "anthropic/claude-opus-5",
  limits: {
    maxOutputTokensPerSession: 4_000,
  },
});

LLM Council

An eve and Next.js demo that sends one prompt to four models in parallel, streams their answers, and asks a judge model for a concise answer with per-model agreement scores.

The council uses:

  • xAI Grok 4.5
  • Anthropic Claude Opus 5
  • OpenAI GPT-5.6 Sol
  • Moonshot AI Kimi K3

Architecture

The application follows one simple flow:

text
prompt → four parallel council members → judge answer + agreement scores

The root eve agent delegates the same prompt to four declared subagents. Each subagent has a fixed AI Gateway model and runs in its own durable session. The Next.js client follows those child session streams so every response appears independently as it is generated.

After all four members finish, the root agent returns a concise answer and per-model agreement scores using a structured output schema. withEve() and useEveAgent() keep the agent routes and UI in the same Next.js application.

The main pieces are:

  • agent/instructions.md — fan-out and judging behavior
  • agent/subagents/ — the four fixed council members
  • agent/lib/schemas.ts — final answer and score schema
  • app/council-app.tsx — submission, child streaming, and rendering

Run locally

bash
pnpm installpnpm exec eve linkpnpm dev

eve link connects the app to a Vercel project and pulls the AI Gateway credentials needed by the models. Open the local URL printed by Next.js.

Checks

bash
pnpm typecheckpnpm build