Skip to content
Agents API
Environments and sandboxes

Rebyte Sandboxes

Configure an isolated Rebyte Sandbox for an agent session.

On this pageCreate a managed environmentTools supplied by an EnvironmentConfigure dependenciesAdd skillsHow the model uses a SkillLimitsRebyte SDK

openai_hosted is the Agents API protocol value for a managed environment. When your client connects to Rebyte, Rebyte provisions and operates the Sandbox. The name is retained for protocol compatibility.

Create a managed environment

const session = await client.beta.agents.sessions.create({
  agent: { model: 'gpt-5.6-luna', instructions: 'Work in /workspace.' },
  environment: {
    type: 'openai_hosted',
    files: [{
      type: 'inline', path: '/workspace/input.txt',
      data: Buffer.from('Hello from your application').toString('base64'),
    }],
    packages: { python: ['pandas'], npm: [], system: [] },
    setup_commands: [{ command: 'mkdir -p /workspace/outputs', cwd: '/workspace' }],
    network: { access: 'enabled' },
  },
});

Each Session gets its own Environment configuration and fixed Sandbox binding. Allocation is lazy: creating this Session does not run setup until an environment operation needs the Sandbox. Files and processes are not shared merely because two Sessions use the same saved Agent.

Tools supplied by an Environment

Saved Agents default to tools: []. An explicit hosted Environment adds:

Model toolBehavior
exec_commandRuns a command in the Session Sandbox. A command still running after the yield interval returns a process session_id; completed commands return an exit code. tty: true allocates a PTY.
write_stdinSends characters or polls new output for that process session_id. Use the same Session and Sandbox that created it.
apply_patchApplies the structured patch format to files in the Session environment.
view_imageReads a local image and supplies image content to the model.

The process session_id is a handle from the command executor, not the API's sess_... conversation ID. It is valid only while the process survives in that Sandbox. A missing process fails explicitly. Rebyte uses a preinstalled Codex exec-server for process execution; no first-use download is required. Rebyte owns the model loop and environment lifecycle.

Omit environment, pass null, or use { type: 'none' } to expose no environment tools and allocate no Sandbox. Such a Session needs initial input. Service-origin MCP, Web Search and client functions remain available when explicitly configured. The Environment cannot be added or replaced later on an existing Session.

Configure dependencies

Use packages.python, packages.npm, and packages.system to prepare dependencies. Rebyte installs Node packages using pnpm. Use setup_commands for Session-specific preparation and env for setup environment variables.

Paths must be within /workspace. Set up the binaries and dependencies used by stdio MCP servers before those servers execute.

Add skills

Rebyte accepts inline skills through environment.skills. Each entry has a name, description, and base64-encoded ZIP source:

const skill = {
  type: 'inline',
  name: 'reporting',
  description: 'Instructions for preparing reports.',
  source: {
    type: 'base64', media_type: 'application/zip',
    data: skillZipBase64,
  },
};

Supply the encoded archive as skillZipBase64 and include the entry in environment.skills. capability_directories selects directories in the Session environment used to load capabilities. OpenAI's own skill-reference mechanism and Plugins are not supported.

Rebyte extension: alongside inline ZIP skills, environment.skills also accepts type: "github" to install a skill from a public GitHub repository or directory at Session initialization, without downloading it at Session-creation time:

{
  environment: {
    type: 'openai_hosted',
    skills: [
      { type: 'github', url: 'https://github.com/vercel-labs/skills', name: 'find-skills' },
    ],
  },
}

A bare repository URL requires name; a directory URL (including a commit-pinned tree/<sha>/... path) must resolve exactly one skill and name is then optional. Only HTTPS GitHub URLs are accepted, and URLs containing embedded credentials are rejected. The Rebyte SDK includes this GitHub Skill type. It is a Rebyte extension; users of the upstream OpenAI SDK can send it through the raw request method. Pin a commit-based directory URL for reproducible contents; resuming a Session never re-installs or refreshes the source.

How the model uses a Skill

Skill installation is part of first Sandbox initialization. It is not a saved Agent operation and does not repeat on subsequent Turns or Sandbox resume. The model reads the installed SKILL.md and follows its instructions with exec_command and the other environment tools. There is no separate List Skill, Run Skill or automatic tool for every Skill. Skill files do not grant MCP tools; MCP definitions and credentials are configured separately.

The Commerce example packages five checked-in Skill directories into per-Session inline ZIPs.

Limits

File-ID attachments are not implemented. Inline files are limited to approximately 5 MiB each. Inline skill archives may expand to at most 2,000 entries and 50 MiB. The HTTP body limit is 50 MiB.

Continue with Sandbox lifecycle and Files and artifacts.

Rebyte SDK

import { rebyteSandbox } from '@rebyteai/agent-sdk';

const environment = rebyteSandbox({
  skills: [{ type: 'github', url: 'https://github.com/your-org/skills', name: 'my-skill' }],
});
const session = await client.beta.agents.sessions.create({ agent_id: agentId, environment });

This helper names the compute provider correctly while retaining the openai_hosted protocol value for existing clients and persisted Sessions.

Protocol referenceOpenAI Agents API ↗