Index of every page on this site: llms.txt
All skills
rivet-dev avatar

/sandbox-agent

@3b027b3 official
by Rivetrivet-dev/skills53 stars
14
Run it yourself

Deploy, configure, and integrate Sandbox Agent - a universal API for orchestrating AI coding agents (Claude Code, Codex, OpenCode, Amp) in sandboxed environments. Use when setting up sandbox-agent server locally or in cloud sandboxes (E2B, Daytona, Docker), creating and managing agent sessions via SDK or API, streaming agent events and handling human-in-the-loop interactions, building chat UIs for coding agents, or understanding the universal schema for agent responses.

Use this Skill: https://skilld.dev/gh/rivet-dev/skills/sandbox-agent

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesreact-components.md

≈2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

React Components

Source: sandbox-agent/docs/content/docs/react-components.mdx Canonical URL: https://rivet.dev/sandbox-agent/docs/react-components Description: Drop-in React components for Sandbox Agent frontends.


@sandbox-agent/react exposes small React components built on top of the sandbox-agent SDK.

Current exports:

  • AgentConversation for a combined transcript + composer surface
  • ProcessTerminal for attaching to a running tty process
  • AgentTranscript for rendering session/message timelines without bundling any styles
  • ChatComposer for a reusable prompt input/send surface
  • useTranscriptVirtualizer for wiring large transcript lists to a scroll container

Install

npm install @sandbox-agent/react@0.5.x

Full example

This example connects to a running Sandbox Agent server, starts a tty shell, renders ProcessTerminal, and cleans up the process when the component unmounts.

"use client";

import { useEffect, useState } from "react";
import { SandboxAgent } from "sandbox-agent";
import { ProcessTerminal } from "@sandbox-agent/react";

export default function TerminalPane() {
  const [client, setClient] = useState<SandboxAgent | null>(null);
  const [processId, setProcessId] = useState<string | null>(null);
  const [error, setError] = useState<string | null>(null);

  useEffect(() => {
    let cancelled = false;
    let sdk: SandboxAgent | null = null;
    let createdProcessId: string | null = null;

    const cleanup = async () => {
      if (!sdk || !createdProcessId) {
        return;
      }

      await sdk.killProcess(createdProcessId, { waitMs: 1_000 }).catch(() => {});
      await sdk.deleteProcess(createdProcessId).catch(() => {});
    };

    const start = async () => {
      try {
        sdk = await SandboxAgent.connect({
          baseUrl: "http://127.0.0.1:2468",
        });

        const process = await sdk.createProcess({
          command: "sh",
          interactive: true,
          tty: true,
        });

        if (cancelled) {
          createdProcessId = process.id;
          await cleanup();
          await sdk.dispose();
          return;
        }

        createdProcessId = process.id;
        setClient(sdk);
        setProcessId(process.id);
      } catch (err) {
        const message = err instanceof Error ? err.message : "Failed to start terminal.";
        setError(message);
      }
    };

    void start();

    return () => {
      cancelled = true;
      void cleanup();
      void sdk?.dispose();
    };
  }, []);

  if (error) {
    return <div>{error}</div>;
  }

  if (!client || !processId) {
    return <div>Starting terminal...</div>;
  }

  return <ProcessTerminal client={client} processId={processId} height={480} />;
}

Component

ProcessTerminal attaches to a running tty process.

  • client: a SandboxAgent client
  • processId: the process to attach to
  • height, style, terminalStyle: optional layout overrides
  • onExit, onError: optional lifecycle callbacks

See Processes for the lower-level terminal APIs.

Headless transcript

AgentTranscript is intentionally unstyled. It follows the common headless React pattern used by libraries like Radix, Headless UI, and React Aria: behavior lives in the component, while styling stays in your app through className, slot-level classNames, and data-* state attributes on the rendered DOM.

import {
  AgentTranscript,
  type AgentTranscriptClassNames,
  type TranscriptEntry,
} from "@sandbox-agent/react";

const transcriptClasses: Partial<AgentTranscriptClassNames> = {
  root: "transcript",
  message: "transcript-message",
  messageContent: "transcript-message-content",
  toolGroupContainer: "transcript-tools",
  toolGroupHeader: "transcript-tools-header",
  toolItem: "transcript-tool-item",
  toolItemHeader: "transcript-tool-item-header",
  toolItemBody: "transcript-tool-item-body",
  divider: "transcript-divider",
  dividerText: "transcript-divider-text",
  error: "transcript-error",
};

export function TranscriptPane({ entries }: { entries: TranscriptEntry[] }) {
  return (
    <AgentTranscript
      entries={entries}
      classNames={transcriptClasses}
      renderMessageText={(entry) => <div>{entry.text}</div>}
      renderInlinePendingIndicator={() => <span>...</span>}
      renderToolGroupIcon={() => <span>Events</span>}
      renderChevron={(expanded) => <span>{expanded ? "Hide" : "Show"}</span>}
    />
  );
}
.transcript {
  display: grid;
  gap: 12px;
}

.transcript [data-slot="message"][data-variant="user"] .transcript-message-content {
  background: #161616;
  color: white;
}

