Managed Agent Sandboxes Still Need an Operations Plan
A managed sandbox can run code and keep artifacts, but developers still own timeouts, permissions, state, and verification.
When an agent moves beyond answering questions and starts reading files, running tests, or changing code, my first question is where it runs. In September, OpenAI introduced the Agents API as a public beta, bringing the Codex harness and managed infrastructure to developers. The announcement describes a managed sandbox where an agent can run code, work with files, and save intermediate artifacts while operating for days.
That removes one dangerous shortcut: letting model-generated shell commands execute directly on the application server. It does not remove the operations work. A sandbox is a boundary, not an acceptance test.
Define recovery points before the task gets long
A long task that only reports pending is hard to operate. I would split it into observable phases: prepare input, inspect context, make a change, run checks, and package the result. Each phase should write an event and preserve a compact input summary plus artifact references. On restart, the worker should inspect the last completed artifact instead of blindly starting over.
if state.phase == "tests_passed" and artifact_exists(state.build_id):
return resume_from("package_result")
This is plain code, but it often buys more reliability than a longer system prompt. Networks flap. Workers restart. Users click twice.
Make permissions narrower than capability
The existence of file and code tools is not a reason to expose an entire repository, a production kubeconfig, or payment credentials. Give each run a minimal workspace. Keep inputs read-only and write outputs to a separate location. If network access is needed, allow only the domains the job requires. Database writes, deployments, and outbound messages should still pass through an independent approval service.
OpenAI’s agent cookbook includes a recipe for controlling spending per run. I would apply the same idea to authority: budgets, tool counts, and runtime limits belong outside the prompt. They should be enforced by the worker or gateway.
Verify results with software
“The agent says tests passed” is not a test result. A verifier should check exit codes, expected files, schemas, diff scope, and security findings. In a SaaS system, I would also attach the tenant ID to every artifact’s metadata. That prevents an intermediate file from one customer becoming visible to another run.
Managed execution is a useful building block because it reduces the amount of sandbox plumbing a small team has to own. It does not decide which actions are reversible or when a human must stop the run. I would separate task-level checks, such as phase order, budget, and tool authority, from artifact-level checks, such as workspace paths, parseable files, and diff scope. Any failure should preserve the failed phase and log reference for human review. I would start with background jobs that have clear inputs and outputs, require a dry run for online resources, and widen permissions only after the evidence is boring.
Before launch, I would test cancellation and expiry as well. A revoked task should stop its running process, temporary files should remain isolated by tenant, and a timed-out job should release its tools and network connections. For a human approval step, set an explicit validity window. An old approval must not remain usable after the task input or requested change has been modified.
I would finish with a resource-boundary check: list the files, processes, and network requests created by a run, then verify the cleanup result on both success and failure. “Complete” should mean the execution state is explainable and reclaimable, not merely that the model returned a paragraph.
I would rehearse these checks in a test project with no real side effects before connecting production data. The useful outcome is not a huge checklist. It is a clear owner, evidence, and next action for every failure state. That makes a long-running job operable when the original author is not watching it. It also keeps ownership clear during handoff.
I would also record why a run stopped: completed, cancelled, expired, rejected, or failed verification. Those states should be visible to the caller and distinct in dashboards. Otherwise retries will blur an intentional stop with a transient error, and operators may grant more permission when the real issue is an invalid result.
For incident review, retain the state transition and the artifact checksum, while keeping secrets out of the record. That gives the team enough evidence to reproduce the decision without turning the sandbox log into another sensitive data store.
Sources: Introducing the Agents API, Agents API cookbook, OpenAI API security best practices
