@sandbox-agent/react exposes small React components built on top of the sandbox-agent SDK.
Current exports:
AgentConversationfor a combined transcript + composer surfaceProcessTerminalfor attaching to a running tty processAgentTranscriptfor rendering session/message timelines without bundling any stylesChatComposerfor a reusable prompt input/send surfaceuseTranscriptVirtualizerfor wiring large transcript lists to a scroll container
Install
Full example
This example connects to a running Sandbox Agent server, starts a tty shell, rendersProcessTerminal, and cleans up the process when the component unmounts.
TerminalPane.tsx
Component
ProcessTerminal attaches to a running tty process.
client: aSandboxAgentclientprocessId: the process to attach toheight,style,terminalStyle: optional layout overridesonExit,onError: optional lifecycle callbacks
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.
TranscriptPane.tsx
AgentTranscript accepts TranscriptEntry[], which matches the Inspector timeline shape:
messageentries render user/assistant texttoolentries render expandable tool input/output sectionsreasoningentries render expandable reasoning blocksmetaentries render status rows or expandable metadata details
className: root class hookclassNames: slot-level class hooks for styling from outside the packagescrollRef+virtualize: opt into TanStack Virtual against an external scroll containerrenderMessageText: custom text or markdown rendererrenderToolItemIcon,renderToolGroupIcon,renderChevron,renderEventLinkContent: presentation overridesrenderInlinePendingIndicator,renderThinkingState: loading/thinking UI overridesisDividerEntry,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
scrollRefthat points at the actual scrollable element - Use it when you need transcript-aware virtualization outside the stock
AgentTranscriptrenderer
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.
ConversationPane.tsx
ChatComposer props:
classNameandclassNamesfor external stylinginputRefto manage focus or autoresize from the consumertextareaPropsfor lower-level textarea behaviorallowEmptySubmitwhen the submit action is valid without draft text, such as a stop button
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.