hatchet

Used to queue, retry, pause, resume, observe, and extend long-running agent tasks and background workflows.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "hatchet" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-acf5a552690ffabd62a025092adb0e83b448e815012f31e8ec1f9b7730e5b009. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/run-durable-agent-tasks-and-event-driven-workflows-with-hatchet before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Used to queue, retry, pause, resume, observe, and extend long-running agent tasks and background workflows.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Audience
Background jobs that need reliability (retries, timeouts, idempotency) Multi-step workflows (onboarding, order processing, data pipelines) Fan-out/fan-in patterns (process items in parallel, aggregate results) Rate-limited API calls (concurrency control per workflow) Replacing BullMQ/Celery with something more structured
Software, accounts and paid services
```bash npm install @hatchet-dev/typescript-sdk
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: hatchet
description: >-
  Orchestrate background jobs and workflows with Hatchet — open-source
  distributed task queue with DAG workflows. Use when someone asks to "run
  background jobs", "Hatchet", "workflow orchestration", "distributed task
  queue", "durable execution", "replace Celery/Bull", or "DAG workflow engine".
  Covers workflow definition, step functions, retries, concurrency control,
  and event-driven triggers.
license: Apache-2.0
compatibility: "TypeScript/Python/Go. Self-hostable or Hatchet Cloud."
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: development
  tags: ["workflows", "background-jobs", "hatchet", "queue", "orchestration"]

Hatchet

Overview

Hatchet is an open-source distributed task queue and workflow engine. Define workflows as DAGs (directed acyclic graphs), run steps with automatic retries and timeouts, control concurrency, and trigger workflows from events or schedules. Like Temporal but lighter, like BullMQ but with workflow orchestration. Built for background jobs that need reliability: payment processing, data pipelines, AI agent orchestration.

When to Use

  • Background jobs that need reliability (retries, timeouts, idempotency)
  • Multi-step workflows (onboarding, order processing, data pipelines)
  • Fan-out/fan-in patterns (process items in parallel, aggregate results)
  • Rate-limited API calls (concurrency control per workflow)
  • Replacing BullMQ/Celery with something more structured

Instructions

Setup

npm install @hatchet-dev/typescript-sdk

# Self-host
docker compose up -d  # From hatchet-dev/hatchet repo

Define a Workflow

// workflows/onboarding.ts — Multi-step user onboarding
import Hatchet from "@hatchet-dev/typescript-sdk";

const hatchet = Hatchet.init();

const onboardingWorkflow = hatchet.workflow({
  name: "user-onboarding",
  on: { event: "user:created" },
  timeout: "10m",
});

// Step 1: Send welcome email
onboardingWorkflow.step("send-welcome-email", async (ctx) => {
  const { userId, email } = ctx.input();
  await sendEmail(email, {
    subject: "Welcome!",
    template: "welcome",
  });
  return { emailSent: true };
}, { retries: 3, timeout: "30s" });

// Step 2: Set up default workspace (runs after step 1)
onboardingWorkflow.step("create-workspace", async (ctx) => {
  const { userId } = ctx.input();
  const workspace = await createWorkspace(userId, "My Workspace");
  return { workspaceId: workspace.id };
}, {
  parents: ["send-welcome-email"],
  retries: 2,
  timeout: "1m",
});

// Step 3: Generate sample data (runs after workspace created)
onboardingWorkflow.step("seed-data", async (ctx) => {
  const { workspaceId } = ctx.stepOutput("create-workspace");
  await seedSampleData(workspaceId);
  return { seeded: true };
}, {
  parents: ["create-workspace"],
  timeout: "2m",
});

// Step 4: Send getting-started guide (runs after email + workspace)
onboardingWorkflow.step("send-guide", async (ctx) => {
  const { email } = ctx.input();
  await sendEmail(email, {
    subject: "Getting Started Guide",
    template: "getting-started",
  });
}, {
  parents: ["send-welcome-email", "create-workspace"],
  retries: 3,
});

Trigger Workflows

// src/api/users.ts — Trigger from your application
import Hatchet from "@hatchet-dev/typescript-sdk";

const hatchet = Hatchet.init();

// Event-based trigger
await hatchet.event.push("user:created", {
  userId: "user_123",
  email: "kai@example.com",
  plan: "pro",
});

// Direct trigger
const run = await hatchet.workflow.run("user-onboarding", {
  userId: "user_123",
  email: "kai@example.com",
});

// Wait for result
const result = await run.result();
console.log(result); // { emailSent: true, workspaceId: "ws_xxx", seeded: true }

Concurrency Control

// workflows/api-sync.ts — Rate-limited external API calls
const syncWorkflow = hatchet.workflow({
  name: "api-sync",
  concurrency: {
    maxRuns: 5,              // Max 5 concurrent workflow runs
    limitStrategy: "QUEUE",  // Queue excess, don't drop
  },
});

syncWorkflow.step("fetch-data", async (ctx) => {
  const { apiEndpoint } = ctx.input();
  const data = await fetch(apiEndpoint).then(r => r.json());
  return { records: data.length };
}, {
  retries: 3,
  backoff: { type: "exponential", base: 2 },
  timeout: "30s",
  concurrency: { key: "api-provider", maxRuns: 10 },  // Per-key limit
});

Scheduled Workflows

// workflows/daily-report.ts — Cron-triggered workflow
const reportWorkflow = hatchet.workflow({
  name: "daily-report",
  on: { cron: "0 9 * * *" },  // 9 AM daily
});

reportWorkflow.step("generate", async (ctx) => {
  const stats = await generateDailyStats();
  return stats;
});

reportWorkflow.step("send", async (ctx) => {
  const stats = ctx.stepOutput("generate");
  await sendSlackReport(stats);
}, { parents: ["generate"] });

Examples

Example 1: Order processing pipeline

User prompt: "Build a reliable order processing workflow — validate, charge, fulfill, notify."

The agent will create a Hatchet workflow with sequential steps, payment retry logic, and parallel notification to customer + warehouse.

Example 2: AI agent orchestration

User prompt: "Run an AI pipeline: scrape data → process → generate report → email."

The agent will create a DAG workflow with fan-out scraping, aggregation step, LLM generation, and email delivery with retries.

Guidelines

  • Workflows are DAGs — define step dependencies with parents
  • Retries are per-step — each step can have its own retry policy
  • Timeouts prevent hung jobs — always set per-step and per-workflow timeouts
  • Concurrency control — limit parallel runs globally or per-key
  • Events for decoupling — trigger workflows from events, not direct calls
  • ctx.stepOutput() passes data between steps — typed step results
  • Idempotency — design steps to be safely retried
  • Self-hostable — Postgres + Hatchet engine
  • Dashboard for monitoring — see running workflows, failed steps, retry history
  • Backoff strategies — exponential, linear, or constant for retries

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • Hatchet 提供高价值的分布式任务队列与 DAG 工作流编排能力,适用于支付处理、数据管道、AI 代理编排等核心业务场景,显著提升后台任务可靠性与效率。
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖 'background jobs'、'Hatchet'、'workflow orchestration' 等多种变体,边界清晰,便于用户准确触发。
Structure and Standards95/100

Highlights

  • 文档结构清晰完整,包含端到端代码示例、使用场景说明与最佳实践指南,frontmatter 信息齐全,易于理解与执行。
Execution Reliability90/100

Highlights

  • 提供可靠的错误处理机制(重试、超时、退避策略)、并发控制与事件驱动触发,工具来源明确,覆盖主要异常场景。
Evidence Verifiability (mean of the first four)93/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 38

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

```bash npm install @hatchet-dev/typescript-sdk

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.