Skip to content

New in 0.15: rayito setup and agent deploys to Amazon Bedrock AgentCore Runtime, with AWS CDK too

Sandboxes for AI agents, in your own AWS account

Every sandbox is a hardware-isolated AWS Lambda MicroVM. The SDK calls the AWS API directly with your credentials: no Rayito server or API key, and the same API as E2B.

Coming from E2B? Change one import. Free and Apache-2.0: you only pay AWS.

pip install rayito
from rayito import Sandbox

with Sandbox.create() as sbx:
    print(sbx.commands.run("echo hello").stdout)  # "hello\n"
    print(sbx.run_code("x = 40; x + 2").text)  # "42"
pnpm add rayito
import { Sandbox } from "rayito";

await using sbx = await Sandbox.create();
console.log((await sbx.commands.run("echo hello")).stdout); // "hello\n"
console.log((await sbx.runCode("x = 40; x + 2")).text); // "42"

Needs the rayito-base image in your account: Set up AWS, once.

Medians measured on real AWS (us-east-1, 2026-09). Details in Timings.

Why Rayito

A sandbox in seconds

Sandbox.create() leaves the sandbox ready for commands in about 2.3 s and the Python kernel in about 5.2 s. From a pool of suspended sandboxes, in under a second.

Pool · Measured timings

A coding agent inside

sbx.agent.run() runs OpenCode or deepagents in the sandbox itself. The model (Bedrock, Anthropic, OpenAI and more providers) is called through the secret gateway: the agent uses the credential but cannot read it.

Agent in the sandbox

From E2B in one import

- from e2b_code_interpreter import Sandbox
+ from rayito.e2b import Sandbox

What Lambda MicroVMs cannot do raises UnimplementedError: nothing is approximated silently.

Migrate from E2B · Parity, row by row

How it works

Your code asks for a sandbox; AWS Lambda starts it in your account and hands back the result.

  1. Your agent or your code calls the SDK with your AWS credentials.
  2. Every sandbox starts in its own hardware-isolated Lambda MicroVM.
  3. Outputs, files and artifacts come back to your code; nothing goes through a Rayito server.

Start in three steps

Install the SDK

Python ≥ 3.11 or Node ≥ 20. The CLI (rayito setup, rayito doctor) comes with rayito[cli] in Python and inside the npm package (npx rayito).

pip install "rayito[cli]"
pnpm add rayito
npx rayito doctor          # the CLI also ships in the npm package

Installation

Prepare your account, once

One command, rayito setup, prepares the account and region: IAM stack, rayito-base image and the artifacts bucket (it reuses the one you already have and, if there is none, creates it). It shows the plan and the cost and asks for confirmation. The first run takes about 10–12 minutes, almost all of it the image snapshot on AWS, once per account and region; later runs, seconds. rayito doctor is the check.

export AWS_PROFILE=<your-profile>
export AWS_REGION=us-east-1
rayito setup --dry-run     # read-only: shows the plan and the cost
rayito setup
rayito doctor --template rayito-base
export AWS_PROFILE=<your-profile>
export AWS_REGION=us-east-1
npx rayito setup --dry-run
npx rayito setup
npx rayito doctor --template rayito-base

Set up AWS

Launch your first sandbox

Save the code from the top in first.py (or first.ts) and run it.

python first.py
npx tsx first.ts

First sandbox

Agents

A coding agent inside the sandbox

A single Sandbox.create() on the rayito-agent image is enough. With allow_internet_access=False the sandbox only reaches the model, through the secret gateway. The agent is OpenCode or deepagents, and the provider is whichever you prefer (see Agent providers).

Agent templates · Fast start? Which one to use · VM versus tokens

from rayito import AgentModel, AgentSpec, Sandbox, SecretStore, bedrock_gateway

MODEL_ID = "us.anthropic.claude-haiku-4-5-20251001-v1:0"
SecretStore().create("bedrock-key", "Bearer <short-lived Bedrock key>")
spec = AgentSpec(model=AgentModel(provider="bedrock", id=MODEL_ID, gateway="bedrock", region="us-east-1"))

with Sandbox.create(
    template="rayito-agent",
    allow_internet_access=False,
    gateways={"bedrock": bedrock_gateway("bedrock-key", region="us-east-1", models=[MODEL_ID])},
) as sbx:
    result = sbx.agent.run("List the files in /home/user and summarize what is there.", spec=spec)
    print(result.text, result.usage.total)
import { AgentModel, AgentSpec, Sandbox, SecretStore, bedrockGateway } from "rayito";

const MODEL_ID = "us.anthropic.claude-haiku-4-5-20251001-v1:0";
await new SecretStore().create("bedrock-key", "Bearer <short-lived Bedrock key>");
const spec = new AgentSpec({
  model: new AgentModel({ provider: "bedrock", id: MODEL_ID, gateway: "bedrock", region: "us-east-1" }),
});

