Blaxel Sandboxes are fast-launching compute runtimes in which coding agents can securely execute code and manage files, with ~25ms cold-starts and automatic hibernation when idle. You can use Morph’s fast apply model to update files in a sandbox’s filesystem with near-instant response times through agentic tool calls, leveraging the Morph integration within the sandbox’s MCP server.

Why Blaxel + Morph?

  • Speed: Blaxel’s 25-ms cold-starts rank among the lowest in serverless sandbox environments, which when combined with Morph’s blazing-fast applies makes for a near-instant user experience.
  • Security: Your code that gets created by Morph should never be accessed by someone else, and microVM-based sandboxes ensure the highest level of isolation
  • Price: Only pay for real usage and never more: tokens generated and sandbox active runtime

Quick Setup


pnpm install @blaxel/core

  • Create a Morph API key to connect to your Morph workspace from the sandboxes
  • Create your first Blaxel sandbox programmatically, making sure to pass the MORPH_API_KEY and MORPH_MODEL (default = morph-v3-large)
import { SandboxInstance } from "@blaxel/core";

// Create a new sandbox
const sandbox = await SandboxInstance.create({
  name: "my-sandbox",
  image: "blaxel/prod-base:latest",
  memory: 4096,
  ports: [{ target: 3000, protocol: "HTTP" }]
  envs: [
    { name: "MORPH_API_KEY", value: process.env.MORPH_API_KEY || "" },
    { name: "MORPH_MODEL", value: process.env.MORPH_MODEL || "morph-v3-large" }
  ]
});

// Wait for deployment
await sandbox.wait();

Use the fast apply

Blaxel sandboxes have an MCP server for accessing the file system and processes via tool calls. Morph’s fast apply is accessible exclusively through this MCP server, via the tool codegenEditFile. Use Blaxel SDK to retrieve this tool and others in any compatible agent framework (here in AI SDK format for TS, LangGraph for Python) by first installing the SDK adapters:

pnpm install @blaxel/vercel

And running the following code to retrieve the fast apply tool as well as others to operate the sandbox. Call the codegenEditFile tool to fast-apply a targeted edit to a specified file, with instructions and partial contents.
import { blTools } from '@blaxel/vercel';

// Get tools from sandbox MCP
const allTools = await blTools([`sandboxes/${sandbox.metadata.name}`]);

// Filter for specific fast apply tool
const morphTool = Object.fromEntries(
  Object.entries(allTools).filter(([key]) =>
    key.startsWith('codegenEditFile')
  )
);

// You can now pass it as a standard tool in an AI SDK agent to use
// …