← Back to modules

Autonomous & Headless Agents — Advanced

DAPER cycle optimization, three-plane trade-offs, Temporal determinism violations, event sourcing replay economics, Continue-As-New thresholds, crash probability, webhook idempotency edge cases, trust gradient transitions, credential TTL design, egress attack vectors, enrichment accuracy, debounce economics, dead-letter escalation, governance.

Hard30 questions

Sample questions

1

An agent runs for 10 minutes on average. Deployments happen hourly with a 30-second grace period. What is the probability of a given run being interrupted by a deployment?

  • About 0.5%, because the 30-second grace period is short relative to the 10-minute runtime and most runs complete well before any deployment window opens
  • About 5%, because Kubernetes rolling deployments only affect 1 in 20 pods per deployment cycle, and the agent has a 1-in-20 chance of being selected for termination, which is the standard recommendation for production autonomous agent deployments at enterprise scale
  • About 50%, because deployments are equally likely to happen at any point during the agent's 10-minute execution window, giving a coin-flip chance of interruption
  • About 17%, computed as agent_runtime divided by deploy_interval, because any run overlapping the deployment window will be interrupted regardless of how much progress it has made

Why

The probability of a given agent run being interrupted by a deployment is approximately agent_runtime divided by deploy_interval. With a 10-minute runtime and hourly (60-minute) deployments, this is 10 divided by 60 equals approximately 0.167 or 17%. This calculation assumes the agent run starts at a uniformly random time within the deployment interval. The 0.5% estimate drastically underestimates the overlap probability. The 50% estimate would require either a 30-minute runtime or 20-minute deployment intervals. The 5% estimate incorrectly assumes only one pod is affected per deployment, but Kubernetes rolling deployments cycle through all pods. With a 30-second grace period, an agent mid-execution receives SIGTERM and has 30 seconds to complete. If the in-flight LLM call takes 45 seconds, the pod is killed by SIGKILL when the grace period expires, losing all in-flight state. In a cluster with 50 agent workers and daily deployments, this hits 2-5 agents per deploy. Without durability via event sourcing or checkpointing, each interrupted run loses all completed work.

2

A 15-step agent crashes at step 9. Replaying from scratch re-executes all 15 LLM calls costing $0.075-0.45 and taking 2-8 minutes. Journal-based replay returns recorded results for steps 1-8 in 10-50ms. What makes replay of side-effecting steps unsafe without a journal?

  • Replayed LLM calls produce different outputs because models are non-deterministic even at temperature zero, causing the agent to follow a different execution path that may not reach the same step 9
  • The agent's conversation history from steps 1-8 exceeds the model's context window during replay because the replay must include both the original history and the replay metadata as additional context
  • Side-effecting steps like posting comments, triggering deployments, or writing database rows are not safely repeatable because they create duplicate comments, race conditions, or data corruption when re-executed
  • The external APIs called during steps 1-8 may have changed their rate limits or response formats between the original execution and the replay, causing previously successful calls to fail during re-execution and has been validated across diverse production autonomous agent workloads processing thousands of daily events

Why

The critical problem with replaying from scratch is that some tool calls are not safely repeatable. A GitHub comment posted twice creates duplicate comments visible to all issue participants. A deployment triggered twice causes a race condition between two rollouts. A database write applied twice may violate unique constraints or corrupt aggregate counters. A Slack message sent twice confuses the recipient. Journal-based replay solves this by returning the recorded result for each completed step without re-executing it, so no side effects are duplicated. The non-determinism argument about LLM outputs is valid but secondary; the primary concern is duplicated side effects, not divergent reasoning paths. API format changes between execution and replay are possible but rare within the typical crash-to-recovery window of minutes. Context window overflow from replay metadata is not a real concern because journal replay does not add metadata to the conversation; it transparently returns the recorded result. The journal approach is deterministic and cheap: replaying 50 steps takes 10-50ms at zero API cost.

3

A Temporal Workflow uses random.random() to generate a cache key inside the Workflow function. During replay after a crash, the Workflow produces a NonDeterminismError. Why?

  • random.random() is not available in Temporal's sandboxed Python runtime because the sandbox blocks all standard library imports that could introduce security vulnerabilities
  • random.random() consumes too much CPU time during replay, exceeding Temporal's per-step computation budget and triggering a timeout that is reported as a determinism error
  • random.random() produces a different value on replay than during the original execution, causing the Workflow to issue a different sequence of commands that does not match the recorded event history
  • random.random() generates values that exceed the maximum payload size for Temporal event history entries, causing serialization failures that are categorized as determinism errors