await using sbx = await Sandbox.create({
  template: "rayito-agent",
  allowInternetAccess: false,
  gateways: { bedrock: bedrockGateway("bedrock-key", { region: "us-east-1", models: [MODEL_ID] }) },
});
const result = await sbx.agent.run("List the files in /home/user and summarize what is there.", { spec });
console.log(result.text, result.usage.total);

Deploy

Deploy your agent in one command

Install the SDK and run rayito agent deploy ./my-agent (or deploy_agent / deployAgent). The SDK detects the framework, the entrypoint and the protocol by reading your files, without running your code.

Pick where it runs. On a fleet of Lambda MicroVMs (the default), the model is called through the secret gateway, so the agent never sees the credential, and you tune what matters: memory, concurrent sessions, queue, MicroVM pool, environment variables and internet egress.

Or on Amazon Bedrock AgentCore Runtime with --target agentcore, built in AWS with CodeBuild, no local Docker. AgentCore has no secret gateway: the agent uses the runtime role, with least privilege (see Security on AgentCore). If your team uses infrastructure as code, the RayitoAgent AWS CDK construct deploys the same thing with cdk deploy.

  • LangGraph and LangGraph.js
  • LangChain
  • Deep Agents
  • Strands and Strands harness
  • Hermes
  • OpenCode
  • Vercel AI SDK
  • Your own HTTP app
rayito agent deploy ./my-agent --dry-run   # detection only, no AWS
rayito agent deploy ./my-agent --memory 4096 --max-sessions 2 --queue 4
rayito agent deploy ./my-agent --target agentcore   # AgentCore Runtime
from rayito import AgentDeployOptions, deploy_agent

fleet = deploy_agent("./my-agent", options=AgentDeployOptions(bucket="amzn-s3-demo-bucket"))
try:
    print(fleet.invoke("Summarize the README.").text)
finally:
    fleet.stop()

# on AgentCore: deploy_agent("./my-agent", target="agentcore")
import { deployAgent } from "rayito";

const fleet = await deployAgent("./my-agent", { options: { bucket: "amzn-s3-demo-bucket" } });
try {
  console.log((await fleet.invoke("Summarize the README.")).text);
} finally {
  await fleet.stop();
}
// on AgentCore: await deployAgent("./my-agent", { target: "agentcore" });
import { App, Stack } from "aws-cdk-lib";
import { RayitoAgent } from "rayito/cdk";

const stack = new Stack(new App(), "Agents");
// same resources and IAM as --target agentcore
new RayitoAgent(stack, "SupportBot", { project: "./my-agent", name: "support-bot" });
// in Python: from rayito.cdk import RayitoAgent (rayito[cdk] extra)

A dashboard to see and operate your sandboxes

rayito dashboard opens in your browser a local dashboard with your account's sandboxes, quotas, cost and images. It is read-only unless you pass --allow-actions, and there is no third-party server. Step-by-step tour · Deploy it in your account

Overview of the Rayito management dashboard

What is included

Pause and resume

Freeze the sandbox with its state and come back in 0.38 s.

Pool

Suspended sandboxes ready in under a second.

Persistence

HOME on S3, beyond the 8 h.

Outbound network

Cut or filter outbound internet access.

MCP server

A sandbox for your editor or assistant over MCP.

LangChain and Vercel AI

Rayito as a tool for your agent.

Templates

Your own images with E2B's Template DSL.

OTLP export

Sandbox metrics over OTLP to CloudWatch.

Deploy your agent

From your folder to a MicroVM fleet in one command.

AgentCore Runtime

Your agent on Amazon Bedrock AgentCore, no local Docker.

AWS CDK constructs

RayitoAgent and RayitoMicrovmImage in your CDK app.

rayito setup

Your account and region ready in one command.

Migrate from E2B in minutes

rayito.e2b and rayito/e2b accept code written for E2B 2.x. Change the import, prepare your account and run.

  • Same classes and methods: Sandbox, commands, files, run_code.
  • What does not exist in Lambda MicroVMs raises UnimplementedError with a link to the explanation.
  • The parity table says it row by row.
- from e2b_code_interpreter import Sandbox
+ from rayito.e2b import Sandbox
- import { Sandbox } from "@e2b/code-interpreter";
+ import { Sandbox } from "rayito/e2b";

Your account, your bill

Sandboxes run in your AWS account and are paid on your AWS bill. There is no Rayito server, subscription or API key. Features with a cost of their own are off until you pass their option, and rayito stack deploy shows you the cost before asking for confirmation.

≈ $0.126/ha 2 GB sandbox while it runs

≈ $0.022ten minutes, including the launch

≈ $0.60/monthone suspended pool slot

$0what Rayito charges

us-east-1, list prices queried on 2026-10-06. Pricing · Optional features and their cost

