2026 Dify 1.18 Agent Sandbox: Local or E2B?

2026 Dify 1.18 Agent Sandbox: Local or E2B?

If only trusted users will submit Agent tasks and you want execution to remain in your self-hosted environment, evaluate Dify’s local sandbox first—but configure its required authentication token and verify isolation before relying on it. If you need execution moved off the application server and accept an external service boundary, evaluate E2B. For a service used by mutually untrusted tenants, treat neither default setup as a complete tenant security boundary.

This guide is for developers testing Dify Agents, teams running internal workflows, and technical leads deciding whether external users can submit executable tasks. If you plan to self-host Dify, separate the platform’s resource needs from model inference before choosing a server.

Last updated November 4, 2026. The version and authentication notes below were checked against the Dify release notes and the project’s deployment guidance.

Choose a Dify 1.18 Agent sandbox by trust boundary

The local-versus-E2B decision is not simply a choice between two ways to install a component. It determines where Agent code executes, which team operates that environment, and what trust boundary you rely on.

Dify 1.18.0 was released on October 23, 2026. Its upgrade notes require a non-empty authentication token for the local Agent sandbox and call for related Agent components to be updated in line with the upgrade guidance. Check the official release and upgrade notes before changing a deployment. Do not assume a Compose file copied from a different version has the same variables or component expectations.

Your team and use case First option to evaluate Condition to resolve before choosing
Individual developer testing an Agent flow Local sandbox Set the required token and keep tests within a controlled environment
Internal team with trusted users Local sandbox Review network egress, secrets, container permissions, and maintenance ownership
Team that needs execution away from the Dify application server E2B Accept an external execution boundary and review its data handling
Service accepting tasks from unrelated customers or public users Neither default setup alone Define tenant isolation and task-access boundaries before selecting a backend

A local sandbox is a deployment choice, not proof that every task is safely contained. E2B changes where execution happens, but does not remove the need to control who can submit a task or what information the task can access.

For individual developers, validate the local sandbox before building on it

For a development or evaluation environment used by you alone, the local Agent sandbox can be a sensible first option when you want execution to remain in the environment you administer. Keep it separate in your thinking from the model endpoint: the sandbox executes Agent tasks, while a model service generates responses. Your model can be an external API; choosing a local sandbox does not require you to run model inference on the same server.

Use the Compose configuration that matches your Dify version. The Dify Docker deployment documentation explains the deployment approach, while the Agent deployment guide covers Agent components. Check both against your installed release rather than treating an example file as a universal production configuration.

Work through these checks before using the environment for anything beyond controlled testing:

  • [ ] Confirm that the Dify release and Agent components match the deployment guide you are following.
  • [ ] Find the local sandbox authentication variable in the matching Compose configuration. Set a non-empty value and ensure the service and Dify use the same token.
  • [ ] Confirm that the token comes from the intended environment or secret-management source. Avoid placing a production credential in a public repository or an image that you distribute.
  • [ ] Start the relevant services and inspect their logs for configuration or authentication errors.
  • [ ] Submit a controlled task that exercises the required execution path. Confirm that an unauthenticated or incorrectly configured request does not silently pass.
  • [ ] Review the task’s file access, network access, and container permissions before connecting real documents or credentials.
  • [ ] Record how you will update the sandbox image and related Agent components, and how you will roll back if the upgrade fails.

Treat “the container started” and “the task returned a result” as basic functional checks, not as a security certification. A useful additional test is to run a task that should not be able to reach a deliberately restricted resource, then verify the restriction from logs and observable behavior. Do not test against sensitive production data while you are still establishing the boundary.

For trusted internal teams, assign ownership for the local boundary

A local sandbox keeps execution within infrastructure that your team operates. That can support a policy requiring code execution to remain in a self-managed environment, but it also makes your team responsible for the execution path. You need someone to own configuration changes, image updates, credential handling, network rules, and incident response.

Review the boundary as a set of explicit permissions, not as a label such as “local” or “private.” Identify which files the task can read or write, whether it can reach internal services, how secrets are injected, and which container capabilities are enabled. If the application server itself holds credentials or has broad network access, a task running beside it may create risks that a simple “data stays on our machine” statement does not address.

A local sandbox is more suitable when the people submitting tasks are trusted, the tasks have a narrow purpose, and your team can maintain the execution environment. If you cannot answer who can change the configuration, rotate the token, review outbound connections, or update the components, local placement may provide a sense of control without a clear operational owner.

For model use, decide separately whether Dify calls an external model API or a model service you operate. An external API can reduce the inference burden on your server, but it creates a separate data-handling decision: review what prompts and retrieved content are sent, and apply the organization’s rules for sensitive data. The sandbox backend does not determine that model-data policy.

For teams moving execution, assess E2B’s external boundary

Choose E2B when your design requires Agent execution to happen outside the Dify application server and your team accepts that execution is handled by an external service. The Dify E2B Compose configuration shows the E2B backend as a separate deployment option. It is not a way to run the sandbox locally.

