Framework Guides

Add Anvia agents to application frameworks without giving up your app boundaries.

These guides show how to move Anvia from a local script into real HTTP runtimes.

Each framework follows the same path:

StepGoal
01 PrepCreate the project shape and install Anvia packages
02 Setup AnviaBuild provider clients, models, tools, and agents in server-side modules
03 Route HandlerReturn a normal JSON response from a framework route
04 StreamingReturn newline-delimited stream events from the same agent
05 Tools and ContextPass request-local auth, product data, and retrieval context safely
06 PersistenceStore conversation history through your application storage
07 DeployCheck runtime, environment, and operational constraints
08 TroubleshootingFix common framework and provider failures
09 Human in the LoopAdd approvals, questions, and reviewer waits to framework routes
10 Setup TestsTest route handlers, streams, Studio wiring, and provider boundaries

Start with the framework that owns your HTTP routes:

FrameworkStart hereRoute shape
Next.jsNext.js PrepApp Router route.ts handlers
TanStack StartTanStack Start PrepcreateServerFn(...) and server routes
SvelteKitSvelteKit Prep+server.ts endpoint modules
HonoHono PrepPlain Hono routes
ExpressExpress PrepRouter middleware and handlers
FastifyFastify PrepPlugin routes and replies
NestJSNestJS PrepModules, services, and controllers

The Anvia runtime shape stays the same across every framework:

import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";

const client = new OpenAIClient({ apiKey });
const model = client.completionModel("gpt-5.5");

export const supportAgent = new AgentBuilder("support", model)
  .instructions("Answer support questions clearly.")
  .defaultMaxTurns(3)
  .build();

For the underlying SDK concepts, read How Anvia Works, Creating Agents, Tools, Readable Streams, and Memory.