ACAgentic Craft

Foundation~245 minHazelJS

Agentic Development

Beginner end-to-end HazelJS course: scaffold Ops Desk, tool loop, budgets, context hygiene, HITL writes, golden tests, observability, CLI, and go-live checklist.

Authors
editorial-team
Published
Last reviewed

Course promise

A full beginner path to build production-minded agents on HazelJS — not a pile of disconnected tips.

You ship one continuous project: Ops Desk, which looks up order ORD-1001, then grows budgets, context hygiene, human-approved refunds, golden tests, observability, and a launch checklist.

Who this is for

  • Engineers new to agentic AI who already know TypeScript basics
  • People who finished Agent Foundations and want to build
  • Teams standardizing on @hazeljs/agent / Agent OS

How to take the course

  1. Follow lessons in order — each checkpoint unlocks the next.
  2. Prefer createMockLlmProvider until tools behave; then swap a real @hazeljs/ai provider.
  3. Keep a sticky note with goal / done / non-goals for Ops Desk.
  4. Use the companion guide /guides/build-your-first-tool-using-agent when you want a single long lab session.

Lesson map

#LessonYou leave with
01ScaffoldRunnable project + mock runtime
02Tool loop@Agent + lookupOrder + execute
03BudgetsmaxSteps / stop reasons
04ContextTruncated, structured observations
05HITL writesprocessRefund + approval path
06Golden testsdescribeAgent CI gate
07ObservabilityTimeline / executionId runbook
08CLI opsdoctor / logs / stub vs app execute
09ChecklistGo/no-go for production

Docs anchors: Agent package, Agent OS.

Learning outcomes

  • Scaffold and run a HazelJS AgentRuntime project with a mock or real LLM
  • Build a read-first Ops Desk with budgets, truncated observations, and approved writes
  • Add describeAgent goldens, timelines, CLI ops, and a production go/no-go checklist

Lessons

  1. 01Scaffold Your First HazelJS Agent
    Set up a runnable HazelJS project, install packages, choose mock vs real LLM, and verify the environment before writing tools.
  2. 02Tool-Using Agent Loop
    Build a read-only Ops Desk: @Agent + @Tool, register on AgentRuntime, execute a goal, and follow one full think→act→observe cycle.
  3. 03Bounded Runs, Budgets, and Stop Reasons
    Make Ops Desk safe to run: maxSteps, loop.maxIterations, reading stop reasons, and why prompts alone cannot cap cost.
  4. 04Context Windows as Scarce Resources
    Treat every tool observation as a budgeted input: truncate, structure, redact, and turn memory/RAG on only when the job needs it.
  5. 05Safe Writes, Approvals, and HITL
    Add a refund tool the right way: side-effect classes, requiresApproval, PolicyEngine, and durableSuspend so humans can approve without hanging workers.
  6. 06Golden Tests with describeAgent
    Protect Ops Desk with @hazeljs/testing: expectTools, forbidden tools, and a tiny CI gate before you change prompts.
  7. 07Observability Signals for Agent Decisions
    Debug Ops Desk with timelines and traces: executionId, tool calls, stop reasons, cost, and HITL waits on HazelJS.
  8. 08Hazel CLI Agent Ops
    Use hazel agent doctor, run, logs, and runs — and know DNA smoke stubs are not the same as app runtime.execute.
  9. 09From Demo to Production Checklist
    Capstone: promote Ops Desk using Agent OS gates — HITL, budgets, durable stores, policies, tests, Inspector, DNA, and ownership.

Capstone: Ops Desk v1: read-only status lookups in an internal audience, refunds behind approval, describeAgent green in CI, timeline runbook signed off.

Related patterns