Decision area Local Agent sandbox E2B sandbox
Execution location Within the environment you operate In an external cloud sandbox
Configuration ownership Your team manages local configuration and updates Your team configures the integration; the external service operates its sandbox environment
Network dependency Depends on your local deployment and its required connections Requires a working connection to the external service
Credential review Protect the local sandbox token and any credentials exposed to tasks Protect integration credentials and review what task data is sent
Data boundary Execution remains in your managed environment, but access still depends on your controls Execution crosses your infrastructure boundary; review service handling and configuration
Operational focus Isolation, permissions, updates, and monitoring Integration, external-service access, and data-handling review

Before adopting E2B, read E2B’s security information and verify what data the selected workflow sends, stores, or exposes. If your deployment model involves a customer-controlled environment, review the E2B BYOC information rather than assuming that the term means the sandbox runs locally or that all data remains inside your infrastructure.

External execution does not automatically make a workflow safer. You still need to limit task inputs, decide which credentials can be supplied, control access to returned files, and define what the Agent is allowed to do. Nor should you assume performance or availability from the fact that a cloud sandbox is used; evaluate those requirements against the service documentation and your own tests.

Boundary check: If policy requires all execution and task data to stay within infrastructure your team controls, do not select E2B until the exact data flow and service arrangement have been reviewed and approved.

For customer-facing services, define tenant isolation before backend selection

A private internal tool and a public Agent service have different threat models. Internal users may be covered by the same access policy and operational team. External customers may be unrelated to one another, may submit arbitrary inputs, and may try to reach resources outside their own task. A backend choice cannot replace a design for separating those users and their data.

User relationship Questions to resolve Decision implication
Internal, trusted users Who can submit tasks, and which internal resources are available to the task? A local sandbox may fit if permissions, credentials, and network access are deliberately limited
Known customers under a managed agreement Can one customer’s task access another customer’s files, secrets, or outputs? Validate isolation against the service’s actual access model; do not infer it from the backend
Unrelated or public users Can a user control code, inputs, network destinations, or files used by another tenant? Redesign the service boundary if the threat model depends on isolation that the default setup does not establish

Start by listing every actor who can submit or modify an Agent task. Then map each actor to the data and services a task can reach. Include credentials, mounted directories, network destinations, logs, and generated files. Decide whether task output is visible only to its submitter and whether background tasks can outlive the user’s session.

Keep two assessments distinct. Dify’s documented configuration tells you how the software is intended to be configured; your threat assessment decides whether that configuration is sufficient for your users and data. Do not present a project’s default setup as a guarantee of strong isolation between mutually untrusted tenants. If it does not meet your requirements, change the service boundary or deployment architecture before choosing between local execution and E2B.

Verify the release, credentials, and rollback path before upgrading

For platform operators, the key risk is often a mismatched set of components or a configuration copied from another release. The release notes, matching Compose files, and Agent guidance should agree before you apply an update. The Dify documentation can change, so revisit the release page and the deployment references for the version you are installing.

Use this sequence as an upgrade gate:

  • [ ] Record the currently installed Dify release and the Agent-related images or components in use.
  • [ ] Check the upgrade notes for required changes to the local sandbox token and related Agent components.
  • [ ] Compare the environment variables and service definitions in the version-matched Compose configuration with your deployed configuration.
  • [ ] Confirm where each credential comes from, who can read it, and how it will be rotated if exposed.
  • [ ] Test the updated configuration in a controlled environment with non-sensitive tasks.
  • [ ] Verify both successful authenticated execution and expected rejection when authentication is missing or incorrect.
  • [ ] Check that task permissions, network access, and file access still match your intended boundary.
  • [ ] Save the prior configuration and define a rollback procedure before updating production services.

Do not treat a development variable location as a production secret-management plan. Do not update only the visible Dify application while leaving a dependent Agent component at an incompatible version. If the matching version-specific configuration is unclear, pause the upgrade and resolve that discrepancy rather than filling in missing variables by guesswork.

FAQ: local execution, E2B, and shared deployments

What changes when Dify runs an Agent sandbox locally instead of through E2B?

With the local backend, the sandbox runs within the environment you operate, so you own its configuration, network access, credentials, and maintenance. E2B sends sandbox execution to an external cloud service. That can move execution away from your application server, but it also introduces an external service boundary and requires you to review what data and credentials reach it.

Does the local Agent sandbox in Dify 1.18 need a token?

Yes. The Dify 1.18.0 upgrade notes require a non-empty authentication token for the local Agent sandbox. Set it through the environment-variable location used by the matching, version-specific Compose configuration, then verify that the service and Dify agree on the value. A successful startup alone does not prove that execution is safely isolated.

Where does Agent code run when I configure E2B in Dify?

E2B is an external cloud sandbox backend, not a local execution mode. The Agent's code runs in the E2B sandbox environment, so review E2B's security information and your selected configuration before sending tasks. Treat prompts, files, outputs, and credentials as information that may cross your own infrastructure boundary; do not assume that E2B means data never leaves your environment.

Is the default local sandbox enough for a Dify service shared by multiple teams?

