AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Agent Task State Machine

skill-hsienw-ai-agent-engineering-playbook-agent-task-state-machine · by HsienW

Design and review generic agent task and step state machines. Use when adding business-level task progress, step lifecycle tracking, task events, persistence, streaming timelines, resumable task state, or cross-layer task status APIs.

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-hsienw-ai-agent-engineering-playbook-agent-task-state-machine

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-hsienw-ai-agent-engineering-playbook-agent-task-state-machine)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
16d ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Agent Task State Machine? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Agent Task State Machine

Skill Interface

  • Name: agent-task-state-machine.
  • Description: Design and review generic agent task and step state machines for business-level task progress, step lifecycle tracking, task events, persistence, streaming timelines, resumable task state, and cross-layer status APIs.
  • Parameters: Task statuses, step statuses, legal transitions, event model, persistence requirements, retry and compensation rules, timeline consumers, redaction policy, and lifecycle verification cases.
  • Instructions: Use this skill when product or operator workflows need task semantics beyond graph checkpoints. Define legal transitions in one module, keep terminal states final, persist append-only events when history matters, and test lifecycle, retry, resume, cancellation, and compensation paths.

Model business progress separately from graph execution state. A graph may checkpoint execution, but product and operator workflows often need task, step, audit, and timeline semantics.

Core Model

Use generic names and inject domain-specific step names from the caller:

type TaskStatus =
  | 'created'
  | 'running'
  | 'waiting_confirmation'
  | 'completed'
  | 'partially_failed'
  | 'compensating'
  | 'failed'
  | 'cancelled';

type StepStatus =
  | 'pending'
  | 'running'
  | 'waiting_confirmation'
  | 'succeeded'
  | 'retryable_failed'
  | 'terminal_failed'
  | 'compensating'
  | 'compensated'
  | 'skipped';

type AgentTask = {
  taskId: string;
  taskType: string;
  status: TaskStatus;
  steps: AgentStep[];
  createdAt: string;
  updatedAt: string;
  metadata?: Record;
};

type AgentStep = {
  stepId: string;
  stepName: TStep;
  status: StepStatus;
  attempt: number;
  maxAttempts: number;
  input?: unknown;
  output?: unknown;
  error?: StepError;
  startedAt?: string;
  completedAt?: string;
};

Transition Rules

  • Define legal transitions in one owned module.
  • Reject illegal transitions with stable error codes.
  • Terminal states must not transition back to running.
  • Step completion should drive task completion only through an explicit policy.
  • Store transition events before notifying downstream listeners when durable

history matters.

  • Preserve enough data to resume or explain an interrupted task.

Event Model

Use append-only task events:

  • task_created
  • step_started
  • step_completed
  • step_failed
  • step_retrying
  • waiting_confirmation
  • resumed
  • task_completed
  • task_failed
  • compensation_triggered
  • compensation_completed

Events should include identifiers, event type, payload, and creation time. Keep payloads structured, redacted, and safe for persistence.

Verification

Test complete lifecycle, illegal transitions, retryable and terminal failures, waiting and resume, cancellation, partial failure, compensation, event ordering, and timeline rendering from persisted events.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.