Durable execution
How long-running work is retried, paused for approval, and inspected.
Work Request lifecycle
The Temporal adapter executes ordered Work Items as activities. Each step may specify an agent, prompt, model endpoint, tool configuration, and whether human approval is required. Workflow state is queryable while work is running or waiting for approval.
Retries and gates
The adapter configures a 30-minute activity timeout and a maximum of three activity attempts. A gated step waits for an approve or rework signal; rework attempts are bounded. Failures and approvals are visible as workflow state rather than relying on an in-memory chat loop.
Workflow states
The adapter reports Running as steps execute, WaitingForApproval at a human gate, Rework when a revision is requested, Failed on an activity error or an exhausted rework limit, and Succeeded after the last step. The current step, rework count, results, and timestamps are queryable.
- Running: inspect the current step and activity progress before intervening.
- WaitingForApproval: check the work item result and send a decision through the configured approval integration.
- Rework: the adapter restarts at its first step; downstream calls must tolerate repetition.
- Failed: preserve evidence of the failing activity and fix the dependency before a new attempt.
Durability boundaries
Temporal records workflow history and can replay workflow decisions after a worker restart. Durable state does not make an external HTTP call exactly once. A tool can succeed just before a worker fails, then receive a retry; design writes to be idempotent and distinguish a retry from a new request.
The source WorkRequestWorkflow configures a 30-minute StartToCloseTimeout and three activity attempts. The current workflow caps rework attempts at three in code; the Process schema also exposes maxReworkAttempts, but confirm whether a given adapter deployment actually applies the Process override rather than assuming that a schema field changes runtime behavior.
Operate safely
- Choose idempotent tool actions, particularly when an activity may retry.
- Require approval before irreversible or sensitive actions.
- Correlate tool invocation, completion, and failure events with the Run before retrying.
- Keep external dependencies and Temporal persistence available for the desired recovery guarantees.
Validate a deployment
Start a small non-production workflow with a gate, stop the worker while it is waiting, restart the worker, and verify that the state and pending decision remain intact. Repeat with a failing tool to verify retry count and error visibility. Do not use customer data or irreversible operations in the test.