Not by itself. A shared service needs a threat model for who can submit Agent tasks and what each task can reach, including secrets, mounted files, and network destinations. Do not treat the community edition's default execution setup as a proven strong boundary between mutually untrusted tenants. If that boundary is insufficient, change the service or deployment architecture before choosing a backend.

Map the sandbox decision to CPU server requirements

Measure Dify’s application services, local Agent execution, and model inference as separate workloads. A server hosting the platform and a local sandbox does not automatically have to host the model. If you call an external model API, estimate the platform and task-execution load without counting local inference; if you also run a model locally, measure that workload separately and do not treat a CPU-only server as a substitute for a GPU-based inference plan.

Workload What to observe What the observation helps you decide
Dify application services CPU and memory over normal operation and task bursts Whether the platform itself is constraining the deployment
Local Agent sandbox CPU, memory, disk activity, and task duration during representative jobs Whether execution competes with the application or needs a separate boundary
Embedding or retrieval services Resource use during indexing and query workloads Whether these services should share the host or be placed elsewhere
Model inference Model requirements and measured inference behavior on the intended hardware Whether local CPU inference is acceptable or an external model API is a better fit

Collect observations from the workloads you actually plan to run. Record container-level resource use during representative tasks, note whether constraints persist rather than appearing as a brief spike, and compare behavior when multiple tasks overlap. Do not use an assumed minimum-memory figure or an unverified task-speed estimate as a purchasing guarantee.

Once you have measurements, compare them with the currently available server options and their stated CPU, memory, storage, and network details. The AmdCli pricing and configuration page is the place to check the current product table; do not infer a configuration from an old deployment example. For the handoff, check the server delivery and access guide so your team knows how it will connect and begin its own deployment. Neither page changes the central distinction: a server that hosts Dify and its local sandbox is not, by itself, a promise of suitable local model-inference performance.

Make the backend choice with explicit conditions

Use these decision branches before you commit:

  • If only trusted developers or internal users can submit tasks, and your team can manage authentication, updates, network egress, and container permissions, choose the local sandbox for evaluation. Promote it beyond testing only after you verify the isolation you need.
  • If you need execution moved away from the application server, and your data policy permits sending the relevant task content to an external service, evaluate E2B. Review its security information and your exact data flow before enabling it.
  • If unrelated tenants can submit tasks, and you cannot demonstrate separation of files, secrets, network access, and outputs, choose neither default setup as your security answer. Redesign the service boundary first.
  • If your main concern is model inference capacity, do not decide based on the sandbox backend. Measure inference separately, then choose between a suitable local inference environment and an external model API.

For a trusted team that wants self-hosted Dify and can maintain its own execution boundary, a dedicated AMD physical server may be a better fit than a shared VPS when you need exclusive machine resources and control over the deployment environment. A shared instance can leave you with less predictable resource ownership, provider-defined limits, and less freedom to shape the host around persistent platform services. That does not make a physical server the right choice for every project: a short-lived test, a light workflow, or a workload that needs rapid elastic scaling may be better served elsewhere.

First choose the execution boundary that matches your users, then size the platform from observed workloads. If local hosting is appropriate, use the current AmdCli product table to confirm which available configuration fits; do not buy a server on an assumed Agent task rate or an inference promise that has not been measured.

Frequently asked questions

What changes when Dify runs an Agent sandbox locally instead of through E2B?

With the local backend, the sandbox runs within the environment you operate, so you own its configuration, network access, credentials, and maintenance. E2B sends sandbox execution to an external cloud service. That can move execution away from your application server, but it also introduces an external service boundary and requires you to review what data and credentials reach it.

Does the local Agent sandbox in Dify 1.18 need a token?

Yes. The Dify 1.18.0 upgrade notes require a non-empty authentication token for the local Agent sandbox. Set it through the environment-variable location used by the matching, version-specific Compose configuration, then verify that the service and Dify agree on the value. A successful startup alone does not prove that execution is safely isolated.

Where does Agent code run when I configure E2B in Dify?

E2B is an external cloud sandbox backend, not a local execution mode. The Agent's code runs in the E2B sandbox environment, so review E2B's security information and your selected configuration before sending tasks. Treat prompts, files, outputs, and credentials as information that may cross your own infrastructure boundary; do not assume that E2B means data never leaves your environment.

Is the default local sandbox enough for a Dify service shared by multiple teams?

Not by itself. A shared service needs a threat model for who can submit Agent tasks and what each task can reach, including secrets, mounted files, and network destinations. Do not treat the community edition's default execution setup as a proven strong boundary between mutually untrusted tenants. If that boundary is insufficient, change the service or deployment architecture before choosing a backend.

Further reading

Run Your Agent Workloads on Dedicated AMD Hardware

Choose an AmdCli AMD EPYC 7543P bare-metal server with dedicated CPU, memory, and storage for your self-hosted environment.

Configure an AmdCli dedicated server View AmdCli pricing

Compare server configurations and options

Choose memory, bandwidth, and IPv4 options to configure an AmdCli dedicated server for deployment needs.