Why a safe sandbox still isn’t a platform
A sandbox answers a narrow question: can this agent run without breaking anything around it? That’s a worthwhile question. In fact, it’s the first one you should ask.
But the moment an agent leaves the lab and starts doing real work for real users, the question changes. Now you’re dealing with timing, state, retries, handoffs, partial failures, and the annoying little detail that the world does not pause just because your agent finished one clean test run. A demo can look polished while still falling apart after lunch on a Tuesday. A test harness can rerun the same scenario ten times and feel solid. A service that has to stay alive all day has a very different job.
A sandbox proves an agent can execute safely. A platform proves it can keep doing useful work after the first run.
That difference sounds small until you’ve lived through it. Inside a sandbox, the system can be treated like a contained event. Start it, inspect it, shut it down, and move on. In production, the agent is part of a workflow. It may need to pause while waiting for new input, pick up where it left off after an external API responds, or wait until a scheduled window opens. The runtime is no longer the whole story. It’s just one piece of the machine.
This is where a lot of teams discover that “safe to run” and “ready to operate” are not the same thing. You can lock down file access, limit network calls, sandbox execution, and still end up with a system that nobody wants to depend on. Why? Because safety at launch does not tell you what happens after launch. It doesn’t tell you where the agent stores its progress. It doesn’t tell you how jobs get re-entered after a delay. It doesn’t tell you whether a half-finished task will be retried, resumed, or quietly forgotten.
That gap is the real divide between a sandbox vs platform setup. The sandbox protects the machine. The platform has to manage the work.
If you’re building an agent platform or any kind of AI agent infrastructure, that distinction shows up fast in production. A local demo can assume a clean start every time. A live system can’t. One instance might be processing a batch while another waits on a webhook. One task might need to sleep for fifteen minutes before checking again. Another might need to wake up when a queue item arrives, then continue with the same context it had before. If you don’t design for that, the agent becomes a clever little statue. It runs when prompted, then forgets everything useful the moment the process ends.
The boring parts are where the real work lives. State has to live somewhere dependable. Wake and sleep behavior has to be explicit instead of implied. Scheduling has to decide what runs now, what waits, and what gets another shot later. Failure handling has to answer the awkward questions, like what happens when a dependency times out, or when the agent crashes halfway through a task, or when two runs accidentally try to touch the same record.
That is why production readiness is mostly about operations, not just execution safety. The sandbox protects you from one class of mistakes. Operations protect you from time, load, interruptions, and the weird edge cases that only show up after the system has been used by actual people.
If that sounds less glamorous than a polished demo, well, yes. It is. Also more useful.
The rest of this article will stay on that track. We’ll look at where state belongs when the agent is idle, how wake and sleep should work, how jobs should be scheduled, and how to handle failures without making every outage a manual rescue mission. Once those pieces are clear, the difference between a safe sandbox and a usable platform gets a lot easier to see.

