Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mesa.dev/llms.txt

Use this file to discover all available pages before exploring further.

Daytona currently restricts network access for users on Tier 1 & 2 billing to Essential services only (see Network Limits). This prevents Mesa from connecting to its cloud storage from within the sandbox. We are working with the Daytona team to address this. Reach out on Discord with any questions.
Daytona provides secure, high-performance sandboxes that work well with Mesa. This guide shows the full end-to-end flow: use the Mesa SDK outside the sandbox to set up resources, then use the Daytona SDK to configure and mount Mesa inside the sandbox. The general flow for any sandbox integration is:
  1. Outside the sandbox — use the Mesa SDK (TypeScript or Python) to create repos, manage API keys, and orchestrate your workflow.
  2. Inside the sandbox — install the mesa CLI, write a config file with your API key, and run mesa mount --daemonize to mount your repos as local directories.
  3. Run your agentcd into the mount path and launch your agent (e.g. Claude Code, Codex, or a custom agent). Any file edits are automatically persisted back to Mesa.
For details on FUSE setup, system dependencies, and container configuration, see CLI Mounts.

Image setup

First, ensure that your Daytona image is properly configured. For example, you can use Daytona’s declarative image builder system, which exposes methods like dockerfileCommands.
// Define a declarative image with Mesa dependencies
const declarativeImage = Image.debianSlim('3.12')
  .dockerfileCommands([
    // Install Mesa required system dependencies
    // These are typically already installed in base images, but you may need to add them explicitly if your image is slim.
    'RUN apt-get update && apt-get install -y --no-install-recommends \
      ca-certificates fuse3 libssl3 openssl \
      && rm -rf /var/lib/apt/lists/* \
      && update-ca-certificates',
    // Enable user_allow_other in FUSE config
    // This is required for non-root users to access the mounted filesystem.
    "RUN sed -i 's/^#user_allow_other/user_allow_other/' /etc/fuse.conf",
  ]);

Create and mount

Now you can use the Daytona SDK to create a new sandbox with your properly configured image and mount MesaFS inside the sandbox.
import { Daytona } from "@daytonaio/sdk";
import { Mesa } from "@mesadev/sdk";

const mesa = new Mesa({ apiKey: process.env.MESA_API_KEY });
const daytona = new Daytona({ apiKey: process.env.DAYTONA_API_KEY });

// --- Outside the sandbox: set up Mesa resources ---

// Create a repo (or use an existing one)
const repo = await mesa.repos.create({ name: "agent-workspace" });

// Create a scoped, short-lived API key for the sandbox
const ephemeralKey = await mesa.apiKeys.create({
  name: "sandbox-session",
  scopes: ["read", "write"],
  expires_in_seconds: 3600, // 1 hour
  repo_ids: [repo.id],
});

// --- Inside the sandbox: install and mount Mesa ---

const sandbox = await daytona.create(
  {
    image: declarativeImage,
  },
  // ... with any other Daytona sandbox creation options
);

// Install the Mesa CLI
await sandbox.process.executeCommand(
  "curl -fsSL https://mesa.dev/install.sh | sh"
);

// Write the Mesa config file. Tokens go in the secret store, not this file
// — see /reference/mesa-cli-authentication.
const mesaConfig = [
  'mount-point = "/home/daytona/mesa/mnt"',
  "",
  "[secrets]",
  'backend = "plaintext-file"',
  "",
  "[organizations.my-org]",
].join("\n");

await sandbox.fs.uploadFile(
  Buffer.from(mesaConfig),
  "/home/daytona/.config/mesa/config.toml"
);

// Register the token and mount. Sandboxes use the plaintext-file backend.
// See /reference/mesa-cli-authentication.
await sandbox.process.executeCommand(
  `mesa auth set-key --org my-org ${ephemeralKey.key}`
);
await sandbox.process.executeCommand("mesa mount --daemonize");

// --- Run your agent ---

await sandbox.process.executeCommand(
  'cd /home/daytona/mesa/mnt/my-org/agent-workspace \
    && claude "Implement the feature described in TODO.md"'
);

Tips

  • Use scoped, short-lived API keys. Create a dedicated API key for each sandbox session with only the scopes it needs. See Auth and Permissions for details.
  • Use --daemonize. Always run mesa mount --daemonize in sandbox environments so Mesa runs as a background process and doesn’t block your agent’s terminal.
  • Don’t forget user_allow_other. See CLI Mounts — this is the most common setup issue in sandbox environments.