New: HCEL — chain prompts, RAG, and agents in native TypeScript Learn more →
HazelJS LogoHazelJS
AI-native TypeScript backend · 47 packages · Apache 2.0

Powering the AI Backend Lifecycle

Stop stitching LangChain, Express, and observability together. HazelJS is one TypeScript backend where agents, RAG, tools, and memory share auth, deployment, and production primitives from day one.

37+
GitHub Stars
200K+
NPM Downloads / 30d
58+
Active Builders
hazel-orchestration.ts
const result = await ai.hazel
.execute(userTicket);
Real-time Trace
Summarizing user feedback about dashboard latency...
Explore
Platform

One backend for the full AI stack

Not a library you bolt on — a cohesive runtime where every AI primitive shares dependency injection, security, and observability with the rest of your app.

Production Agent Runtime

A stateful execution engine — not a stateless API handler. Agents keep context across turns, run tools safely, pause for human approval, and resume where they left off.

  • Redis-backed state that survives restarts and scale-out
  • Tool orchestration with human-in-the-loop checkpoints
  • Multi-agent handoffs with shared memory
  • Circuit breakers, rate limits, and retries built in
@hazeljs/agent
const result = await agentRuntime
  .withTools([searchOrders, updateTicket])
  .withMemory('conversation')
  .run({ input: userMessage });
Explore Agent Runtime
Open Source

Pick your entry point

Start lightweight with HCEL in an existing codebase, or go all-in with agents, workflows, and a production scaffold.

@hazeljs/ai

Ultra-Light

For existing TypeScript apps

Install two packages and start orchestrating with HCEL (Hazel Composable Expression Language) — chain prompts, RAG, and agents without switching frameworks.

Install

npm install @hazeljs/core @hazeljs/ai

HCEL example

const result = await ai.hazel
  .prompt('Summarize: {{input}}')
  .rag('engineering-docs')
  .agent('support-specialist')
  .execute(userTicket);
See AI-native example
@hazeljs/agent

Agent Runtime

For production AI agents

Stateful agents with tools, memory, and human-in-the-loop — the execution engine when your agent needs to run longer than a single HTTP request.

Install

npm install @hazeljs/agent

Runtime example

const result = await agentRuntime
  .withTools([searchOrders, updateTicket])
  .withMemory('conversation')
  .run({ input: userMessage });
Explore docs
@hazeljs/flow

Durable Workflows

For long-running pipelines

Agents that run for hours or days. Checkpoint progress, wait on humans or webhooks, and resume exactly where you left off.

Install

npm install @hazeljs/flow

Flow example

const def = flow('onboarding', '1.0.0')
  .entry('ingest')
  .node('ingest', ingestDocs)
  .node('embed', embedChunks)
  .edge('ingest', 'embed')
  .build();
Explore docs
Quick Start

Live in 60 seconds

Install two packages into your current app, or generate a full AI-native backend with agents, RAG, and monitoring pre-wired.

$npm install @hazeljs/core @hazeljs/ai
$cd my-app && npm install && npm run dev

Best for brownfield — add HCEL orchestration without restructuring your app.

The glue-code way~50 lines of wiring
// 1. Setup DI
// 2. Configure OpenAI Adapter
// 3. Setup LangChain Chain
// 4. Manually pipe input to RAG
// 5. Manually pipe RAG output to Agent
// 6. Handle tool failures manually
// 7. Write 50 lines of boilerplate...

async execute(input) {
  const docs = await this.rag.search(input);
  const prompt = this.template.fill(input, docs);
  const agent = new AgentExecutor({ ... });
  return agent.call({ prompt });
}
The HazelJS way5 lines, one chain
// 1. Just call the chain.
// Context flows implicitly.

async execute(input) {
  return await this.ai.hazel
    .prompt(template)
    .rag('docs')
    .agent('specialist')
    .execute(input);
}
Compare

How HazelJS stacks up

NestJS gives you structure. LangChain gives you chains. HazelJS gives you both — in one TypeScript backend built for AI from day one.

Excellent backend structure — but AI is still an add-on.

NestJS is a proven TypeScript framework for APIs and microservices. For AI workloads you still wire LangChain, vector DBs, and observability yourself.

