TOOL WIKI · RUNTIME & DEPLOYMENT
Temporal
Runs durable workflows with persisted progress and recovery mechanisms.
Jump to a section 10 sections
EXAMPLE USE CASE
Execute a recoverable order lookup activity
A developer needs a concrete execution environment for a background task, browser operation or service, with a visible terminal result.
- Input
- A workflow invocation with A104, a worker and a five-second activity deadline.
- Expected output
- A packed result plus persisted workflow/activity history.
- Success check: The workflow returns packed and its history includes one lookup activity.
- Try a failure: Stop/restart the worker and inspect history/retry behavior instead of sending a new unrelated workflow.
Example scope: Actual Temporal SDK/runtime integration; the activity is a read-only fixture rather than a remote write.
Set the allowed runtime, network access, credentials, and maximum duration.
inputTo 02 · TemporalLong-lived tasks with retries, waits, and external operations. Design side effects for idempotency and keep workflow execution rules explicit.
processTo 03 · Worker environmentRun only the workload and dependencies required for the task.
Check permissions at each resource service and reconcile uncertain writes.
Inspect files, records, and task-level acceptance criteria.
outputTo 06 · LifecycleRetain required artifacts, release temporary compute, and expire task credentials.
Result or stopping point
Long-lived tasks with retries, waits, and external operations. Design side effects for idempotency and keep workflow execution rules explicit.
When to consider it
- Long-lived tasks with retries, waits, and external operations.
A design decision to make
- Design side effects for idempotency and keep workflow execution rules explicit.
Prerequisites and setup
- Python 3.11+ and the official Temporal CLI. The start-dev service is a local development configuration.
python3 -m venv .venv
source .venv/bin/activate
pip install temporalio
# Terminal 1: leave the local development service running.
temporal server start-devTry a small integration
workflows.py
from datetime import timedelta
from temporalio import activity, workflow
from temporalio.common import RetryPolicy
@activity.defn
def lookup_order(order_id: str) -> str:
return {"A104":"packed"}.get(order_id,"not_found")
@workflow.defn
class OrderWorkflow:
@workflow.run
async def run(self, order_id: str) -> str:
return await workflow.execute_activity(lookup_order,order_id,
start_to_close_timeout=timedelta(seconds=5),retry_policy=RetryPolicy(maximum_attempts=3))worker.py
import asyncio
from temporalio.client import Client
from temporalio.worker import Worker
from workflows import OrderWorkflow, lookup_order
async def main():
client = await Client.connect("localhost:7233")
async with Worker(client,task_queue="asg-orders",workflows=[OrderWorkflow],activities=[lookup_order]):
await asyncio.Event().wait()
if __name__ == "__main__":
asyncio.run(main())start.py
import asyncio
from uuid import uuid4
from temporalio.client import Client
from workflows import OrderWorkflow
async def main():
client = await Client.connect("localhost:7233")
result = await client.execute_workflow(OrderWorkflow.run,"A104",
id="asg-"+str(uuid4()),task_queue="asg-orders")
print(result)
asyncio.run(main())Run and check the result
# Terminal 2
python worker.py
# Terminal 3
python start.py- The workflow returns packed and its history includes one lookup activity.
- Stop/restart the worker while a job is queued; it should resume from durable service state.
Common failures
- A worker accepting a job does not establish completion. Inspect the task result, failure and retry history.
- Do not expose a development control plane or unauthenticated execution endpoint publicly.
Production decisions
- Use bounded CPU/memory/time, restricted filesystem mounts and network access, short-lived secrets and per-user isolation.
- Preserve run/operation identifiers, cancellation and terminal states. Retryable remote writes need provider idempotency or reconciliation.
- Keep workflow code replay-safe and non-deterministic I/O in activities. Version workers/workflows and set retry/time limits for every activity.
Keep exploring
Explore the same layer
Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.