New: HCEL — chain prompts, RAG, and agents in native TypeScript Learn more →
HazelJS LogoHazelJS

Comparison

HazelJS vs Vercel AI SDK

Vercel AI SDK optimizes streaming UX on Vercel. HazelJS is the backend framework for agents, RAG, and enterprise TypeScript APIs — they can complement each other.

Updated August 4, 2026

HazelJS vs Vercel AI SDK

TL;DR

  • Vercel AI SDK shines for streaming UI, chat hooks, and Vercel-centric route handlers.
  • HazelJS is a backend-first TypeScript framework: controllers, DI, agents, RAG, memory, and microservices.
  • Use the AI SDK for frontend streaming UX (often with any backend).
  • Use HazelJS when the hard problem is the server: agents, tools, RAG, auth, and durable workflows.

Who this is for

Choose this comparison if you:

  • Build Next.js apps and wonder whether AI SDK alone is enough for production agents
  • Need multi-provider LLMs, RAG, and HITL on the server
  • Want deployment beyond Vercel (Lambda, containers, Cloud Functions)

Prefer Vercel AI SDK alone when:

  • The product is mostly chat UI streaming against simple route handlers
  • You are all-in on Vercel and do not need a Nest-style backend framework

Side-by-side

AspectVercel AI SDKHazelJS
FocusFrontend AI, streaming, Vercel DXBackend-first, full application
Backend modelRoute handlers / serverless functionsControllers, modules, DI
Agent supportLighter agent helpersFull Agent Runtime — tools, memory, approval, AgentGraph, Supervisor
RAGIntegrate separately@hazeljs/rag — GraphRAG, Memory System, Agentic RAG
OrchestrationApp-level compositionHCEL + agents inside the same DI graph
DeploymentVercel-optimizedAny Node host, Lambda, Cloud Functions via @hazeljs/serverless
MicroservicesDIYGateway, discovery, resilience packages

Complementary, not always exclusive

Many teams use:

  • Vercel AI SDK on the client for useChat / streaming UX
  • HazelJS (or Nest) on the server for agents, RAG, and business tools

HazelJS competes when you expected the AI SDK backend pieces to replace a full agent/RAG platform — they usually do not.

Code: route handler vs framework agent

Typical AI SDK route (illustrative): stream text from a model in a serverless handler — great for chat UI, limited as an agent OS.

HazelJS agent + HTTP:

import { Agent, Tool } from '@hazeljs/agent';
import { Controller, Post, Body } from '@hazeljs/core';

@Agent({
  name: 'desk',
  enableMemory: true,
  enableRAG: true,
  systemPrompt: 'Help users with account questions.',
})
export class DeskAgent {
  @Tool({
    description: 'Fetch account plan',
    parameters: [{ name: 'userId', type: 'string', required: true }],
  })
  async plan(input: { userId: string }) {
    return { userId: input.userId, plan: 'pro' };
  }
}

@Controller({ path: '/desk' })
export class DeskController {
  @Post('message')
  async message(@Body() body: { text: string }) {
    // Execute via Agent Runtime — see agent package docs
    return { received: body.text };
  }
}

Decision guide

SituationPrefer
Next.js chat UI, thin backendVercel AI SDK
Production agents + RAG + authHazelJS
Frontend stream + serious backendAI SDK (UI) + HazelJS (API)
Multi-cloud / non-Vercel deployHazelJS

When Vercel AI SDK is better

  • Shipping UI fast on Vercel is the bottleneck
  • You do not need durable agents, GraphRAG, or microservices patterns
  • Team skill is React/Next, not backend frameworks

Related

Next steps

  1. Installation
  2. AI package
  3. Support agent example
  4. GitHub

FAQ

Can I use Vercel AI SDK with HazelJS?
Yes. Many teams use the AI SDK on the client for useChat/streaming and HazelJS on the server for tools, RAG, and agents.
Is HazelJS only for Vercel?
No. HazelJS runs on Node hosts generally, with @hazeljs/serverless adapters for Lambda and Cloud Functions — not locked to Vercel.
When is the AI SDK enough alone?
When you need thin route handlers and chat UI, without durable agents, GraphRAG, or a full DI/module backend.
Does HazelJS stream responses?
Yes — streaming is supported via the AI package and agent runtime. See package docs for provider streaming patterns.

Docs & next steps

Related comparisons

  • HazelJS vs LangChain

    LangChain composes LLM pipelines. HazelJS ships those capabilities inside a production TypeScript backend — controllers, agents, RAG, and ops together.

  • HazelJS vs NestJS

    NestJS is excellent for structured APIs. HazelJS keeps a familiar module/DI model and adds native AI, agents, RAG, and Agent OS in the same stack.

  • HazelJS vs Express

    Express maximizes freedom with middleware. HazelJS maximizes structure for TypeScript AI backends — controllers, DI, and AI packages included.

← All comparisons