Skip to main content

rayito (SDK Python)

Cliente Python de Rayito: sandboxes de ejecución para agentes de IA sobre AWS Lambda MicroVMs, dentro de tu propia cuenta. La ergonomía del SDK de E2B sin que el código de tus clientes salga de tu cuenta y sin clúster que operar. No hay servidor de terceros ni API key: el SDK llama a la API de AWS con tus credenciales.

Documentación: https://alejandro-cedeno-10.github.io/rayito/ · Primeros pasos · Referencia de Python · Changelog

Instalación

pip install "rayito[cli]"      # o: uv add "rayito[cli]"

Python ≥ 3.11. Dependencias de runtime: grpcio, protobuf y boto3. El SDK trae un árbol síncrono (Sandbox) y uno asíncrono (AsyncSandbox) con la misma superficie.

Extra Para qué
rayito[cli] la CLI rayito: publicar la imagen, rayito doctor, operar sandboxes y pilas opcionales (CLI)
rayito[mcp] el servidor MCP rayito-mcp (Servidor MCP)
rayito[otel] spans OpenTelemetry del lado del SDK (OpenTelemetry)
rayito[custom-domain] dominio propio, experimental (Dominio propio)

Antes del primer sandbox

Tu cuenta necesita una pila de IAM, un bucket y la imagen rayito-base publicada con el rayd de la misma serie que el SDK. Se hace una vez por cuenta y región: Configurar AWS. Después:

export AWS_PROFILE=<tu-perfil> AWS_REGION=us-east-1 AWS_DEFAULT_REGION=us-east-1 RAYITO_TEMPLATE=rayito-base
rayito doctor --template rayito-base     # credenciales, cuotas, IAM, imagen, versión del agente

Primer sandbox

from rayito import Sandbox

with Sandbox.create() as sbx:  # `with` mata el sandbox al salir
    print(sbx.commands.run("echo hola").stdout)  # "hola\n"
    sbx.files.write("/home/user/a.txt", "contenido")
    print(sbx.files.read("/home/user/a.txt"))  # "contenido"
    print(sbx.run_code("x = 40; x + 2").text)  # "42"

En asyncio:

import asyncio

from rayito import AsyncSandbox


async def main() -> None:
    async with await AsyncSandbox.create() as sbx:
        print((await sbx.run_code("x = 40; x + 2")).text)  # "42"


asyncio.run(main())

Recorrido completo (comandos, ficheros, código y reconexión desde otro proceso): Primer sandbox.

Si vienes de E2B

rayito.e2b es un drop-in a nivel de import del SDK de E2B 2.x. Lo que Lambda MicroVMs no puede hacer lanza UnimplementedError en vez de aproximarse en silencio. Exige una imagen 0.3.0 o posterior.

from rayito.e2b import Sandbox  # antes: from e2b_code_interpreter import Sandbox

with Sandbox.create(timeout=300, metadata={"run": "42"}) as sbx:
    print(sbx.run_code("1 + 1").text)  # "2"
    sbx.set_timeout(600)

Migrar desde E2B · Diferencias · Paridad

Un agente de código dentro del sandbox

sbx.agent corre un agente de código (OpenCode, o deepagents) dentro del sandbox, sobre la imagen rayito-agent (rayito agent template build). El agente llama a su modelo sólo a través de la pasarela de secretos: usa la credencial, pero nunca puede leerla.

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 <clave de Bedrock de corta duración>")
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("Lista los ficheros de /home/user y resume qué hay.", spec=spec)
    print(result.text, result.usage.total)

El arranque rápido (PoolConfig(warmup=agent_pool_warmup())) es opcional: ¿Qué uso?. Guía: Agente en el sandbox.

Qué incluye

