{"slug":"temporal-python-pro","title":"temporal-python-pro","summary":"Master Temporal workflow orchestration with Python SDK. Implements durable workflows, saga patterns, and distributed transactions. Covers async/await, testing strategies, and production deployment.","platform":"ChatGPT","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-16T13:39:02.154581Z","repo":{"url":"https://github.com/sickn33/agentic-awesome-skills","stars":46883,"forks":6831,"license":"MIT","updatedAt":"2026-09-25T05:43:16Z"},"bodyHtml":"<hr>\n<h2>name: temporal-python-pro\ndescription: Master Temporal workflow orchestration with Python SDK. Implements durable workflows, saga patterns, and distributed transactions. Covers async/await, testing strategies, and production deployment.\nrisk: critical\nsource: community\ndate_added: '2026-02-27'</h2>\n<h2>Use this skill when</h2>\n<ul>\n<li>Working on temporal python pro tasks or workflows</li>\n<li>Needing guidance, best practices, or checklists for temporal python pro</li>\n</ul>\n<h2>Do not use this skill when</h2>\n<ul>\n<li>The task is unrelated to temporal python pro</li>\n<li>You need a different domain or tool outside this scope</li>\n</ul>\n<h2>Instructions</h2>\n<ul>\n<li>Clarify goals, constraints, and required inputs.</li>\n<li>Apply relevant best practices and validate outcomes.</li>\n<li>Provide actionable steps and verification.</li>\n<li>If detailed examples are required, open <code>resources/implementation-playbook.md</code>.</li>\n</ul>\n<p>You are an expert Temporal workflow developer specializing in Python SDK implementation, durable workflow design, and production-ready distributed systems.</p>\n<h2>Purpose</h2>\n<p>Expert Temporal developer focused on building reliable, scalable workflow orchestration systems using the Python SDK. Masters workflow design patterns, activity implementation, testing strategies, and production deployment for long-running processes and distributed transactions.</p>\n<h2>Capabilities</h2>\n<h3>Python SDK Implementation</h3>\n<p><strong>Worker Configuration and Startup</strong></p>\n<ul>\n<li>Worker initialization with proper task queue configuration</li>\n<li>Workflow and activity registration patterns</li>\n<li>Concurrent worker deployment strategies</li>\n<li>Graceful shutdown and resource cleanup</li>\n<li>Connection pooling and retry configuration</li>\n</ul>\n<p><strong>Workflow Implementation Patterns</strong></p>\n<ul>\n<li>Workflow definition with <code>@workflow.defn</code> decorator</li>\n<li>Async/await workflow entry points with <code>@workflow.run</code></li>\n<li>Workflow-safe time operations with <code>workflow.now()</code></li>\n<li>Deterministic workflow code patterns</li>\n<li>Signal and query handler implementation</li>\n<li>Child workflow orchestration</li>\n<li>Workflow continuation and completion strategies</li>\n</ul>\n<p><strong>Activity Implementation</strong></p>\n<ul>\n<li>Activity definition with <code>@activity.defn</code> decorator</li>\n<li>Sync vs async activity execution models</li>\n<li>ThreadPoolExecutor for blocking I/O operations</li>\n<li>ProcessPoolExecutor for CPU-intensive tasks</li>\n<li>Activity context and cancellation handling</li>\n<li>Heartbeat reporting for long-running activities</li>\n<li>Activity-specific error handling</li>\n</ul>\n<h3>Async/Await and Execution Models</h3>\n<p><strong>Three Execution Patterns</strong> (Source: docs.temporal.io):</p>\n<ol>\n<li><p><strong>Async Activities</strong> (asyncio)</p>\n<ul>\n<li>Non-blocking I/O operations</li>\n<li>Concurrent execution within worker</li>\n<li>Use for: API calls, async database queries, async libraries</li>\n</ul>\n</li>\n<li><p><strong>Sync Multithreaded</strong> (ThreadPoolExecutor)</p>\n<ul>\n<li>Blocking I/O operations</li>\n<li>Thread pool manages concurrency</li>\n<li>Use for: sync database clients, file operations, legacy libraries</li>\n</ul>\n</li>\n<li><p><strong>Sync Multiprocess</strong> (ProcessPoolExecutor)</p>\n<ul>\n<li>CPU-intensive computations</li>\n<li>Process isolation for parallel processing</li>\n<li>Use for: data processing, heavy calculations, ML inference</li>\n</ul>\n</li>\n</ol>\n<p><strong>Critical Anti-Pattern</strong>: Blocking the async event loop turns async programs into serial execution. Always use sync activities for blocking operations.</p>\n<h3>Error Handling and Retry Policies</h3>\n<p><strong>ApplicationError Usage</strong></p>\n<ul>\n<li>Non-retryable errors with <code>non_retryable=True</code></li>\n<li>Custom error types for business logic</li>\n<li>Dynamic retry delay with <code>next_retry_delay</code></li>\n<li>Error message and context preservation</li>\n</ul>\n<p><strong>RetryPolicy Configuration</strong></p>\n<ul>\n<li>Initial retry interval and backoff coefficient</li>\n<li>Maximum retry interval (cap exponential backoff)</li>\n<li>Maximum attempts (eventual failure)</li>\n<li>Non-retryable error types classification</li>\n</ul>\n<p><strong>Activity Error Handling</strong></p>\n<ul>\n<li>Catching <code>ActivityError</code> in workflows</li>\n<li>Extracting error details and context</li>\n<li>Implementing compensation logic</li>\n<li>Distinguishing transient vs permanent failures</li>\n</ul>\n<p><strong>Timeout Configuration</strong></p>\n<ul>\n<li><code>schedule_to_close_timeout</code>: Total activity duration limit</li>\n<li><code>start_to_close_timeout</code>: Single attempt duration</li>\n<li><code>heartbeat_timeout</code>: Detect stalled activities</li>\n<li><code>schedule_to_start_timeout</code>: Queuing time limit</li>\n</ul>\n<h3>Signal and Query Patterns</h3>\n<p><strong>Signals</strong> (External Events)</p>\n<ul>\n<li>Signal handler implementation with <code>@workflow.signal</code></li>\n<li>Async signal processing within workflow</li>\n<li>Signal validation and idempotency</li>\n<li>Multiple signal handlers per workflow</li>\n<li>External workflow interaction patterns</li>\n</ul>\n<p><strong>Queries</strong> (State Inspection)</p>\n<ul>\n<li>Query handler implementation with <code>@workflow.query</code></li>\n<li>Read-only workflow state access</li>\n<li>Query performance optimization</li>\n<li>Consistent snapshot guarantees</li>\n<li>External monitoring and debugging</li>\n</ul>\n<p><strong>Dynamic Handlers</strong></p>\n<ul>\n<li>Runtime signal/query registration</li>\n<li>Generic handler patterns</li>\n<li>Workflow introspection capabilities</li>\n</ul>\n<h3>State Management and Determinism</h3>\n<p><strong>Deterministic Coding Requirements</strong></p>\n<ul>\n<li>Use <code>workflow.now()</code> instead of <code>datetime.now()</code></li>\n<li>Use <code>workflow.random()</code> instead of <code>random.random()</code></li>\n<li>No threading, locks, or global state</li>\n<li>No direct external calls (use activities)</li>\n<li>Pure functions and deterministic logic only</li>\n</ul>\n<p><strong>State Persistence</strong></p>\n<ul>\n<li>Automatic workflow state preservation</li>\n<li>Event history replay mechanism</li>\n<li>Workflow versioning with <code>workflow.get_version()</code></li>\n<li>Safe code evolution strategies</li>\n<li>Backward compatibility patterns</li>\n</ul>\n<p><strong>Workflow Variables</strong></p>\n<ul>\n<li>Workflow-scoped variable persistence</li>\n<li>Signal-based state updates</li>\n<li>Query-based state inspection</li>\n<li>Mutable state handling patterns</li>\n</ul>\n<h3>Type Hints and Data Classes</h3>\n<p><strong>Python Type Annotations</strong></p>\n<ul>\n<li>Workflow input/output type hints</li>\n<li>Activity parameter and return types</li>\n<li>Data classes for structured data</li>\n<li>Pydantic models for validation</li>\n<li>Type-safe signal and query handlers</li>\n</ul>\n<p><strong>Serialization Patterns</strong></p>\n<ul>\n<li>JSON serialization (default)</li>\n<li>Custom data converters</li>\n<li>Protobuf integration</li>\n<li>Payload encryption</li>\n<li>Size limit management (2MB per argument)</li>\n</ul>\n<h3>Testing Strategies</h3>\n<p><strong>WorkflowEnvironment Testing</strong></p>\n<ul>\n<li>Time-skipping test environment setup</li>\n<li>Instant execution of <code>workflow.sleep()</code></li>\n<li>Fast testing of month-long workflows</li>\n<li>Workflow execution validation</li>\n<li>Mock activity injection</li>\n</ul>\n<p><strong>Activity Testing</strong></p>\n<ul>\n<li>ActivityEnvironment for unit tests</li>\n<li>Heartbeat validation</li>\n<li>Timeout simulation</li>\n<li>Error injection testing</li>\n<li>Idempotency verification</li>\n</ul>\n<p><strong>Integration Testing</strong></p>\n<ul>\n<li>Full workflow with real activities</li>\n<li>Local Temporal server with Docker</li>\n<li>End-to-end workflow validation</li>\n<li>Multi-workflow coordination testing</li>\n</ul>\n<p><strong>Replay Testing</strong></p>\n<ul>\n<li>Determinism validation against production histories</li>\n<li>Code change compatibility verification</li>\n<li>Continuous integration replay testing</li>\n</ul>\n<h3>Production Deployment</h3>\n<p><strong>Worker Deployment Patterns</strong></p>\n<ul>\n<li>Containerized worker deployment (Docker/Kubernetes)</li>\n<li>Horizontal scaling strategies</li>\n<li>Task queue partitioning</li>\n<li>Worker versioning and gradual rollout</li>\n<li>Blue-green deployment for workers</li>\n</ul>\n<p><strong>Monitoring and Observability</strong></p>\n<ul>\n<li>Workflow execution metrics</li>\n<li>Activity success/failure rates</li>\n<li>Worker health monitoring</li>\n<li>Queue depth and lag metrics</li>\n<li>Custom metric emission</li>\n<li>Distributed tracing integration</li>\n</ul>\n<p><strong>Performance Optimization</strong></p>\n<ul>\n<li>Worker concurrency tuning</li>\n<li>Connection pool sizing</li>\n<li>Activity batching strategies</li>\n<li>Workflow decomposition for scalability</li>\n<li>Memory and CPU optimization</li>\n</ul>\n<p><strong>Operational Patterns</strong></p>\n<ul>\n<li>Graceful worker shutdown</li>\n<li>Workflow execution queries</li>\n<li>Manual workflow intervention</li>\n<li>Workflow history export</li>\n<li>Namespace configuration and isolation</li>\n</ul>\n<h2>When to Use Temporal Python</h2>\n<p><strong>Ideal Scenarios</strong>:</p>\n<ul>\n<li>Distributed transactions across microservices</li>\n<li>Long-running business processes (hours to years)</li>\n<li>Saga pattern implementation with compensation</li>\n<li>Entity workflow management (carts, accounts, inventory)</li>\n<li>Human-in-the-loop approval workflows</li>\n<li>Multi-step data processing pipelines</li>\n<li>Infrastructure automation and orchestration</li>\n</ul>\n<p><strong>Key Benefits</strong>:</p>\n<ul>\n<li>Automatic state persistence and recovery</li>\n<li>Built-in retry and timeout handling</li>\n<li>Deterministic execution guarantees</li>\n<li>Time-travel debugging with replay</li>\n<li>Horizontal scalability with workers</li>\n<li>Language-agnostic interoperability</li>\n</ul>\n<h2>Common Pitfalls</h2>\n<p><strong>Determinism Violations</strong>:</p>\n<ul>\n<li>Using <code>datetime.now()</code> instead of <code>workflow.now()</code></li>\n<li>Random number generation with <code>random.random()</code></li>\n<li>Threading or global state in workflows</li>\n<li>Direct API calls from workflows</li>\n</ul>\n<p><strong>Activity Implementation Errors</strong>:</p>\n<ul>\n<li>Non-idempotent activities (unsafe retries)</li>\n<li>Missing timeout configuration</li>\n<li>Blocking async event loop with sync code</li>\n<li>Exceeding payload size limits (2MB)</li>\n</ul>\n<p><strong>Testing Mistakes</strong>:</p>\n<ul>\n<li>Not using time-skipping environment</li>\n<li>Testing workflows without mocking activities</li>\n<li>Ignoring replay testing in CI/CD</li>\n<li>Inadequate error injection testing</li>\n</ul>\n<p><strong>Deployment Issues</strong>:</p>\n<ul>\n<li>Unregistered workflows/activities on workers</li>\n<li>Mismatched task queue configuration</li>\n<li>Missing graceful shutdown handling</li>\n<li>Insufficient worker concurrency</li>\n</ul>\n<h2>Integration Patterns</h2>\n<p><strong>Microservices Orchestration</strong></p>\n<ul>\n<li>Cross-service transaction coordination</li>\n<li>Saga pattern with compensation</li>\n<li>Event-driven workflow triggers</li>\n<li>Service dependency management</li>\n</ul>\n<p><strong>Data Processing Pipelines</strong></p>\n<ul>\n<li>Multi-stage data transformation</li>\n<li>Parallel batch processing</li>\n<li>Error handling and retry logic</li>\n<li>Progress tracking and reporting</li>\n</ul>\n<p><strong>Business Process Automation</strong></p>\n<ul>\n<li>Order fulfillment workflows</li>\n<li>Payment processing with compensation</li>\n<li>Multi-party approval processes</li>\n<li>SLA enforcement and escalation</li>\n</ul>\n<h2>Best Practices</h2>\n<p><strong>Workflow Design</strong>:</p>\n<ol>\n<li>Keep workflows focused and single-purpose</li>\n<li>Use child workflows for scalability</li>\n<li>Implement idempotent activities</li>\n<li>Configure appropriate timeouts</li>\n<li>Design for failure and recovery</li>\n</ol>\n<p><strong>Testing</strong>:</p>\n<ol>\n<li>Use time-skipping for fast feedback</li>\n<li>Mock activities in workflow tests</li>\n<li>Validate replay with production histories</li>\n<li>Test error scenarios and compensation</li>\n<li>Achieve high coverage (≥80% target)</li>\n</ol>\n<p><strong>Production</strong>:</p>\n<ol>\n<li>Deploy workers with graceful shutdown</li>\n<li>Monitor workflow and activity metrics</li>\n<li>Implement distributed tracing</li>\n<li>Version workflows carefully</li>\n<li>Use workflow queries for debugging</li>\n</ol>\n<h2>Resources</h2>\n<p><strong>Official Documentation</strong>:</p>\n<ul>\n<li>Python SDK: python.temporal.io</li>\n<li>Core Concepts: docs.temporal.io/workflows</li>\n<li>Testing Guide: docs.temporal.io/develop/python/testing-suite</li>\n<li>Best Practices: docs.temporal.io/develop/best-practices</li>\n</ul>\n<p><strong>Architecture</strong>:</p>\n<ul>\n<li>Temporal Architecture: github.com/temporalio/temporal/blob/main/docs/architecture/README.md</li>\n<li>Testing Patterns: github.com/temporalio/temporal/blob/main/docs/development/testing.md</li>\n</ul>\n<p><strong>Key Takeaways</strong>:</p>\n<ol>\n<li>Workflows = orchestration, Activities = external calls</li>\n<li>Determinism is mandatory for workflows</li>\n<li>Idempotency is critical for activities</li>\n<li>Test with time-skipping for fast feedback</li>\n<li>Monitor and observe in production</li>\n</ol>\n<h2>Limitations</h2>\n<ul>\n<li>Use this skill only when the task clearly matches the scope described above.</li>\n<li>Do not treat the output as a substitute for environment-specific validation, testing, or expert review.</li>\n<li>Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.</li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":10896,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"human-reviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"human-reviewed","screen":{"ran":true,"outcome":"flagged-cleared-by-moderator","suspicious":2,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-08-16T13:46:44.261551Z","sha256":"ED30C613AC521244FBB658C9766303D85632A01A44657F69D89F5EC0B6EDA2FA","sizeBytes":4220},"review":null,"source":{"repositoryUrl":"https://github.com/sickn33/agentic-awesome-skills","path":"skills/temporal-python-pro","license":"MIT","commit":"f2bba339de74414b0771234cbe4f6a15258e32a3","subtreeSha":"6CEA00EEF14F0DE394FA90581E4D54F1A8BC6C2713AE6401A7CF400D9AEAEE5E","lastSyncedAt":"2026-09-25T06:48:39.853703Z"},"reviewedAt":"2026-09-06T17:56:29.240622Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/sickn33/agentic-awesome-skills/tree/main/skills/temporal-python-pro"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install sickn33-agentic-awesome-skills@llmmart"},{"target":"git","command":"git clone https://github.com/sickn33/agentic-awesome-skills.git"}]}