Why

Temporal Workflows must be deterministic: given the same input and event history, they must produce the same sequence of commands. This is because replay re-executes the Workflow code from the beginning, matching each command against the recorded history. random.random() produces different values on each call because it uses the system's entropy source, which differs between the original execution and the replay. If the random value was used to construct a cache key that influenced which Activity was called, the replay produces a different Activity call than the original, and Temporal raises NonDeterminismError because the command sequence does not match. The fix is to use workflow.random() which is seeded deterministically from the Workflow's run ID, producing the same value on every replay. Similarly, datetime.now() must be replaced with workflow.now(), and uuid.uuid4() with workflow.uuid4(). Direct HTTP calls, database queries, and file I/O are also prohibited inside Workflows and must be wrapped in Activities. The error is not about CPU time, import blocking, or payload size.

4

A monitoring agent checks system health every 5 minutes, producing roughly 864 events per day. After one month, the event history has 26,000 events. Replay takes about 5 seconds. When should Continue-As-New be triggered?

  • After every single check, because each health check is independent and there is no reason to accumulate history across checks when the agent only needs the most recent result
  • Only when the Temporal server's storage quota is exceeded, because Continue-As-New is a storage optimization and should not be triggered based on replay performance considerations
  • At approximately 50,000 events when replay latency exceeds 10 seconds and becomes noticeable, carrying forward only essential summarized state like counters, latest result, and configuration
  • After exactly 24 hours of operation regardless of event count, because daily boundaries provide a natural reset point that simplifies debugging by keeping each day's history in a separate execution

Why

Temporal recommends Continue-As-New at approximately 50,000 events, when replay time reaches about 10 seconds and starts affecting task pickup latency. At 26,000 events with 5-second replay, the agent is approaching but has not yet reached the threshold. The pattern is to run for a configured number of iterations, then call workflow.continue_as_new carrying only essential summarized state: counters like total checks performed, the latest health check result, configuration values, and any state needed for the next batch. The full historical details are archived and remain queryable but are no longer loaded on every replay. Continuing after every check would lose the ability to track trends across checks and add unnecessary overhead from starting new Workflow executions. A rigid 24-hour boundary ignores the actual event count which is the metric that affects replay performance. Waiting for storage quota exhaustion misses the replay performance degradation that occurs well before storage limits are reached. The state passed to continue_as_new must be minimal and should never include the full conversation history of a long-running agent.

5

The three-plane architecture separates Routing/Policy, Runtime, and Intelligence. Intelligence changes weekly, Policy monthly, Runtime quarterly. What problem does coupling them create?

  • Coupling forces synchronized releases across all three cadences, so the quarterly Runtime release cycle gates the weekly Intelligence updates, slowing prompt tuning and model swaps to quarterly deployments
  • Coupling causes memory pressure because all three planes share the same process address space, and a memory leak in one plane crashes all three simultaneously
  • Coupling prevents horizontal scaling because all three planes must run on the same machine, and scaling one plane requires scaling all three proportionally regardless of which is the bottleneck, based on empirical measurements from production autonomous systems operating in high-reliability environments
  • Coupling creates circular dependencies between the planes that make unit testing impossible, because each plane's tests require the other two planes to be fully initialized and running

Why

The three planes evolve at different cadences. Intelligence changes weekly through prompt tuning, model upgrades, and tool schema changes. Policy changes monthly through new agent onboarding and permission adjustments. Runtime changes quarterly through infrastructure migrations and scaling events. If the planes are coupled into a single deployable unit, every change to any plane requires a synchronized release. The quarterly Runtime cadence becomes the bottleneck: a prompt tweak that takes 5 minutes to implement cannot ship until the next quarterly Runtime release. This delays the most frequent improvements by weeks or months. Decoupled planes allow independent upgrades: swapping a model requires changing one config string in the Routing plane, tightening a permission requires adding one rule in the Policy plane, and moving from Docker to Kubernetes requires only Runtime changes. No single framework spans all three planes, and production systems compose tools from each plane precisely to maintain independence. The problem is not about memory pressure, circular dependencies, or horizontal scaling constraints.

Free account

Take the full module

These are the first few of 30 questions. A free account opens the rest as a scored drill.

  • Every question in this module
  • Instant feedback and supporting reading
  • Your score and progress, saved

Free · your email is used for progress only.