---
title: "Temporal で永続ワークフローを設計する（エージェント用スキル） | Orchestor"
description: "Temporal を使い、分散システムで処理を持続・再開できるワークフローを設計します。ワークフローとアクティビティの分離、Saga、状態管理、決定性の制約を扱い、長時間の処理、分散トランザクション、マイクロサービスの処理調整に使います。wshobson/agents が公開している「Temporal で永続ワークフローを設計する」の使い方を確認できます。"
canonical_url: "https://www.orchestor.io/ja/skills/wshobson/agents/workflow-orchestration-patterns"
markdown_url: "https://www.orchestor.io/ja/skills/wshobson/agents/workflow-orchestration-patterns.md"
---

[c96b5f6](https://github.com/wshobson/agents/commit/c96b5f6552dba32e4492307493ee613581430715)[原文を開く](https://github.com/wshobson/agents/blob/c96b5f6552dba32e4492307493ee613581430715/plugins/backend-development/skills/workflow-orchestration-patterns/SKILL.md)

wshobson2026/11/24

原文 (選択中)

未翻訳

プレビュー (選択中)

98 行（空行を除く 69 行） · 3.40 KB原文

```yaml
name: workflow-orchestration-patterns
description: Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.
```

# 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)

## Detailed patterns and worked examples

Detailed pattern documentation lives in details.md. Read that file when the navigation tier above is insufficient.

## 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

## Structured data

```json
[
  [
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Orchestor",
      "url": "https://www.orchestor.io",
      "sameAs": [
        "https://orchestor.io",
        "https://www.orchestor.io",
        "https://docs.orchestor.io"
      ],
      "@id": "https://www.orchestor.io/#organization",
      "alternateName": [
        "オーケスター"
      ],
      "logo": "https://www.orchestor.io/images/common/ogp/orchestor-ogp.png",
      "parentOrganization": {
        "@type": "Organization",
        "name": "ドットメディア株式会社",
        "url": "https://www.dotmedia.co.jp"
      }
    },
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "url": "https://www.orchestor.io",
      "name": "Orchestor",
      "description": "Orchestor で画像・動画・音声を作り、参照素材を Remix できます。",
      "@id": "https://www.orchestor.io/#website",
      "alternateName": [
        "オーケスター"
      ],
      "inLanguage": "ja",
      "publisher": {
        "@id": "https://www.orchestor.io/#organization"
      }
    }
  ],
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "@id": "https://www.orchestor.io/skills/wshobson/agents/workflow-orchestration-patterns#breadcrumb",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Orchestor",
        "item": "https://www.orchestor.io/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "スキル",
        "item": "https://www.orchestor.io/skills"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "Temporal で永続ワークフローを設計する",
        "item": "https://www.orchestor.io/skills/wshobson/agents/workflow-orchestration-patterns"
      }
    ]
  }
]
```

---

[Documentation index](https://www.orchestor.io/llms.txt)
