Token导航 LogoToken导航TokenDH.com
开发执行命令github未标认证来源可访问clear审计通过

workflow-orchestration-patterns工作流程编排模式

Agent Skill

workflow-orchestration-patterns 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

151,576

周安装

6,333

GitHub Stars

34,476

下载量

50,534
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:workflow-orchestration-patterns(工作流程编排模式)
来源仓库:https://github.com/wshobson/agents
仓库路径:skills/workflow-orchestration-patterns
安装命令:
npx skills add https://github.com/wshobson/agents --skill workflow-orchestration-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/wshobson/agents --skill workflow-orchestration-patterns

简介

使用 Temporal 设计持久的分布式工作流程,将编排逻辑与外部交互分开。

  • 工作流程处理编排和决策(必须是确定性的);活动处理 API 和数据库等外部调用(必须是幂等的)
  • 实现传奇模式,补偿分布式事务、长期状态管理的实体工作流以及并行执行的扇出/扇入
  • 通过事件历史记录实现故障时的自动状态保存;工作流程从上一个检查点确定性地重放
  • 涵盖确定性约束(工作流中无线程、random()、系统时间或直接 I/O)、重试策略、长时间运行活动的心跳以及幂等性要求

SKILL.md

Workflow Orchestration Patterns

Master workflow orchestration architecture with Temporal, covering fundamental design decisions, resilience patterns, and best practices for building reliable distributed systems.

When to Use Workflow Orchestration

Ideal Use Cases (Source: docs.temporal.io)

  • Multi-step processes spanning machines/services/databases
  • Distributed transactions requiring all-or-nothing semantics
  • Long-running workflows (hours to years) with automatic state persistence
  • Failure recovery that must resume from last successful step
  • Business processes: bookings, orders, campaigns, approvals
  • Entity lifecycle management: inventory tracking, account management, cart workflows
  • Infrastructure automation: CI/CD pipelines, provisioning, deployments
  • Human-in-the-loop systems requiring timeouts and escalations

When NOT to Use

  • Simple CRUD operations (use direct API calls)
  • Pure data processing pipelines (use Airflow, batch processing)
  • Stateless request/response (use standard APIs)
  • Real-time streaming (use Kafka, event processors)

Critical Design Decision: Workflows vs Activities

The Fundamental Rule (Source: temporal.io/blog/workflow-engine-principles):

  • Workflows = Orchestration logic and decision-making
  • Activities = External interactions (APIs, databases, network calls)

Workflows (Orchestration)

Characteristics:

  • Contain business logic and coordination
  • MUST be deterministic (same inputs → same outputs)
  • Cannot perform direct external calls
  • State automatically preserved across failures
  • Can run for years despite infrastructure failures

Example workflow tasks:

  • Decide which steps to execute
  • Handle compensation logic
  • Manage timeouts and retries
  • Coordinate child workflows

Activities (External Interactions)

Characteristics:

  • Handle all external system interactions
  • Can be non-deterministic (API calls, DB writes)
  • Include built-in timeouts and retry logic
  • Must be idempotent (calling N times = calling once)
  • Short-lived (seconds to minutes typically)

Example activity tasks:

  • Call payment gateway API
  • Write to database
  • Send emails or notifications
  • Query external services

Design Decision Framework

Does it touch external systems? → Activity
Is it orchestration/decision logic? → Workflow

Core Workflow Patterns

1. Saga Pattern with Compensation

Purpose: Implement distributed transactions with rollback capability

Pattern (Source: temporal.io/blog/compensating-actions-part-of-a-complete-breakfast-with-sagas):

For each step:
  1. Register compensation BEFORE executing
  2. Execute the step (via activity)
  3. On failure, run all compensations in reverse order (LIFO)

Example: Payment Workflow

  1. Reserve inventory (compensation: release inventory)
  2. Charge payment (compensation: refund payment)
  3. Fulfill order (compensation: cancel fulfillment)

Critical Requirements:

  • Compensations must be idempotent
  • Register compensation BEFORE executing step
  • Run compensations in reverse order
  • Handle partial failures gracefully

2. Entity Workflows (Actor Model)

Purpose: Long-lived workflow representing single entity instance

Pattern (Source: docs.temporal.io/evaluate/use-cases-design-patterns):

  • One workflow execution = one entity (cart, account, inventory item)
  • Workflow persists for entity lifetime
  • Receives signals for state changes
  • Supports queries for current state

Example Use Cases:

  • Shopping cart (add items, checkout, expiration)
  • Bank account (deposits, withdrawals, balance checks)
  • Product inventory (stock updates, reservations)

Benefits:

  • Encapsulates entity behavior
  • Guarantees consistency per entity
  • Natural event sourcing

3. Fan-Out/Fan-In (Parallel Execution)

Purpose: Execute multiple tasks in parallel, aggregate results

Pattern:

  • Spawn child workflows or parallel activities
  • Wait for all to complete
  • Aggregate results
  • Handle partial failures