.transcript [data-slot="message"][data-variant="assistant"] .transcript-message-content {
  background: #f4f4f0;
  color: #161616;
}

.transcript [data-slot="tool-item"][data-failed="true"] {
  border-color: #d33;
}

.transcript [data-slot="tool-item-header"][data-expanded="true"] {
  background: rgba(0, 0, 0, 0.06);
}

AgentTranscript accepts TranscriptEntry[], which matches the Inspector timeline shape:

  • message entries render user/assistant text
  • tool entries render expandable tool input/output sections
  • reasoning entries render expandable reasoning blocks
  • meta entries render status rows or expandable metadata details

Useful props:

  • className: root class hook
  • classNames: slot-level class hooks for styling from outside the package
  • scrollRef + virtualize: opt into TanStack Virtual against an external scroll container
  • renderMessageText: custom text or markdown renderer
  • renderToolItemIcon, renderToolGroupIcon, renderChevron, renderEventLinkContent: presentation overrides
  • renderInlinePendingIndicator, renderThinkingState: loading/thinking UI overrides
  • isDividerEntry, canOpenEvent, getToolGroupSummary: behavior overrides for grouping and labels

Transcript virtualization hook

useTranscriptVirtualizer exposes the same TanStack Virtual behavior used by AgentTranscript when virtualize is enabled.

  • Pass the grouped transcript rows you want to virtualize
  • Pass a scrollRef that points at the actual scrollable element
  • Use it when you need transcript-aware virtualization outside the stock AgentTranscript renderer

Composer and conversation

ChatComposer is the headless message input. AgentConversation composes AgentTranscript and ChatComposer so apps can reuse the transcript/composer pairing without pulling in Inspector session chrome.

import { AgentConversation, type TranscriptEntry } from "@sandbox-agent/react";

export function ConversationPane({
  entries,
  message,
  onMessageChange,
  onSubmit,
}: {
  entries: TranscriptEntry[];
  message: string;
  onMessageChange: (value: string) => void;
  onSubmit: () => void;
}) {
  return (
    <AgentConversation
      entries={entries}
      emptyState={<div>Start the conversation.</div>}
      transcriptProps={{
        renderMessageText: (entry) => <div>{entry.text}</div>,
      }}
      composerProps={{
        message,
        onMessageChange,
        onSubmit,
        placeholder: "Send a message...",
      }}
    />
  );
}

Useful ChatComposer props:

  • className and classNames for external styling
  • inputRef to manage focus or autoresize from the consumer
  • textareaProps for lower-level textarea behavior
  • allowEmptySubmit when the submit action is valid without draft text, such as a stop button

Use transcriptProps and composerProps when you want the shared composition but still need custom rendering or behavior. Use transcriptClassNames and composerClassNames when you want styling hooks for each subcomponent.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

3 alerts1d5 checks · Risk HIGH
  • Gen Agent Trust Hub1d

    The skill provides a universal API for orchestrating coding agents in sandboxed environments. It includes instructions for installing its own server components and various development tools using piped shell execution (remote code execution). The tool possesses broad capabilities for arbitrary command execution, filesystem access, and desktop control, and it features mechanisms for the agent to extract and export LLM credentials from the local host environment.

  • Socket1d

    1 alert: gptAnomaly

  • Snyk1d

    Risk: CRITICAL · 2 issues

  • Runlayer8mo

    34/41 files flagged

  • ZeroLeaks7mo

    1 finding · Score: 82/100

Signed by skilld at 3b027b3. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 days ago
  • TypeScript
  • sandbox-agent
  • api-orchestration
  • ai-agents
  • claude
  • openai
  • e2b
  • daytona
  • docker
  • session-management

README badge

README badge for rivet-dev/skills/sandbox-agent

Provides a universal API and orchestration layer for running Claude, Codex, OpenCode, and Amp coding agents in sandboxed environments (E2B, Daytona, Docker). Covers server setup, session management, event streaming, and integration with chat UIs and LLM providers.

Generated from the current SKILL.md.

Which coding agents does Sandbox Agent support?
Sandbox Agent provides a universal API for Claude Code, Codex, OpenCode, and Amp. It also supports a mock agent for testing without provider credentials.
What sandbox providers can I deploy to?
Sandbox Agent runs on E2B, Daytona, Docker, local development, and cloud platforms like Vercel and Cloudflare. You can also run it as a local subprocess via Node.js or Bun.
Do I need API keys to test Sandbox Agent?
No. Use the mock agent for SDK and integration testing without Anthropic or OpenAI credentials. For real agents, you'll need to set ANTHROPIC_API_KEY and/or OPENAI_API_KEY.
Can I use this for per-user billing or multi-tenant setups?
Yes. Sandbox Agent supports LLM credential gateways like OpenRouter, LiteLLM, and Portkey for per-tenant token tracking, budget enforcement, and usage-based billing.
What persistence options are available for agent sessions?
Sessions can be persisted in-memory, to Rivet Actor state, IndexedDB, SQLite, or Postgres depending on your deployment target.

Generated from the current SKILL.md. These answers refresh after source changes.