← Back to Technical blog

Technical article

One Sandbox per Task: Execution Isolation, Keys, and Capacity Limits in Data Agent

Data Agent in HENGSHI SENSE 7.0 hands each run to an ephemeral execution environment managed by OpenSandbox. A conversation often spans several turns, and an analyst may reopen it and ask a follow-up after the task has finished. Operations teams should verify that the runtime can be created and reclaimed, that the sandbox can reach business services, that conversation records can be read again, and that capacity is sufficient at peak load.

Dec 4, 2026Technical blogHENGSHI14 min read

Article body

Full article

Data Agent in HENGSHI SENSE 7.0 hands each run to an ephemeral execution environment managed by OpenSandbox. A conversation often spans several turns, and an analyst may reopen it and ask a follow-up after the task has finished. Operations teams should verify that the runtime can be created and reclaimed, that the sandbox can reach business services, that conversation records can be read again, and that capacity is sufficient at peak load.

1 Why run tasks in a sandbox?

1.1 Responsibilities of the ephemeral runtime and the main service

The Data Agent runtime container uses the matching HBI CLI and built-in skills from the release bundle to process tasks. The HENGSHI main service manages user identity, authorization, conversations, and tasks. Execution isolation limits the impact of an individual task on host resources. Data reads and changes to objects still go through platform authorization and business validation.

1.2 Decide where the sandbox will run

In a Docker deployment, start the OpenSandbox Compose project from the release bundle separately. The main service and the sandbox can run on the same host or on separate hosts connected by a controlled private network. In Kubernetes, the platform administrator installs the matching CRDs and controller before deploying the runtime and the HENGSHI main service. Verify image pulls, outbound networking, certificate trust, and capacity on the hosts or worker nodes that will actually run sandboxes.

Record the owners and acceptance criteria before deployment. The infrastructure team checks the Linux kernel, container networking, and image pulls on sandbox nodes. The HENGSHI administrator owns the main service, its configuration, and data permissions. The model service administrator confirms the inference endpoint, access scope, and timeouts. The SENSE 7.0 reference runtime uses dns+nft. Kernel version is an initial filter, and outbound connectivity must be tested on the actual nodes.

1.3 Ephemeral sandboxes and persistent conversations

The execution environment is managed as part of a run. An idle pool can prepare instances for allocation in advance. Follow-up questions rely on conversation records and encrypted checkpoints saved by the server. Large aggregations are better handled by the data warehouse or by HENGSHI data preparation and modeling. Sandbox tasks can focus on retrieving, orchestrating, and interpreting data. Split a full refresh of detailed records into data-side aggregation and Agent interpretation so each step can be checked independently.

2 What the release bundle contains

2.1 Lifecycle service and task images

OpenSandbox Server exposes interfaces to provision, query, and reclaim sandboxes. The execd component handles command execution and data channels. The egress component applies outbound network and credential proxy policies. Use the versions and digests from the same release manifest for the main service image, the Data Agent runtime image, and companion components. The operations handoff should include image digests, supported architectures, the runbook, and the source of credentials.

Include the platform architecture and image digest in the version handoff. For offline image backups, record the reference and version the actual worker nodes can pull. Confirm the main service and runtime come from the same release. After adding a node to the resource pool, run a data retrieval task on it and check the image, outbound access, and data permissions.

2.2 Verify HTTPS across separate deployments

The HENGSHI main service and sandbox runtime have their own certificate trust chains. For HTTPS endpoints issued by an enterprise CA, prepare a sandbox runtime image with the appropriate trust configuration as described in the deployment guide. Verify DNS resolution, certificate validation, and callbacks from inside the sandbox. If a proxy is in use, also check that the execution endpoint returned by the service is reachable from the HENGSHI JVM or pod.

3 Verify connectivity from each caller

Opening a web page from an operator’s computer covers the browser path. Test from the HENGSHI JVM, the sandbox container, and the configured model endpoint. First verify the runtime and authenticated capability status, then use a business question with a known reference result to exercise data retrieval, charting, and follow-ups.

Call pathWhere to verifyExample failure
HENGSHI main service → OpenSandbox lifecycle service and execution channelFrom the actual JVM or BI container, verify reachability, API authentication, and the returned execution addressHealth checks pass, but authentication or the execution channel fails
Sandbox → HENGSHI APIFrom a real sandbox, check DNS, TLS, and authorized retrieval for the current userThe sandbox launches, but the task cannot retrieve data
Sandbox → Responses model serviceFrom the sandbox network, check DNS, TLS, outbound policy, and connectivity to the model serviceThe capability or model configuration is unavailable, or execution fails

For containers on one host, use the networking configuration from the bundle. For separate hosts, use addresses that the respective callers can reach. Maintain the model service address in the Responses model configuration. Run acceptance checks with a restricted business account and record status, elapsed time, request ID, and deployment version.

4 Lifecycle state, business conversations, and keys

Before an upgrade, identify what needs to be restored. OpenSandbox and HENGSHI multi-turn conversations have separate storage. The SENSE 7.0 deployment guide describes PostgreSQL and MinIO or S3 storage for business conversation records and encrypted checkpoints. Keep the conversation encryption key consistent across HENGSHI replicas and store it persistently.

ItemPurposeWhat to verify during upgrades and recovery
Lifecycle API credentialLets the HENGSHI main service access OpenSandbox lifecycle APIsMatch the server configuration and Secret version and rotate under controlled conditions
Conversation encryption keyRestores encrypted state for HENGSHI multi-turn conversationsKeep the existing key consistent across main service replicas
OpenSandbox state storageHolds the lifecycle service’s own runtime statePreserve SQLite data and its Docker volume or Kubernetes persistent volume
HENGSHI PostgreSQL and MinIO or S3Hold business conversation records and encrypted checkpointsInclude both in a recovery drill and verify reading and continuing an earlier conversation

