Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mattpocock/sandcastle/llms.txt
Use this file to discover all available pages before exploring further.
interactive() launches an agent’s interactive terminal UI (TUI) with your terminal attached. Unlike run(), which runs the agent unattended, interactive() puts you in the session — you can watch what the agent does and approve any permission prompts in real time. When the session ends, Sandcastle collects commits and handles branch merging just as it does for run().
interactive() is the only top-level function that accepts noSandbox() as the sandbox option. With noSandbox(), the agent runs directly on your host machine without a container and without --dangerously-skip-permissions — permissions are gated by the interactive TUI instead.
Import
Signature
Usage with noSandbox()
Usage with a container sandbox
Options
The agent provider — for example
claudeCode("claude-opus-4-7"). The provider must implement buildInteractiveArgs.Sandbox provider. Accepts
docker(), podman(), vercel(), or noSandbox(). Defaults to noSandbox() when omitted. With noSandbox(), the agent runs directly on the host without --dangerously-skip-permissions.Inline prompt passed to the agent at session start. Optional — omit to open the TUI with no initial message. Mutually exclusive with
promptFile.Path to a prompt file. Mutually exclusive with
prompt. Resolves against process.cwd().Optional display name for the session, shown in the summary output.
Branch strategy. Defaults to
{ type: "head" } for bind-mount and no-sandbox providers, and { type: "merge-to-head" } for isolated providers. See BranchStrategy.Lifecycle hooks. See SandboxHooks.
Host-relative file paths to copy into the worktree before the session starts. Not supported with
branchStrategy: { type: "head" }.Key-value map for
{{KEY}} placeholder substitution. Only applies when using promptFile. Passing promptArgs with an inline prompt is an error.Additional environment variables to inject into the sandbox. Merged on top of
.sandcastle/.env and provider env.Host repo directory. Relative paths resolve against
process.cwd(); absolute paths pass through as-is.An
AbortSignal that cancels the session when aborted. If already aborted at entry, interactive() rejects immediately. The rejected promise surfaces signal.reason directly — no Sandcastle-specific wrapping.Return value
List of commits made during the interactive session.
The branch name the agent worked on.
Host path to the preserved worktree, set when the worktree had uncommitted changes at session end.
undefined when the worktree was clean.Exit code of the interactive agent process.
Notes
promptis optional forinteractive(). Omitting it opens the TUI with no initial message, letting you type the first prompt yourself.- With
noSandbox(), the agent runs on the host and the standard permission UI is active — no--dangerously-skip-permissionsflag is passed. - All three branch strategies (
head,merge-to-head,branch) are supported, unlikecreateWorktree()which excludeshead.