Backend structure
NestJSDecorators, DI, modules — mature ecosystem
HazelJSSame patterns — familiar if you know NestJS
AI & agents
NestJSBring your own libraries (LangChain, Vercel AI SDK)
HazelJSNative Agent Runtime, HCEL, and RAG packages
Agent state
NestJSManual session/store wiring
HazelJSStateful runtime with Redis persistence
RAG pipeline
NestJSIntegrate loaders, embedders, and vector DBs separately
HazelJSAgentic RAG with 11 loaders and 5 vector stores built in
LLM observability
NestJSDIY OpenTelemetry + custom cost tracking
HazelJSOpenTelemetry spans and per-request LLM cost tracking
Guardrails & eval
NestJSThird-party middleware or roll your own
HazelJS@hazeljs/guardrails and @hazeljs/eval in the same stack
Time to first agent API
NestJSDays — framework + AI libs + glue code
HazelJSMinutes — `ai-native` CLI template or 2 npm packages

What teams build with HazelJS

Real production patterns — not toy demos. Stateful agents, intelligent retrieval, and durable pipelines.

🧠

Knowledge Intelligence

Ingest PDFs, wikis, and APIs — then query with semantic search or GraphRAG for multi-hop reasoning across your org.

GraphRAGPostgresHCEL
Coming soon

Automated Content Pipeline

Durable workflows that draft, review, and publish content on triggers — with checkpointing, retries, and full audit trails.

FlowWorkersObservability
Coming soon
Shipped on HazelJS

Zynli — built entirely on HazelJS

Zynli is a multi-tenant AI support platform: agentic RAG, guided flows, real-time inbox, embeddable widget, and Stripe billing — all powered by HazelJS packages in production.

Zynli.AI

Live in production

Multi-tenant AI support — RAG, flows, billing, and real-time handoff. Built by HumanBee AB.

Status
Live
Product
zynli.ai
Widget on
hazeljs.ai

01

Agentic RAG inbox

Visitors get KB-grounded answers first; low-confidence turns escalate to live agents with full context.

02

Guided flows & tools

Intent routing runs order tracking, ticket creation, and custom HTTP actions — the same patterns HazelJS documents for support agents.

03

Production SaaS stack

Multi-tenant workspaces, subscriptions, real-time Socket.IO, and an embeddable React widget — shipped, not a demo repo.

HazelJS stack in production

@hazeljs/rag@hazeljs/ai@hazeljs/core@hazeljs/memory@hazeljs/payment@hazeljs/queue

Try the support widget on this page — it runs on the same HazelJS RAG stack as Zynli.

visitor-bot-reply.ts
// KB → guided flow → ticket bot → LLM → human handoff
await askRag(question, tenantId, { sessionId });
await matchVisitorIntent(tenantId, message);
await tryExecuteVisitorFlow({ conversationId, tenantId, ... });
37+
GitHub Stars
200K+
NPM Downloads / 30d
47
Packages
Apache 2.0
Open Source

From the HazelJS team

Deep dives on agents, HCEL, RAG, and what we are shipping next.

Built with a growing community

Get help from developers shipping AI backends in production. Share patterns, debug agents, and shape the roadmap.

University Groups

Connect with students and researchers building on HazelJS at your institution.

Discussions

Ask questions, share agent patterns, and get feedback from builders in the trenches.

Early Access

Shape the roadmap, test new packages, and get direct access to the core team.

Ready to ship your first agent?

Install in minutes. No credit card. No glue code. Just TypeScript, agents, and a backend built for production.

Coming soon — Get early access

Deploy agents, not just APIs

Push to GitHub and ship HazelJS apps to the edge — with preview environments for every PR and zero config.

Under 30s deploys

Optimized build pipelines for AI backends

Zero config

Connect your repo and go

Global edge

Low-latency inference worldwide

PR previews

Test agent changes before merge

Join 9+ developers for early access to HazelJS.Cloud

Partner

Need hands-on help?

Our official consulting partner helps teams architect, implement, and ship HazelJS in production — faster.

HumanBee
Official HazelJS Partner

HumanBee

Need help shipping AI agents, RAG pipelines, or production backends on HazelJS? HumanBee is the official consulting partner for architecture, hands-on implementation, and team enablement.

  • Architecture & system design
  • Agent & RAG implementation
  • Team enablement & training