HazelJS vs Mastra
TL;DR
- Mastra is an open-source TypeScript framework for agents and workflows: typed steps, memory, MCP, evals, Studio observability, HITL suspend/resume, and optional durable runners (e.g. Inngest; Temporal experimental).
- HazelJS Agent OS is also TypeScript, but positions as an Agent OS: DNA packages, Skillgate, Gatekeeper, Decision Runtime, crash-safe HITL, and local-first
hazeld/hazel applyinside a Nest-familiar DI/HTTP app. - Prefer Mastra when you want a dedicated TypeScript agent+workflow framework with Studio/evals and external durable runners.
- Prefer HazelJS when agents must share one backend with REST/DI and you need DNA + Skillgate + Gatekeeper as the operating layer — clone Meridian.
Sources: Mastra agent framework, Mastra workflows, Mastra workflow runners, Agent lifecycle.
Who this is for
TypeScript teams shortlisting agent frameworks that already speak Node and workflows.
Capability matrix
| Capability | HazelJS | Mastra |
|---|---|---|
| Language | TypeScript | TypeScript |
| Primary abstraction | Agent OS (DNA + runtime + local CP) | Agents + typed workflows |
| Agent runtime | AgentRuntime (@hazeljs/agent) | Mastra Agent loop |
| Workflow orchestration | AgentGraph, flow package, supervisor | createWorkflow / steps / parallel / branch |
| Durable execution | Built-in DurableRunStore + hazeld | Workflow persistence; Inngest/Temporal runners for production durability |
| Governance | Skillgate curated skills | Processors, tool approvals, evals |
| Authorization | Gatekeeper policies | Tool approval / processors (model differs) |
| Observability | Inspector timelines + OTel | Studio traces, scorers, evals |
| Deployment | Local-first apply; cloud optional | Self-host or Mastra Platform |
| Multi-agent | Graphs, supervisor, A2A | Subagents / workflow composition |
| Human-in-the-loop | Durable HumanTask + Gatekeeper | Workflow suspend/resume + tool approvals |
| Production infrastructure | Same DI app as HTTP APIs | Agent server + workflow runners |
Both are TypeScript. The architectural difference is category: Mastra is a strong agent/workflow framework; HazelJS markets and implements an Agent OS operating layer (packaging, govern, survive) beside HTTP.
When to choose which
Choose Mastra when Studio, evals, and workflow-runner integrations (Inngest, etc.) are central to how you ship agents.
Choose HazelJS when you want Agent DNA, Skillgate OpenAPI skills, Gatekeeper authorization, and durable HITL inside the same TypeScript backend as your APIs.
Related
FAQ
- Are HazelJS and Mastra both TypeScript?
- Yes. The difference is category: Mastra is a TypeScript agent/workflow framework; HazelJS positions as an Agent OS with DNA, Skillgate, Gatekeeper, and local hazeld apply.
- How does Mastra handle durability?
- Mastra workflows can persist and suspend; production durability often uses runners such as Inngest (Temporal support has been experimental). HazelJS builds durable runs into AgentRuntime + DurableRunStore.
- When should I pick Mastra?
- When Studio, evals/scorers, and workflow-runner integrations are central to how you build agents.
- When should I pick HazelJS?
- When agents must live beside production TypeScript APIs with DNA packaging and Gatekeeper authorization.