Usage Guides Overview¶
ms-enclave exposes four typical entry points for different integration needs. This section is organized by what you want to do — pick an entry point from the table below, then jump to the matching guide.
Which entry should I use?¶
| Scenario | Recommended entry | Guide |
|---|---|---|
| Scripts / unit tests, run-and-done | SandboxFactory |
Using a sandbox directly |
| Manage many sandboxes in one app, with background cleanup | LocalSandboxManager |
Local manager |
| High-concurrency service, need warm-up & pooling | Sandbox Pool |
Sandbox pool |
| Sandbox runs on a separate server | HttpSandboxManager |
HTTP client |
| Let the LLM choose which tool to call | Manager + OpenAI Tools |
LLM Agent integration |
Rule of thumb:
- Script / Notebook →
SandboxFactory - Web backend / task scheduler →
LocalSandboxManager(add pool when needed) - Distributed deployment → run the HTTP service on a server, use
HttpSandboxManageron clients
Unified factory entry¶
To avoid hard-coding "local vs. remote" in business code, use SandboxManagerFactory:
- pass
base_url→ returnsHttpSandboxManager - omit
base_url→ returnsLocalSandboxManager
from ms_enclave.sandbox.manager import SandboxManagerFactory
# Local
async with SandboxManagerFactory.create_manager() as manager:
...
# Remote
async with SandboxManagerFactory.create_manager(base_url='http://server:8000') as manager:
...
Common topics¶
- Built-in tools:
python_executor/shell_executor/file_operationparameters and returns - Installing third-party dependencies in a sandbox
- Mounting host directories
- Notebook sandbox (preserves variable state)
- LLM Agent / OpenAI Tools integration