Explore the manual

  • Getting started


    Install the SDK, set up your AWS account and launch your first sandbox.

  • Guides


    One page per feature: commands, code, files, network, pause, pool and persistence.

  • Agents


    The agent inside the sandbox, the MCP server, the LangChain and Vercel AI integrations and deploying your agent to a MicroVM fleet or to AgentCore, also with AWS CDK.

  • Optional features


    What each one enables, what it costs and how to turn it off.

  • Migrate from E2B


    What changes, what does not and what does not exist in Lambda MicroVMs.

  • Reference


    Python and TypeScript API, CLI, errors, environment variables and limits.

  • Operations


    Images, IAM, security, pricing and troubleshooting.

  • What's new


    What each version brings and how to upgrade.

What is included: every surface
Surface What it does Guide
Sandbox.create / connect / kill / list / get_info MicroVM lifecycle, metadata and deadlines Lifecycle
pause() / resume(), IdlePolicy suspend and resume with all the state alive Pause and resume
timeout, max_lifetime, on_timeout, set_timeout() a deadline that rayd enforces even if your process dies Server-side deadline
sbx.commands foreground and background processes, stdin, kill, reconnection Commands
sbx.run_code stateful Jupyter kernel, results, logs, errors and plots Run code
run_code(language="bash" / "javascript" / "typescript") bash and Deno kernels in rayito-base-poly Languages and kernels
sbx.pty real terminals with resize and reconnection Terminal (PTY)
sbx.files read, write, list and watch; large files and S3 presigned URLs Files and S3
sbx.get_host(port) HTTP access to a sandbox port Ports and host
network=, allow_internet_access=False E2B's outbound internet policy on rayito-base-caps Outbound network
SandboxPool sandboxes in under a second from a pool of suspended ones Pool
persist=, reincarnate() HOME on S3, beyond the 8 h Persistence
get_metrics_history(), Sandbox.paginate() metrics history and resumable listing Metrics and listing
sbx.git E2B's git API Git
sbx.agent a coding agent (OpenCode or deepagents) inside the sandbox, with the model behind the secret gateway Agent in the sandbox
rayito.e2b, rayito/e2b the E2B 2.x SDK by changing only the import Migrate from E2B
rayito-mcp a sandbox for Claude Code, Cursor or VS Code over MCP MCP server
LangChain, Vercel AI SDK Rayito as a tool for an agent that runs outside the sandbox LangChain and Vercel AI
rayito setup prepare the account and region in one command: IAM stack, rayito-base image and artifacts bucket Set up AWS
rayito (CLI) publish the image, diagnose the account, operate sandboxes and stacks CLI
make local-up, make local-e2e test the SDKs against a real rayd and an emulated AWS, without an account Test locally

Optional features, all off by default until you pass their option (or, for the CLI-only ones, run their command):

Surface What it does Guide
secrets=, SecretStore AWS Secrets Manager secrets as environment variables Secrets
gateways=, SecretGateway use a secret from the sandbox without being able to read it Secret gateway
mounts=, S3Mount an S3 bucket as a sandbox folder S3 mounts
size= sandboxes from 512 MiB to 8 GiB from per-size images Sizes
events=, LifecycleEvents lifecycle events and webhooks with E2B's signature Events and webhooks
telemetry=, TelemetryExport sandbox metrics over OTLP to CloudWatch OTLP export
tracer_provider= SDK-side OpenTelemetry spans OpenTelemetry
index=DynamoDbIndex(...) filter paused sandboxes by metadata too Metadata index
Template.build() images from E2B's Template DSL Templates
AgentTemplate, rayito agent template build the rayito-agent image with OpenCode, ripgrep and deepagents Agent templates
PoolConfig(warmup=agent_pool_warmup(...)) pool slots with the agent already warmed (fast start, optional) Pool
OptionalStacks, rayito stack deploy, query and delete each feature's infrastructure Optional stacks
rayito sandbox proxy a sandbox port at http://127.0.0.1 on your machine Local proxy
volumes=, VolumeStore, EfsVolumes (experimental) an EFS file system shared live between sandboxes, in your VPC EFS volumes
domain=, CustomDomain, rayito domain (experimental) an HTTPS URL under your domain for a sandbox port Custom domain
rayito dashboard a local dashboard with sandboxes, quotas, cost and images; read-only unless --allow-actions Management dashboard
deploy_agent / deployAgent, rayito agent deploy the agent you already have, detected without touching its code, as an HTTP service on MicroVMs Deploy your agent
AgentFleet, ScalingOptions a MicroVM fleet with several sessions, a queue and warm slots Several sessions and several VMs
deploy_agent(target="agentcore"), AgentCoreFleet, rayito agent list / delete --target agentcore the agent on Amazon Bedrock AgentCore Runtime, with no local Docker and a least-privilege role Deploy to AgentCore
RayitoAgent, RayitoMicrovmImage (rayito[cdk], rayito/cdk) the AgentCore agent and the MicroVMs image as constructs in your AWS CDK app Deploy with CDK

Everything works the same in Python (sync and asyncio) and in TypeScript, with snake_case and seconds in Python and camelCase and milliseconds in TypeScript. The cost and limits numbers are measured against real AWS, never against a simulator.

Your first sandbox, in three steps

Get started Star on GitHub

Apache-2.0 · no Rayito server · your account, your bill