Skip to content

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 / NotebookSandboxFactory
  • Web backend / task schedulerLocalSandboxManager (add pool when needed)
  • Distributed deployment → run the HTTP service on a server, use HttpSandboxManager on clients

Unified factory entry

To avoid hard-coding "local vs. remote" in business code, use SandboxManagerFactory:

  • pass base_url → returns HttpSandboxManager
  • omit base_url → returns LocalSandboxManager
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