Drain in-flight runs before rollback and check version compatibility between the main service and execution components for the deployment in use. Verify that the backup contains accessible volumes and keys. After restoring a version that supports the execution path, test an existing conversation and a new task separately. Record whether the old conversation can be read and continued and whether the new sandbox can be created and reclaimed.

5 Estimate capacity and monitor rollout

5.1 Separate per-JVM concurrency from the shared idle pool

In the reference configuration documented for SENSE 7.0, a sandbox receives 2 vCPUs and 2,048 MiB. The default concurrency limit is two tasks per JVM, and the shared idle pool targets five sandboxes. Count the shared pool once across replicas. With an idle pool of zero, sandboxes are created on demand. If Redis is unavailable, the system also falls back to on-demand provisioning. Use the deployed configuration and load test results to determine the actual values.

For example, consider three JVMs serving Data Agent requests, all running with the reference configuration. A rough upper bound is six active instances plus five shared idle instances, for a total of eleven. At the reference allocation per sandbox, budget 22 vCPUs and 22 GiB for sandboxes, plus OpenSandbox, networking components, and host overhead. This example estimates resource allocations. Determine node count and actual utilization separately.

Capacity estimate example for acceptance records

bi_jvm_count: 3
active_runs_per_jvm: 2
shared_idle_sandbox_target: 5
sandbox_budget_count: 11
sandbox_cpu_budget_vcpu: 22
sandbox_memory_budget_gib: 22

A load test can be run in three rounds. First, run one real task with a known result to validate deployment. Next, submit several ordinary questions concurrently and measure the distribution of queueing, provisioning, and execution times. Finally, simulate exhaustion of the idle pool and task completion, then measure when a new task can obtain resources. Save the sampling method and runtime version for each round. Peak user experience needs more evidence than the fastest individual run.

5.2 Use queue times to locate bottlenecks

Collect queue latency percentiles, provisioning times and failure rates, execution tail latency, and reclamation delays separately. If queues grow while provisioning remains healthy, check task limits and request distribution. If only cold starts slow down, start with image availability, the runtime environment, and the idle pool. If cleanup lags after a task reaches a terminal state, check reclamation records and node resources. When capacity approaches its limit, decide whether to narrow tasks, adjust concurrency, or add nodes.

6 Acceptance checks and common misdiagnoses

A restricted account should be able to ask authorized questions and should see the expected permission behavior for unauthorized data or resources. Health checks, port reachability, and pod readiness can help diagnose deployment problems. For acceptance, run the complete workflow through the live user entry point.

A recovery drill can start by asking about business data with a known reference amount from a test account in a designated application. Ask a follow-up in the same conversation and record the run or turn ID. After a controlled restart, reopen the conversation and submit another question. Separately, verify that an ephemeral sandbox is reclaimed after cancellation or timeout. These checks cover the business result, conversation recovery, and runtime resources.

6.1 Use a restart drill to distinguish the two recovery paths

If new tasks run but an old conversation cannot continue, check whether the history can be read and whether the next turn can execute. The first check covers the records and current account. The second also depends on the encrypted checkpoint, the same conversation key, and current execution conditions. If history and follow-ups work but new sandboxes cannot be provisioned or reclaimed, inspect the lifecycle service’s state storage and run records. Keep separate evidence for the two failures because they require different recovery material.

Use a fictional task such as “Find the paid order amount for East China last month” as a baseline. Save a reconciled result for one period and perform controlled restarts in stages. After the main service recovers, open the original conversation and confirm that the follow-up stays in it. After the lifecycle service recovers, start another task and verify sandbox provisioning, execution, and reclamation. Change one component at a time and record the target version, turn ID, and recovery outcome.

Check three points before handoff. Verify the running artifact by digest when image tags can change. Verify CA trust for the main service container and for the sandbox separately. If an old conversation cannot be recovered, check the shared conversation key and business storage before reading lifecycle logs so lifecycle state is not cleared by mistake.

For example, a test environment is stable with one JVM. Adding two replicas shortens queues, but model requests take longer. Separate sandbox provisioning time from model latency, then check concurrency quotas at the model endpoint. Increasing the idle pool consumes sandbox capacity and offers little help once model requests have already gone out.

7 Acceptance criteria

For a Data Agent sandbox deployment, identify where tasks run, the paths used for authentication and data retrieval, the storage that restores conversations, and the evidence that reveals concurrency, cold-start, or reclamation problems under peak load. Keeping those records makes it possible to locate the responsible component before narrowing the investigation.

About HENGSHI

Founded in 2016, HENGSHI develops next-generation Agentic BI for a Data+AI world. Its enterprise analytics platform, HENGSHI SENSE, works with HENGSHI’s digital employees, the HENGSHI CLI execution engine, and the privately deployed HENGSHI BOX to provide an integrated service offering. With a decade in BI analytics and its Powered by Hengshi ecosystem, HENGSHI enables software providers across industries and delivers end-to-end private, trusted AI analytics for operations and decision-making in manufacturing, finance, retail, and government.

HENGSHI SENSE

Resources, ecosystem, and implementation stories

Explore how teams design and ship analytics with HENGSHI.

Request a trial

Enterprise deployment, embedded delivery, and trial requests can all be handled quickly.