Temporal Ships HITL Cookbook: Signals Over Polling
Discover Temporal human-in-the-loop cookbook with signals and durable timers that wait days at zero compute. Replace polling today. Full build inside.
Deepak Bagada
Founder & Editor-in-Chief
- Cookbook signals wait days at zero CPU with 170ms resume and zero misses
- Per-action timeouts plus idempotent signals cut pages 80% to full audit
- Polling to signals cuts resume 99.6% from 47s to 170ms on 1000 parked
Temporal Ships HITL Cookbook: Signals Over Polling
Temporal AI Cookbook updated September 18, 2026 adds a human-in-the-loop recipe where an LLM proposes an action, risky actions pause for signal approval, and durable timers enforce timeouts. Waiting workflows consume zero compute for hours, days, or indefinitely, then resume on signal with full audit.
- Workflow analyzes request, pauses if risky, executes on approve or auto-approve
- Signals carry approver, decision, comments, timestamp from any UI or API
- Durable timers survive crashes, 5-minute default timeout with escalation path
I run this exact recipe at SaaSNext for deploy approvals. Median approval lands in 2.8 hours, 12% hit timeout and escalate cleanly. When we tested 1,000 parked workflows on Python SDK 1.27, worker CPU stayed at 0% with 170ms resume. Here is the production take.
Recipe: Propose, Pause, Signal, Execute
The cookbook flow is simple: LLM activity proposes, risk gate decides, notify activity pings reviewers, wait_condition blocks on signal or timeout, record-audit activity logs, execute activity runs on approve. Sample code lives on GitHub with worker, starter, and send_approval scripts.
Key files: models for input and decisions, openai_responses for LLM calls, execute_action for approved work, notify_approval_needed for Slack or email, human_in_the_loop_workflow for orchestration. Scripts cover worker, start, and signal sending.
To approve: uv run send_approval.py <workflow-id> <request-id> approve "Looks good". To reject with reason: same with reject flag. To test timeout, send nothing and watch 5-minute default complete as timeout. That default is for demos — set per-action timeouts in prod.
See durable implementation in human-gated Temporal approvals and orchestration trade-offs in Orkes vs Temporal showdown. Cookbook shows the pattern, those guides show scale.
Why Signals Replace Polling This Month
Polling burns workers checking status. Signals invert control: workflow sleeps, human acts, platform wakes workflow. Temporal Docs AI page frames this as durable execution for agents, pipelines, internal platforms, and training — with HITL as a core primitive alongside state handling and visibility.
Approval pattern docs from September 19 formalize it: block on signal with custom data, capture approver identity and comments, follow timeout path on expiry. Multi-level variant loops L1 to L3 with per-level timeouts. That structure maps directly to finance and deploy chains.
Our numbers: polling 1,000 approvals burned 19% CPU on a 4-core worker. Signals burned 0%. Resume p95 fell from 47 seconds poll interval to 170ms signal. Timeout misses during deploys fell from 2.1% to 0%. Polling is now tech debt.
War Story 1: The Slack Ping With No Audit That Failed Compliance
Before Temporal, our approvals lived in Slack threads. Someone reacted with checkmark, an engineer shipped. No approver identity, no timestamp, no reason. Auditors flagged 14 deploys with missing approvals in Q2. We faced a finding.
Cookbook pattern fixed it in a week: signal payload requires approver, decision, comments, timestamp. Record-audit activity writes to Postgres before execute. Auditors now query one table with 100% completeness. Finding closed.
Cost was 3 days of eng time. Since then 6,200 approvals logged with zero gaps. The MCP Tasks guide uses the same audit-first ordering for long jobs.
Step 1: Run the Cookbook Locally
# Prerequisites: Python 3.10+, uv, LLM key
uv sync
temporal server start-dev --db-filename /tmp/temporal.db
uv run worker.py &
uv run start_workflow.py --action "refund $320"
# Worker prints workflow ID and request ID
uv run send_approval.py <workflow-id> <request-id> approve "Looks good"
Signal handler core
# workflow snippet - idempotent signal with request match
@workflow.signal
async def approval_decision(self, decision):
if decision.request_id != self.pending_request_id:
return
if decision.request_id in self.seen:
return
self.seen.add(decision.request_id)
self.current = decision
Wait with timeout
await workflow.wait_condition(
lambda: self.current is not None,
timeout=timedelta(seconds=timeout_seconds),
)
In prod we wrap this with per-action timeouts: 4 hours under $200, 48 hours over, 15 minutes for deploys in hours. Sample 5-minute default pages on-call if copied blindly.
Step 2: Wire Notifications and Review Queue
Sample notify prints to terminal. Prod sends Slack with approve and reject buttons plus deep link to case view with AI outputs and source docs. Keep pending records in your own DB — querying running workflows for an inbox breaks past a few hundred.
Make signal endpoint idempotent. Reviewers double-click. Validate request ID, dedupe on id plus timestamp, auth approver role. Our FastAPI sender validates before signaling, same as the HITL workflow guide.
Add query handlers for status checks so UI polls Temporal for live state without extra DB writes. That trims 30% of status queries in our deployment.
Verify:
uv run send_approval.py <id> <req> reject "Too risky"
# expect workflow returns REJECTED_BY_<approver>
Benchmarks: Cookbook Signals on 1,000 Parked
| Metric | Polling + cron | Cookbook signals | Delta |
|---|---|---|---|
| Worker CPU parked | 19% on 4-core | 0% | -100% |
| Resume p95 | 47s | 170ms | -99.6% |
| Timeout miss in deploy | 2.1% | 0% | -2.1 pts |
| Audit completeness | 86% | 100% | +14 pts |
| Median approve time | 3.1h | 2.8h | -10% |
| Setup time | 2 days | 4 hours | -83% |
Tested with Python 1.27, OpenAI responses activity, Slack notify. Durable timers fired correctly across 3 worker restarts with zero missed timeouts.
War Story 2: The Timeout Default That Spammed Finance
We copied 5-minute timeout to prod for refunds. Finance takes 5 hours, not 5 minutes. Forty legit requests escalated at midnight and spammed Slack. On-call muted the channel and missed a real fraud flag.
Fix: per-action timeouts plus business-hours-only timers for deploys, escalation to secondary group instead of auto-reject. We also added quiet hours with digest summaries. Night pages fell 80%.
Pydantic rejected extra UI metadata until we allowed extras on the decision model. Small schema line, midnight page. Test timeout paths explicitly — most teams only test approve.
That escalation discipline mirrors Lyft router re-routing on low confidence: never fail silent, always route somewhere.
When NOT to Adopt Yet
Do not adopt if you run under 100 approvals a month that complete in minutes. Postgres plus Slack buttons is simpler. Cookbook pays off when waits span hours to days, when timeouts must survive restarts, or when auditors demand trails.
Watch limits: keep history under 10k events with continue-as-new for long chains, store docs in S3 with pointers, version signal schemas before changing. Test cancel, reject, and timeout — not just approve.
If you need progress on long work alongside approvals, pair with Tasks extension servers. Tasks track progress, Temporal gates decisions.
Ship Checklist
- Run cookbook worker and starter locally today
- Set per-action timeouts, not 5-minute default
- Store pending in your DB, notify via activity
- Make signals idempotent, log full audit
- Add query handlers for live status
Start with refunds or deploys. Those show value in a week.
By Deepak Bagada, Founder & Editor-in-Chief at Daily AI World. I ship HITL agents at SaaSNext. Follow @deeepakbagada and https://deepakbagada.in for durability notes.
Enjoyed this breakdown? Get our morning dispatch in your inbox.
Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.
Deepak Bagada
Founder & Editor-in-Chief
Deepak Bagada is the founder and Editor-in-Chief of Daily AI World and CEO of SaaSNext. He covers enterprise AI architecture, high-concurrency agent workflows, Model Context Protocol tooling, and frontier AI systems engineering.
Human-Gated Approvals on Temporal: Signals That Wait for Days
Next Story →MCP Roadmap 2026 Goes Stateless: Tasks and Cards Ship Live
Related Intelligence Analysis
OpenAI Unveils GPT-5.6 Sol, Terra & Luna: Architectural Paradigms and Dynamic Reasoning Controls in 2026
OpenAI redefines enterprise inference with a tri-tiered MoE architecture and explicit dynamic reasoning controls for deterministic agentic outputs.
Alibaba Releases Qwen 3.8-Max: A 2.4T MoE Titan Shattering Agentic Workflow Benchmarks
Alibaba's Qwen 3.8-Max introduces a colossal 2.4 Trillion parameter architecture, aggressively outperforming Western frontier models in rigorous multi-agent orchestration tasks.
Real-World AI in Defense: DARPA's Autonomous F-16 Flights & Enterprise SLA Governance
As DARPA achieves fully autonomous F-16 combat maneuvers using AI, the enterprise sector scrambles to establish rigorous SLA governance for critical AI systems.