Superficie Guía
Sandbox.create / connect / kill / list / get_info, metadatos Ciclo de vida
pause() / resume(), IdlePolicy Pausar y reanudar
timeout, max_lifetime, on_timeout, set_timeout() Plazo del servidor
sbx.commands Comandos
sbx.run_code, contextos de código Ejecutar código
run_code(language="bash" / "javascript" / "typescript") Lenguajes y kernels
sbx.pty Terminal (PTY)
sbx.files, transfer=S3Staging(...), URLs firmadas Ficheros y S3
sbx.get_host(port) Puertos y host
network=, allow_internet_access=False Red saliente
SandboxPool, PoolConfig Pool
persist=S3Prefix(...), reincarnate() Persistencia
get_metrics_history(), Sandbox.paginate() Métricas y listado
sbx.git Git
sbx.agent, AgentSpec, presets de pasarela Agente en el sandbox
rayito-mcp Servidor MCP
LangChain y Vercel AI LangChain y Vercel AI

Funciones opcionales, apagadas por defecto

Cada una crea recursos o hace llamadas facturables en tu cuenta, así que sólo se activa con una opción explícita del SDK o de la CLI; sin ella no se construye ningún cliente de ese servicio. Qué activa, qué cuesta, qué IAM necesita y cómo apagarla: Funciones opcionales.

Opción Función
secrets=, SecretStore Secretos de Secrets Manager como variables de entorno
gateways=, SecretGateway Pasarela de secretos: usar un secreto sin poder leerlo
mounts=, S3Mount Montajes S3
size= Tamaños de 512 MiB a 8 GiB
events=, LifecycleEvents Eventos y webhooks
telemetry=, TelemetryExport Exportación OTLP
tracer_provider= OpenTelemetry (SDK)
index=DynamoDbIndex(...) Índice de metadatos
Template.build() Templates declarativos
AgentTemplate Templates de agente
OptionalStacks, rayito stack Pilas opcionales
rayito sandbox proxy Proxy local
volumes=, VolumeStore (experimental) Volúmenes EFS
domain=, CustomDomain (experimental) Dominio propio

Costes y límites

Un sandbox factura el cómputo de Lambda MicroVMs mientras corre, más el almacenamiento de cada versión de imagen; Rayito no cobra nada. Precios, ejemplos y tiempos medidos: Precios. Vida máxima, tamaños de payload y la tabla de compatibilidad SDK ↔ rayd: Límites.

Desarrollo

cd clients/python
uv sync
uv run pytest tests/unit
uv run ruff check . && uv run ruff format --check .
uv run mypy src tests
uv build && python ../../scripts/check_wheel.py dist/*.whl   # y `make wheel` desde la raíz: twine con --hash
RAYITO_E2E=1 RAYITO_TEMPLATE=<arn-o-nombre> uv run pytest tests/e2e -m e2e -v -s

Licencia y marcas

Apache-2.0; las atribuciones de terceros están en el fichero NOTICE incluido en el paquete. E2B es una marca de su titular: Rayito es un proyecto independiente, no afiliado, patrocinado ni respaldado por E2B, y usa el nombre sólo para describir la compatibilidad de API del shim. Contribuir: CONTRIBUTING.md; seguridad: SECURITY.md.

Metadata

Release files for rayito 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rayito 0.12.0
File Size Uploaded Provenance
rayito-0.12.0.tar.gz 1.1 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rayito 0.12.0
File Interpreter ABI Platform
rayito-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / rayito-0.12.0.tar.gz

Download URL rayito-0.12.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
3bc1260bcc078dbc4911c47a7774f8d41a4c09ea6e243e56af3ff545f2b6e117
BLAKE2b-256 checksum
How to use checksums
08d69787d27ba474c709da9b2738357e71b1136d8d5f2bb3c5fdd842b7a39945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / rayito-0.12.0-py3-none-any.whl

Download URL rayito-0.12.0-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
45ff3b72f87eee80ae22b463a6aaf35281c71dba1bd78f5eec43a4add75f277b
BLAKE2b-256 checksum
How to use checksums
409433f764ace56bafdaadcbae8c4d27da2317a428961fdf84a29ca4eac4cfb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for rayito 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rayito-0.12.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page