Durable Agents (Mastra + Trigger.dev) for Openclaw

A robust framework for building autonomous multi-agent pipelines where Mastra handles reasoning and Trigger.dev ensures durable task execution with retries and fan-out.

ainakwalamonk
v1.0.0
Feb 26, 2026
1
1.2k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install durable-agents

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install durable-agents using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Durable Agents (Mastra + Trigger.dev)?

This skill provides a comprehensive architectural pattern for developing autonomous multi-agent pipelines. It leverages the Mastra AI agent framework for reasoning and Trigger.dev for reliable, durable task execution. By utilizing Openclaw Skills, developers can decouple intelligence from code by defining agent personas in Markdown files while maintaining strict control over execution lifecycles, retries, and error handling.

The core value proposition lies in its ability to create complex, multi-stage workflows where each agent owns a single responsibility. This ensures that no single agent holds excessive context, and every transition between agents is mediated by a durable task engine and a persistent database record layer.

Durable Agents (Mastra + Trigger.dev) Use Cases

  • Creating multi-stage AI content generation and validation pipelines.
  • Building autonomous agents that require human-in-the-loop approval checkpoints.
  • Implementing complex task chains that need parallel execution (fan-out) and automatic retries.
  • Developing secure agentic tools for destructive actions like database deletions or external API publishing.
  • Architecting high-reliability AI systems where every decision and output must be persisted for auditing.

How Durable Agents (Mastra + Trigger.dev) Works

  1. Define the agent's logic, tools, and goals within a dedicated AGENT.md file to separate intelligence from boilerplate code.
  2. Wrap agent execution within Trigger.dev tasks to provide automatic retries, timeouts, and structured error handling.
  3. Implement tools that return standardized success or error objects instead of throwing exceptions, ensuring pipeline stability.
  4. Orchestrate pipeline stages by chaining tasks sequentially using triggerAndWait or in parallel using batchTrigger.
  5. Persist all agentic inputs, outputs, and intermediate states to a database record layer to act as the source of truth for the entire pipeline.

Durable Agents (Mastra + Trigger.dev) Setup

Before using this skill, ensure you have followed the primary setup instructions.

# Install core dependencies
npm install @mastra/core @trigger.dev/sdk zod

# Create the agent directory structure
mkdir -p src/agents/my-agent
touch src/agents/my-agent/AGENT.md src/agents/my-agent/my-agent.ts

Configure your model settings in src/config/model.ts and ensure all tasks are exported from src/trigger/index.ts to allow the worker to discover your pipeline components.

Durable Agents (Mastra + Trigger.dev) Data Schema & Taxonomy

The skill utilizes a structured record layer to manage state. Every task transition uses database records to gate progress and prevent data loss.

Attribute Description
Status Transitions Records move through states: pending, processing, draft, approved, rejected, published, or failed.
Input Payloads All data passed to an agent is typed with Zod and stored in the database.
Output Contracts Structured JSON outputs from agents are validated against schemas and persisted before the next stage.
Tool Records Destructive tools operate only on specific record IDs to prevent accidental bulk operations.

Durable Agents (Mastra + Trigger.dev) Advanced Features

  • Multi-agent handoffs using structured output contracts validated by Zod.
  • Permission-gated tools that require explicit human or task-level confirmation for side effects.
  • Review checkpoints supporting three modes: Auto-approve, Agent-led review, or Human-in-the-loop.
  • Deduplication patterns that check the database for existing results before triggering expensive LLM calls.
  • Comprehensive retry configurations for handling transient API failures in LLM providers via Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*