Scaling Rule (Source: temporal.io/blog/workflow-engine-principles):

  • Don't scale individual workflows
  • For 1M tasks: spawn 1K child workflows × 1K tasks each
  • Keep each workflow bounded

4. Async Callback Pattern

Purpose: Wait for external event or human approval

Pattern:

  • Workflow sends request and waits for signal
  • External system processes asynchronously
  • Sends signal to resume workflow
  • Workflow continues with response

Use Cases:

  • Human approval workflows
  • Webhook callbacks
  • Long-running external processes

State Management and Determinism

Automatic State Preservation

How Temporal Works (Source: docs.temporal.io/workflows):

  • Complete program state preserved automatically
  • Event History records every command and event
  • Seamless recovery from crashes
  • Applications restore pre-failure state

Determinism Constraints

Workflows Execute as State Machines:

  • Replay behavior must be consistent
  • Same inputs → identical outputs every time

Prohibited in Workflows (Source: docs.temporal.io/workflows):

  • ❌ Threading, locks, synchronization primitives
  • ❌ Random number generation (random())
  • ❌ Global state or static variables
  • ❌ System time (datetime.now())
  • ❌ Direct file I/O or network calls
  • ❌ Non-deterministic libraries

Allowed in Workflows:

  • workflow.now() (deterministic time)
  • workflow.random() (deterministic random)
  • ✅ Pure functions and calculations
  • ✅ Calling activities (non-deterministic operations)

Versioning Strategies

Challenge: Changing workflow code while old executions still running

Solutions:

  1. Versioning API: Use workflow.get_version() for safe changes
  2. New Workflow Type: Create new workflow, route new executions to it
  3. Backward Compatibility: Ensure old events replay correctly

Resilience and Error Handling

Retry Policies

Default Behavior: Temporal retries activities forever

Configure Retry:

  • Initial retry interval
  • Backoff coefficient (exponential backoff)
  • Maximum interval (cap retry delay)
  • Maximum attempts (eventually fail)

Non-Retryable Errors:

  • Invalid input (validation failures)
  • Business rule violations
  • Permanent failures (resource not found)

Idempotency Requirements

Why Critical (Source: docs.temporal.io/activities):

  • Activities may execute multiple times
  • Network failures trigger retries
  • Duplicate execution must be safe

Implementation Strategies:

  • Idempotency keys (deduplication)
  • Check-then-act with unique constraints
  • Upsert operations instead of insert
  • Track processed request IDs

Activity Heartbeats

Purpose: Detect stalled long-running activities

Pattern:

  • Activity sends periodic heartbeat
  • Includes progress information
  • Timeout if no heartbeat received
  • Enables progress-based retry

Best Practices

Workflow Design

  1. Keep workflows focused - Single responsibility per workflow
  2. Small workflows - Use child workflows for scalability
  3. Clear boundaries - Workflow orchestrates, activities execute
  4. Test locally - Use time-skipping test environment

Activity Design

  1. Idempotent operations - Safe to retry
  2. Short-lived - Seconds to minutes, not hours
  3. Timeout configuration - Always set timeouts
  4. Heartbeat for long tasks - Report progress
  5. Error handling - Distinguish retryable vs non-retryable

Common Pitfalls

Workflow Violations:

  • Using datetime.now() instead of workflow.now()
  • Threading or async operations in workflow code
  • Calling external APIs directly from workflow
  • Non-deterministic logic in workflows

Activity Mistakes:

  • Non-idempotent operations (can't handle retries)
  • Missing timeouts (activities run forever)
  • No error classification (retry validation errors)
  • Ignoring payload limits (2MB per argument)

Operational Considerations

Monitoring:

  • Workflow execution duration
  • Activity failure rates
  • Retry attempts and backoff
  • Pending workflow counts

Scalability:

  • Horizontal scaling with workers
  • Task queue partitioning
  • Child workflow decomposition
  • Activity batching when appropriate

Additional Resources

Official Documentation:

  • Temporal Core Concepts: docs.temporal.io/workflows
  • Workflow Patterns: docs.temporal.io/evaluate/use-cases-design-patterns
  • Best Practices: docs.temporal.io/develop/best-practices
  • Saga Pattern: temporal.io/blog/saga-pattern-made-easy

Key Principles:

  1. Workflows = orchestration, Activities = external calls
  2. Determinism is non-negotiable for workflows
  3. Idempotency is critical for activities
  4. State preservation is automatic
  5. Design for failure and recovery

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.49%
按下载量换算14,902

Cursor

24.61%
按下载量换算12,436

OpenCode

16.71%
按下载量换算8,444

Gemini CLI

12.72%
按下载量换算6,428

Antigravity

8.04%
按下载量换算4,063

Codex

3.67%
按下载量换算1,855

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/wshobson/agents --skill workflow-orchestration-patterns;npx skills add wshobson/agents --skill "workflow-orchestration-patterns" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills