Why HazelJS Is the Best AI-Native Runtime Platform and Framework

Why HazelJS Is the Best AI-Native Runtime Platform and Framework

Why HazelJS Is the Best AI-Native Runtime Platform and FrameworkMuhammad Arslan

Most backend frameworks treat AI as an afterthought. You bolt on an LLM client, wire RAG yourself,...

Most backend frameworks treat AI as an afterthought. You bolt on an LLM client, wire RAG yourself, build agents with duct tape and glue. HazelJS is different: AI is in the design from day one. Agent Runtime, Agentic RAG, persistent memory, and multi-provider LLM support aren't plugins—they're core. Here's why HazelJS is the best AI-native runtime platform for building intelligent backends.


Packages & Links


Major Features of HazelJS (Full Scan)

Before diving into why HazelJS wins, here's a complete picture of what it offers across 38+ packages:

AI & Intelligence (Core Value)

Package What It Does
@hazeljs/agent Production-grade Agent Runtime. Stateful execution, tools, human-in-the-loop approval, memory and RAG integration. Think → Act → Persist loop with full observability.
@hazeljs/ai Multi-provider LLM integration. OpenAI, Anthropic, Gemini, Cohere, Ollama—one API. Streaming, function calling, embeddings. Swap providers without rewriting code.
@hazeljs/rag End-to-end RAG: 11 document loaders (PDF, Markdown, web, GitHub, YouTube), 5 vector stores (Memory, Pinecone, Qdrant, Weaviate, ChromaDB), GraphRAG, Agentic RAG decorators.
@hazeljs/memory Unified user-scoped memory. Profile, preference, behavioral, emotional, episodic, semantic. One interface, multiple backends (in-memory, Postgres, Redis, vector). Shared by RAG and agents.
@hazeljs/guardrails Content safety for AI. PII redaction, prompt injection detection, toxicity checks, output validation. Plugs into HTTP, AI, and agent layers. GDPR/CCPA ready.
@hazeljs/prompts Typed, versioned prompt templates. Override per environment. Used by RAG, agents, GraphRAG.
@hazeljs/ops-agent AI-powered DevOps: Jira, Slack, incident triage. Built on Agent Runtime.
@hazeljs/pdf-to-audio Turn PDFs into audiobooks with OpenAI TTS. Async queue, summaries.
@hazeljs/connectors RAG-ready connectors for Google Drive, Slack, Notion, Confluence.
@hazeljs/crawler Web crawler for RAG. Sitemap, link following, cheerio extraction.
@hazeljs/mcp Model Context Protocol. MCP tools and servers.
@hazeljs/ml Model registry, training, inference. @Model, @Train, @Predict.

Core & Infrastructure

Package What It Does
@hazeljs/core Foundation: DI, routing, controllers, guards, interceptors, pipes, exception filters, middleware. Decorator-based, NestJS-style.
@hazeljs/config Configuration management. Env-based, type-safe.
@hazeljs/gateway API Gateway. Version routing, canary deployments, traffic mirroring.
@hazeljs/resilience Circuit breakers, retries, bulkheads, rate limiters, timeouts.
@hazeljs/discovery Service discovery, health checks, 6 load balancing strategies.
@hazeljs/serverless Deploy to AWS Lambda, Vercel. Cold start optimization.
@hazeljs/flow Durable workflow engine. @Flow, @Node, @Edge. Wait/resume, retries, audit trail.
@hazeljs/flow-runtime HTTP service for flow runs. Trigger via POST, resume on callback.

Data & Auth

Package What It Does
@hazeljs/auth JWT, guards, role hierarchy, tenant isolation.
@hazeljs/oauth OAuth 2.0 flows.
@hazeljs/casl CASL-based authorization. @Ability, @CheckPolicies.
@hazeljs/prisma Prisma integration. Repositories, soft delete.
@hazeljs/typeorm TypeORM integration.
@hazeljs/cache Multi-tier cache. In-memory, Redis.
@hazeljs/data Data pipelines, streaming, PII handling. @Pipeline, @Mask, @Encrypt.

APIs & Communication

Package What It Does
@hazeljs/swagger OpenAPI docs, interactive explorer.
@hazeljs/graphql GraphQL support.
@hazeljs/grpc gRPC servers. Decorator-based RPC.
@hazeljs/websocket WebSocket support.
@hazeljs/kafka Kafka consumers and producers. Event-driven.

Product & Operations

Package What It Does
@hazeljs/payment Multi-provider payments. Stripe first, add PayPal or custom gateways. One API.
@hazeljs/audit Audit logging. @Audit decorator.
@hazeljs/feature-toggle Feature flags. @FeatureToggle, env seeding.
@hazeljs/cron Cron jobs.
@hazeljs/i18n Internationalization. @Lang.
@hazeljs/event-emitter Event bus.
@hazeljs/cli Scaffolding, 21+ generators. Controllers, modules, auth, RAG, agents.

Why HazelJS Is the Best AI-Native Framework

1. AI Is Built In, Not Bolted On

Other frameworks: you add openai SDK, build your own RAG pipeline, hand-roll agent loops. HazelJS: Agent Runtime, RAG, memory, and LLM integration are first-class citizens. No glue code. @Agent, @Tool, enableMemory: true, enableRAG: true—done. The runtime wires everything.

2. One Stack for Classic and AI Workloads

You don't need Express for APIs and LangChain for AI. One framework: REST controllers, gRPC, GraphQL, WebSockets, and agents, RAG, and memory. Same DI, same decorators, same request pipeline. Guards protect both HTTP routes and agent tool calls. Interceptors log both.

3. Production-Grade Agents Out of the Box

Without HazelJS With @hazeljs/agent
Manual execution loops Deterministic state machine, built-in
Direct function calls, no audit Validated, logged, retriable, approvable tools
Rolling string in every prompt Persistent session-based memory
Custom webhook logic for approval requiresApproval: true + events
No visibility into steps Full event bus per step
Separate LLM + memory + RAG wiring One AgentRuntime wires all

4. Agentic RAG, Not Just RAG

Standard RAG: one query, one retrieval. HazelJS adds Agentic RAG: query planning, self-reflection, adaptive retrieval, multi-hop reasoning, HyDE, corrective RAG, context awareness, source verification, active learning. Decorators compose: @QueryPlanner, @SelfReflective, @HyDE, @CorrectiveRAG, @ContextAware—pick what you need.

5. Unified Memory for RAG and Agents

Scattered memory is a bug. HazelJS gives you one memory model shared by RAG and agents. Use @hazeljs/rag/memory-hazel to back RAG's MemoryManager with @hazeljs/memory. Pass the same store to every AgentRuntime. Profile, preferences, conversation history, entity memory—one interface, one source of truth.

6. Guardrails That Integrate, Not Isolate

AI safety isn't a separate layer. HazelJS Guardrails plug into HTTP pipes, @AITask methods, and agent tool input/output. PII redaction, prompt injection detection, toxicity checks, output validation—all without rewriting your handlers. GDPR/CCPA and EU AI Act ready.

7. Multi-Provider, No Lock-In

@hazeljs/ai abstracts OpenAI, Anthropic, Gemini, Cohere, Ollama. Switch providers by config. Same API for chat, streaming, embeddings, function calling. Start with OpenAI, move to Claude for cost, use Ollama locally—no code changes.

8. Modular: 38 Packages, Use What You Need

You don't pay for a monolith. Install @hazeljs/core, @hazeljs/ai, @hazeljs/agent, @hazeljs/rag. Add auth, payment, Kafka, gRPC, guardrails when you need them. Each package is independently versioned and documented. Compose your stack.

9. Decorator-First, Type-Safe

@Controller, @Get, @Agent, @Tool, @SemanticSearch, @GuardrailInput—declare behavior with decorators. Full TypeScript, reflection-based DI. Learn once, use everywhere. No runtime config files. No boilerplate state machines.

10. Enterprise Foundation

Dependency injection, guards, interceptors, pipes, exception filters, middleware, graceful shutdown, health checks. The same patterns that scale classic backends scale AI backends. Move fast without cutting corners.


Use Cases Where HazelJS Shines

  • Customer support automation — Agent with order lookup, refund tools, RAG over help docs, human approval for refunds.
  • Research assistants — Agentic RAG with multi-hop reasoning, source verification, citations.
  • DevOps / Ops agents — Jira, Slack, incident triage. Built-in via @hazeljs/ops-agent.
  • SaaS with AI — Stripe payments, feature flags, RAG over product docs, agent for support.
  • Multi-agent workflows — Flow for long-running processes; agents for steps; RAG for context.
  • Compliance-sensitive AI — Guardrails, audit logging, PII redaction, verified citations.

Get Started

npm init -y
npm install @hazeljs/core @hazeljs/ai @hazeljs/agent @hazeljs/rag
Enter fullscreen mode Exit fullscreen mode

Or with the CLI:

npx @hazeljs/cli new my-ai-app
Enter fullscreen mode Exit fullscreen mode

Summary

HazelJS is the best AI-native runtime platform because it was designed for AI from day one. Agent Runtime, Agentic RAG, persistent memory, guardrails, and multi-provider LLM support are built in—not plugins. You get one stack for classic and AI workloads, production-grade agents without duct tape, and a modular ecosystem of 38 packages. Build intelligent backends that reason, remember, and act—with one framework.

— The HazelJS Team