Your DeepSeek Harness task keeps losing dependencies, background processes, or debugging context between runs.
Use E2B for untrusted code, one-time validation, and rebuildable work. Use a controlled persistent environment for macOS toolchains, long sessions, fixed repositories, and continuous processes. For most teams, the best design is dual-track: persistent infrastructure owns control and state, while E2B handles risky or disposable execution.
This runbook is for:
- Independent developers deciding whether a temporary sandbox is worth adding.
- Application teams running both durable repository work and untrusted code.
- Platform owners assigning credentials, state, cost, and failure responsibility.
DeepSeek Harness E2B sandbox vs. persistent environment
The important distinction is not “cloud versus local.” It is rebuildable execution versus retained execution state.
The current DeepSeek Harness repository describes the project as a developer preview and warns that compatibility-breaking changes may occur. That makes lifecycle assumptions especially important: an E2B integration declaration or package presence does not, by itself, prove production support, long-term lifecycle guarantees, or compatibility with every plugin. See the official DeepSeek Harness repository status.
E2B defines its sandbox as an isolated cloud environment for running commands, accessing files, using the network, and executing code. Its official documentation describes Linux-based execution, not a remote Mac. See the E2B sandbox overview and the E2B SDK sandbox reference.
Use this decision rule:
- Choose E2B when the task can be deleted and recreated from a repository, lockfile, template, prompt, and approved input.
- Choose a persistent environment when the task depends on local history, installed tools, background services, repeated human intervention, or macOS APIs.
- Choose both when the team needs strong separation for risky execution but also needs a durable control plane and a real Mac for final delivery.
A sandbox can be persistent in a narrow technical sense. E2B supports pausing and resuming filesystem and memory state. That does not make it equivalent to a long-lived engineering workspace. The owner still needs to manage timeout behavior, sandbox identifiers, artifact export, reconnect logic, and deletion responsibility. (e2b.dev)
Independent developers: discardability beats convenience
For a solo developer, the first question is simple: can we recreate the task without remembering what happened inside the previous machine?
A disposable E2B run is a good fit for:
- Testing a short Python, JavaScript, or shell script.
- Running generated code against synthetic input.
- Checking whether a repository installs from a clean checkout.
- Parsing an untrusted file before it reaches a trusted workspace.
- Reproducing a bug with a pinned commit and a documented command.
- Evaluating an AI Agent tool call that should not touch the main machine.
The hidden cost appears when the answer is “no.” A temporary sandbox may save infrastructure setup time, but it can increase recovery work if the workflow depends on:
- A manually installed package that was never added to the lockfile.
- A database created inside the workspace.
- A browser profile or local certificate.
- A running development server.
- A conversation-specific file that was not uploaded.
- An approval decision that exists only in terminal history.
We use this rebuild test before choosing E2B:
- [ ] The repository revision is recorded.
- [ ] Dependencies are declared in a lockfile or reproducible install script.
- [ ] Required environment variables are listed without exposing secret values.
- [ ] Input files can be uploaded again.
- [ ] The command sequence is documented.
- [ ] Outputs can be downloaded or pushed to an approved store.
- [ ] A failed run can restart without manual repair.
If any two of these boxes remain unchecked, a persistent environment is usually more direct. The issue is not that E2B cannot run the code. The issue is that the developer becomes responsible for rebuilding context that would otherwise remain available.
Application teams: separate Harness session state from execution state
Application teams often make one operational mistake: they treat the Harness conversation as if it were the workspace.
These are different objects.
Harness session state may include messages, tool calls, approval events, task identifiers, and references to a repository or artifact.
Execution state includes the live process tree, installed packages, temporary files, database contents, browser state, sockets, caches, and uncommitted changes.
When an E2B sandbox ends, the execution state may disappear even if the Harness session record remains available. A later session can know that a command failed. It cannot automatically recover the exact process memory, temporary directory, or unexported file that caused the failure.
For each workflow, we assign ownership to four state classes:
-
Source state
Repository, commit, branch, patch, and dependency lockfile. -
Run state
Task ID, sandbox ID, environment identifier, command log, and approval history. -
Working state
Caches, databases, generated files, browser profiles, and local services. -
Delivery state
Test reports, binaries, screenshots, logs, patches, and deployment-ready artifacts.
E2B is strongest for source state plus a deliberately bounded run state. A persistent environment is stronger for working state. The control plane should own delivery state, not leave it trapped inside either execution surface.
A practical handoff record should contain:
- Task ID.
- Source revision.
- Execution environment.
- Credential scope.
- Network policy.
- Commands executed.
- Checks passed and failed.
- Artifact names and hashes.
- Cleanup result.
- Human owner for the next action.
This list also prevents a common false assumption: a paused sandbox is not automatically an approved long-term workspace. E2B documents that paused sandboxes preserve filesystem and memory state, while killed sandboxes are terminal and release resources. The workflow must explicitly decide whether timeout means pause or kill. See the official persistence and timeout behavior.
macOS toolchain teams: keep the real Mac execution surface
E2B is not a cloud Mac. It is not a substitute for macOS-only tooling.
A task belongs on a controlled Mac when it needs:
- Xcode project builds.
- iOS or macOS code signing.
- Provisioning profiles.
- Keychain access.
- Safari-specific automation.
- Simulator behavior.
- macOS frameworks.
- Apple platform SDKs.
- Physical or OS-managed developer credentials.
The correct boundary is often narrower than teams expect. We can put the inspection phase in E2B:
- Receive the repository or patch.
- Run static checks and dependency inspection.
- Execute untrusted preprocessing.
- Produce a review bundle.
- Verify the source revision and artifact manifest.
- Transfer only approved inputs to the Mac.
- Run Xcode, signing, simulator, or Safari steps on the Mac.
- Return logs and final artifacts to the control plane.
This design reduces the amount of risky code that reaches the Mac without pretending that the sandbox provides macOS compatibility.
We do not infer compatibility from package names. We verify it by running the actual task on the target execution surface. A real acceptance test should include:
- [ ] The Xcode version is recorded.
- [ ] The project opens without interactive repair.
- [ ] Signing identity selection is explicit.
- [ ] Keychain prompts are handled by policy.
- [ ] Simulator or device targets are available.
- [ ] Safari permissions are configured.
- [ ] The final archive or test result is exported.
- [ ] The Mac workspace is cleaned or retained according to policy.
Teams evaluating the persistent route can review MESHLAUNCH Mac environment options and compare the required toolchain against the available Mac workflow. The decision should be based on the toolchain boundary, not on the assumption that every agent task needs a Mac.
Platform teams: make the dual-track handoff explicit
A dual-track design works only when the control plane and execution plane have separate responsibilities.
We assign the persistent environment to:
- Harness configuration.
- Plugin versions and approved policies.
- Session records.
- Audit events.
- Task queues.
- Human approval.
- Repository references.
- Artifact indexing.
- Retry and escalation logic.
We assign E2B to:
- Untrusted code.
- Disposable package installation.
- Reproducibility checks.
- Input transformation.
- Short-lived test runs.
- Failure isolation.
- Preflight validation before Mac execution.
The boundary needs an interface contract. At minimum, the contract should define:
- A unique task identifier.
- A source revision or immutable input reference.
- A sandbox identifier.
- An expiry or cleanup policy.
- The exact files transferred in each direction.
- A maximum credential scope.
- A network allowlist.
- The artifact return path.
- The person or service that owns a failed handoff.
Without that contract, “dual-track” becomes two loosely connected machines. Engineers then copy files manually, paste credentials into prompts, or retry a failed run in the wrong environment.
The E2B documentation describes secured access controls for sandbox APIs and warns that disabling secure access increases risk. That is useful evidence for the interface design, but it is not proof that the overall workflow is safe. The Harness tool layer, task source, network permissions, secret injection, and artifact handling still need independent controls. See the E2B secured access documentation.
We also keep the task identifier in every filename and log record. A returned artifact named build.zip is operationally weak. A record such as task-1842-commit-a91f-build.zip is easier to audit, retry, and delete.
Security-sensitive teams: isolate credentials from execution risk
A disposable environment does not automatically stop prompt injection, malicious dependencies, data exfiltration, or unsafe external actions.
The security decision starts with the input, not the model name.
High-risk code or content should enter an execution surface with:
- No production credentials by default.
- No unrestricted write access.
- Limited outbound network access.
- Short-lived identity tokens where possible.
- Separate workspace ownership.
- Explicit artifact export.
- Human approval before external side effects.
A persistent environment needs the same discipline. Its longer lifetime increases the chance that credentials, browser state, caches, or copied secrets remain available to a later task. Persistence improves debugging. It also increases the blast radius of a mistaken permission.
We use three credential classes:
-
No-secret execution
Suitable for public repositories, synthetic data, static inspection, and untrusted preprocessing. -
Scoped task credentials
Limited to one repository, service, branch, or artifact bucket. These should expire with the task or require renewal. -
Privileged production credentials
Kept outside disposable execution by default. Access requires an explicit approval step and a separate audit record.
For external side effects, we split “can read” from “can write.” An Agent may need to inspect an API response without being allowed to create tickets, modify deployments, send messages, or change production data.
We also record the source of every task. A user-submitted file, repository pull request, scheduled job, and internal test should not receive the same trust level. The sandbox is one layer. Source validation, permission design, and output review remain separate responsibilities.
A five-step rollout for teams choosing one track or two
Do not migrate every DeepSeek Harness task at once. Run a small acceptance exercise.
Step 1: Inventory task classes
Group recent tasks into:
- Disposable validation.
- Repository development.
- Long-running debugging.
- macOS build and signing.
- External automation.
- Security-sensitive preprocessing.
Do not classify by team preference. Classify by state, toolchain, and side effects.
Step 2: Mark what must survive
For each task, mark whether these items must survive a restart:
- Conversation context.
- Installed dependencies.
- Uncommitted files.
- Database contents.
- Background processes.
- Browser session.
- Credentials.
- Build cache.
- Test artifacts.
- Human approval state.
If working state or approval state must survive, do not assume a fresh sandbox will restore it.
Step 3: Run three acceptance paths
Run the same Harness workflow in three forms:
- A disposable E2B task.
- A retained persistent environment.
- A dual-track handoff from E2B to the persistent environment.
Measure whether the workflow can recreate inputs, export outputs, recover from timeout, and identify the owner of each failure. E2B templates can package dependencies and filesystem state, but template construction does not remove the need to define repository, secret, and artifact boundaries. See the E2B template lifecycle documentation.
Step 4: Test the failure paths
Force these failures:
- Sandbox timeout.
- Lost connection.
- Missing artifact.
- Expired credential.
- Invalid source revision.
- Failed Mac handoff.
- Human approval rejection.
- Partial output upload.
A design that works only when every process completes normally is not ready for team use.
Step 5: Set the default routing policy
Use a simple policy:
- If the task is short, untrusted, and rebuildable, route to E2B.
- If it needs macOS or continuous state, route to the persistent environment.
- If it starts risky but ends with a Mac-specific delivery step, use both.
- If the team cannot explain who owns state and credentials, stop the rollout.
Decision checklist: single track or dual track
Use this comparison list during design review.
Choose E2B as the primary execution surface when:
- [ ] The task can be rebuilt from a pinned source revision.
- [ ] Local files are inputs, not hidden state.
- [ ] No macOS-only capability is required.
- [ ] Credentials are unnecessary or narrowly scoped.
- [ ] External writes are blocked or approved separately.
- [ ] Failure can restart without a human repairing the workspace.
- [ ] Artifacts are exported before timeout or cleanup.
Choose a persistent environment as the primary surface when:
- [ ] The team repeatedly debugs the same repository.
- [ ] Background services or databases must remain available.
- [ ] Manual approval and intervention are frequent.
- [ ] Build caches or local dependencies are costly to recreate.
- [ ] The task needs Xcode, signing, Safari, Keychain, or another Mac-specific capability.
- [ ] The workspace must remain available across several operators.
- [ ] The team accepts responsibility for cleanup and credential rotation.
A persistent Mac workflow can be evaluated through MESHLAUNCH cloud Mac delivery options, but we still recommend validating the exact project, permissions, and artifact path before committing to a longer operating model.
Choose dual-track when:
- [ ] Untrusted code must be isolated before review.
- [ ] Approved work must continue in a stable workspace.
- [ ] The final task needs a real Mac.
- [ ] The control plane must retain session and audit state.
- [ ] Files can be transferred through an explicit manifest.
- [ ] Each execution surface has separate credentials.
- [ ] A named owner accepts failed handoffs.
FAQ
Is DeepSeek Harness E2B sandbox suitable for long-running tasks?
It can support long-running work in limited cases, especially when the task can tolerate pause, resume, reconnect, and artifact export. E2B documents persistent pause and resume for filesystem and memory state. However, teams still need to manage timeouts, sandbox IDs, network reconnection, and cleanup. For continuous debugging or a workspace shared across operators, we recommend a controlled persistent environment.
Can an AI Agent task that needs Xcode run inside E2B?
Not as a complete execution path. E2B provides Linux sandbox execution, so it does not reproduce Xcode, iOS signing, Safari permissions, Keychain behavior, or simulator integration. We can use E2B for repository inspection, static checks, dependency validation, or untrusted preprocessing. The approved build and signing stages should run on a real, controlled Mac.
Does the DeepSeek Harness session remain after an E2B sandbox expires?
Only the control-plane records that were stored separately can remain. A Harness session may preserve messages, task metadata, approvals, or repository references, but that does not restore the sandbox filesystem, process memory, database, or unexported files after termination. Before every disposable run, define which state must be uploaded and how a new sandbox will reconstruct the task.
How do we separate high-risk code execution from a long-term workspace?
Use different environments, identities, workspaces, and artifact paths. Send untrusted input to E2B without production secrets or unrestricted write access. Keep the persistent environment responsible for approved repositories, audit records, human approvals, and final delivery. Require a task ID, source revision, checks, credential scope, artifact manifest, and failure owner at the handoff.
The wrong default is to move every task into one environment. E2B reduces exposure for disposable execution, but it does not provide macOS compatibility or guarantee safe permissions. A persistent environment preserves context, yet it can retain stale credentials, hidden files, and long-lived services. If a team needs both, the dual-track design is usually easier to operate than forcing either option to cover every workload.
Start by marking the tasks that require Mac-specific tooling or retained state. For those workloads, read the MESHLAUNCH persistent Mac environment path and validate the handoff before moving production work. If the need is temporary testing, controlled build access, or a short-lived Mac execution surface, renting a managed Mac through MESHLAUNCH can avoid the setup burden of buying and maintaining dedicated hardware while keeping the Mac boundary explicit.