The lifecycle problem: where does the agent live when it is not running?
Once an agent is safe to execute, the next question gets a lot less glamorous and a lot more real: where does its work live after the process exits? A sandbox answers whether code can run without wrecking the machine. It does not answer what happens at 2:17 a.m. When the container is gone, the queue still has jobs, and the agent was halfway through a task that nobody wants to restart from scratch.
That’s where state management stops being an abstract design concern and turns into a basic product decision. If every run starts as a clean slate, you can build a demo pretty quickly. The agent reads input, does a bit of work, prints an answer, and disappears. Fine for a notebook. Awkward for production AI agents that need to remember what they already tried, which step they’re on, and what still needs to happen later.
In practice, you have to decide where that persistent state lives. A database is the obvious choice for structured progress. Object storage works well for larger artifacts like files, transcripts, or intermediate outputs. Sometimes teams keep a compact run record in Postgres and dump the noisy stuff elsewhere. What matters is that the agent has a durable place to check in before it sleeps and a durable place to look when it wakes back up. If the process dies, the state should not vanish with it.
If the process can disappear, the work has to live somewhere else.
That sounds obvious until you build something that pauses between steps. Many agent workflows are not single-shot jobs. They wait for a user approval, a webhook, a slow upstream system, a file upload, or a timer. In those cases, “running” and “active” are not the same thing. The agent may be idle on purpose. It may be waiting for permission. It may have finished one leg of the task and now needs to sit still until a different event arrives.
Those wake and sleep semantics need to be explicit. Is the agent truly asleep, with no resources allocated, or is it parked with a lease on its state? What event wakes it up? A scheduler? A message queue? An external callback? A human clicking approve? If that decision is vague, the system gets weird fast. You end up with jobs that look stuck when they are actually waiting, and jobs that get retried because nobody wrote down who was supposed to re-enter the flow.
This is where agent orchestration starts to matter. A production system needs a clear handoff between runs. One execution might collect data, another might draft a response, a third might wait for approval, and a fourth might publish the final output. Those are separate executions, but they’re still part of the same task. If you don’t define the boundary between them, the agent will either repeat work or forget to continue. Neither option is especially charming.
For long-lived tasks, the schedule matters just as much as the code. Some work should be queued immediately and processed in order. Some work should recur on a fixed cadence, like a daily report or an hourly monitor. Some jobs need deadlines, because an answer that arrives after the window closes is just clutter. Others need timeouts and a fallback path if an external dependency never responds. You can’t hand-wave any of that away and expect the system to behave like a service.
If this sounds familiar, that’s because workflow systems have been dealing with these problems for a long time. Temporal’s AI agent docs cover the general shape of durable execution, and the Temporal glossary is useful if you want a clean vocabulary for workflows, tasks, and state. AWS also lays out practical scheduling and reliability advice in its Step Functions best practices. Different stack, same reality: once a job can pause and resume, lifecycle design stops being optional.
A lot of teams discover this the hard way. They build a one-off execution path, then bolt on a queue, then add a cron job, then add a webhook handler, and only later notice that the same task now exists in four places with four slightly different meanings. One service says it’s done. Another says it’s waiting. A third has already moved on to the next record. That kind of drift is usually a state problem dressed up as a scheduling problem.
The cleaner approach is to define the lifecycle up front. What counts as a started run? When does it pause? What data must be persisted before pause? What event brings it back? Who owns the handoff between runs? What happens if a deadline passes while the agent is asleep? Those are not edge cases. They are the shape of the system.
One-off execution is easy because the whole story fits inside a single process. Long-lived work asks for something sturdier. The agent needs a place to live between steps, a rule for when it sleeps, a signal for when it wakes, and a schedule that decides whether it should run now, later, or not at all. Once you name those parts, the rest of the system gets a lot less mysterious.
When something breaks mid-task: retries, checkpoints, and recovery
Once an agent can pause and resume cleanly, the next question shows up the first time a process dies halfway through a job. That part is never glamorous. It’s the bit where a workflow has already fetched data, updated a record, and then gets smacked by a network timeout or a container restart right before the final step. If you treat every run like a one-shot experiment, a single failure can force you to redo the whole thing, which is a lovely way to turn a small outage into a pile of duplicated work.
A better setup breaks the job into resumable steps. Each step leaves behind a checkpoint: what completed, what didn’t, and what the next action should be. In practice, that can be as simple as storing a run state row after each stage, or as formal as a workflow engine that persists step state for you. The point is the same. When the process disappears, the system should know where to pick up without guessing. Temporal’s docs on workflow durability and retries are a good reference point if you want to see how a production system keeps execution state around between failures, instead of treating every process death like a full reset: Temporal workflow durability and retries.
A failed run should be boring to recover from. If it turns into archaeology, the workflow design is doing too much guessing.
Retries help, but only when they’re restrained. Blindly rerunning a step can make things worse if that step already sent an email, created an order, moved money, or wrote a row. This is where idempotent actions matter. If the same step runs twice, the second pass should either do nothing or safely confirm the first result. A payment request should carry an idempotency key. A file export should write to a deterministic destination, not a fresh path each time. A database update should check whether the target record already reflects the desired state before changing it again. Otherwise, retry logic becomes double-work logic, and that’s a fast route to awkward tickets.
Deduplication usually belongs right next to retry logic. If your scheduler re-enqueues the same task after a timeout, or a worker crashes after completing the work but before acknowledging it, the system needs a way to recognize that the job already ran. Traceable job IDs, per-step attempt numbers, and a record of completed actions all help here. With job scheduling, this matters more than people expect, because the scheduler is usually very confident and the network is very rude. The scheduler says “run this once.” The network says “maybe, maybe not.” Your code has to settle the argument.
AWS Step Functions documents this problem pretty directly in its error handling guidance, including retry policies, catch paths, and fallback branches for failed states: Step Functions error handling. If your workflow uses Lambda for individual steps, the integration docs are also worth a look, since they show how execution moves through a state machine when a Lambda invocation succeeds, fails, or times out: Using Lambda with Step Functions. That combination is not mandatory, of course, but it illustrates the basic pattern pretty well.
Logs matter here more than people want to admit. When a run fails at 2:14 a.m. “it failed somewhere in the middle” is not a diagnosis. You want a run ID that follows the task across every step, every retry, every worker handoff. You want structured logs that say which input was processed, which external call timed out, which checkpoint was written, and which branch of the code fired next. If a retry happened, the log should say why. If the run stopped on purpose, that reason should be visible too. Without that trail, debugging turns into reading tea leaves with a flashlight.
Timeouts deserve their own treatment because they’re not always failures in the ordinary sense. Sometimes a dependency is slow, not broken. Sometimes the agent is waiting on a human reply, a third-party API, or a batch job that runs on its own clock. In those cases, you do not want the workflow to churn forever. Set a deadline, record the timeout reason, and decide what happens next. Maybe the job pauses and resumes later. Maybe it falls back to a smaller action. Maybe it marks the task as incomplete and alerts someone. What matters is that the system chooses a path instead of hanging around like a polite ghost.
Partial completion is where a lot of teams get burned. Suppose an agent collected price data from eight countries, wrote six results, and then lost access to a proxy endpoint halfway through. A decent failure recovery plan keeps the six good results, marks the two missing ones, and retries only the missing part. It does not throw everything away because the full run wasn’t perfect. That seems obvious in hindsight, but plenty of systems still behave as if “not finished” means “delete and start again.” Which is a choice. Not a very good one, but still a choice.
There are also moments when software should stop pretending it can finish alone. If the agent hits an ambiguous state, repeated retries can just produce the same failure with better confidence. In that case, a clean handoff beats another loop. Surface the partial output, the failure reason, the exact step that stalled, and the next action a person needs to take. If the workflow needs approval, missing credentials, or a judgment call, let it ask for that explicitly instead of failing in silence. That keeps the system honest. It also saves whoever is on call from playing detective with no evidence.
The useful pattern is pretty plain once you name it. Checkpoints keep work from vanishing. Retry logic handles transient failures without duplicating side effects. Deduplication stops repeated attempts from creating extra records or duplicate actions. Logs and run IDs make failure recovery debuggable. Timeouts and handoff paths keep partial work from getting stuck forever. None of that sounds flashy, and that’s the point. When an agent is doing real work, the part that matters most is how calmly it behaves when the process dies halfway through a task.
From isolated execution to something you can operate
After you’ve made an agent safe to run, the temptation is to call the job done. The code executes inside a box. The box is locked. Nothing escapes. Great. But a sandbox only answers one question: can this thing run without wrecking your systems? It does not answer the messier question that shows up the minute real users depend on it: can you keep it useful hour after hour, with traffic, pauses, retries, and the occasional ugly failure?
A safe run is only half the job. The other half is making sure the next run starts in the right place.
That difference sounds small until you try to operate the thing. A demo can afford a clean slate every time. Production usually can’t. Once an agent is part of a live workflow, it needs memory, a way to resume, a place to leave notes for itself, and a sensible answer when a dependency stalls or a worker dies halfway through a task. If those pieces are missing, the system may still be “safe,” but it isn’t something a team can depend on without babysitting it.
The real test is not whether the agent survives a single execution. It’s whether it can keep going through an ordinary day. Morning traffic. A burst of user requests after lunch. A slow API in the middle of the afternoon. A retry that fires late. A machine that restarts. A job that needs to pause for external input and then pick up again later. None of that is exotic. All of it happens in production, and all of it exposes whether the surrounding system behaves like software or like a science project.
That’s where teams need to be a little boring, in the best possible way. Before they scale usage, they should ask a few plain questions. Where does state live when the agent is idle? What tells it to wake up? If a run stops midway, how does it resume without repeating work? What happens when a step times out, returns partial data, or fails after making a side effect? If the answer to any of those is “someone will just notice and fix it,” that’s a warning sign, not a plan.
Observability matters here too. You don’t need a shrine to dashboards, but you do need enough signal to see what happened on a run, why it stopped, and whether a retry was safe. Logs, traceable run IDs, clear failure reasons, and state snapshots are the sort of unglamorous tools that let a team operate an agent without poking at it manually all day. Without them, every issue becomes a guessing game. Guessing is fun at trivia night. Less so when a customer is waiting on a result.
At some point, the category question gets pretty simple. If the system needs a person hovering over every run, restarting jobs, stitching together partial state, or deciding by hand what should happen next, then the team has infrastructure. Useful infrastructure, maybe. Necessary infrastructure, often. But a platform? Not quite. A platform is the thing you can trust to keep moving when nobody is pressing the big green button for it.
So if you’re evaluating an agent stack, skip the glossy demo questions for a minute. Ask where it stores state. Ask how it resumes. Ask how it handles duplicate work, timeouts, interruptions, and partial failures. Ask what one operator can reasonably manage in a day. If those answers are shaky, the sandbox did its job, but the system still needs a lot more plumbing before it can run on its own.




