- MCP Server ToolsUpdated
- Managed MCP with chat()Updated
- Manual MCPUpdated
- MCP Type GenerationUpdated
- MCP Client InputUpdated
- MCP Server Tools: AdvancedNew
- MCP EventsNew
- MCP AppsUpdated
- Serve Tools over HTTPUpdated
- Serve Resources and PromptsUpdated
- Ask for InputUpdated
- Draft Text from a ToolUpdated
- MCP Server TasksUpdated
- MCP Server AuthUpdated
- MCP Server SessionsUpdated
- MCP Server on stdioUpdated
Persistence (Advanced)
- GenerationsUpdated
- Realtime Voice ChatUpdated
- Text-to-SpeechUpdated
- TranscriptionUpdated
- Transcription: AdvancedNew
- Voice CreationUpdated
- Audio RecordingUpdated
- Audio GenerationUpdated
- Image GenerationUpdated
- Image Generation: AdvancedNew
- Video GenerationUpdated
- Video Generation: AdvancedNew
- Live GenerationUpdated
- World GenerationUpdated
- Generation HooksUpdated
- OverviewUpdated
- Quick StartUpdated
- ProvidersUpdated
- HarnessesUpdated
- Harness AuthUpdated
- WorkspaceUpdated
- ToolsUpdated
- PolicyUpdated
- Lifecycle & SnapshotsUpdated
- Portable SnapshotsUpdated
- Keep Files After ReloadUpdated
- Save a Named VersionUpdated
- Branch From a VersionUpdated
- Send a Frozen FileUpdated
- Let the Agent Save and ForkUpdated
- Pick Which Files to KeepUpdated
- What a Snapshot StoresUpdated
- Instance DurabilityUpdated
- Durable RunsUpdated
- EventsUpdated
Sandboxes (Advanced)
- Runtime ContextUpdated
- Bring Your Own KeyUpdated
- Debug LoggingUpdated
- Multimodal ContentUpdated
- Files APIUpdated
- Per-Model Type SafetyUpdated
- Runtime Adapter SwitchingUpdated
- Tree-ShakingUpdated
- Extend AdapterUpdated
- Extend Adapter: AdvancedNew
- Typed Pre-Configured OptionsUpdated
- Test with a Fake ModelUpdated
- Prompt CachingUpdated
- Mid-Conversation ChangesUpdated
- Approval Flow ProcessingUpdated
What a Snapshot Stores
The default snapshot policy excludes secrets, git metadata, and install trees. A capture or restore stops when it finds an unsafe filesystem entry.
Portable snapshots store regular files and directories only. When a capture or restore finds a symlink, an executable file, or a special filesystem entry, it fails with SandboxSnapshotError code SANDBOX_SNAPSHOT_UNSUPPORTED_ENTRY. Exclude scripts, hooks, and other executable files in policy.exclude. An executable bit on a regular file stops the whole capture or restore.
Default exclusions#
The default policy excludes these path segments at every depth:
- .git
- node_modules
- .env*
It also excludes these exact paths:
- The projection marker, .tanstack-projected-<workspaceHash>, at the workspace root only.
- CLAUDE.md and GEMINI.md at the workspace root.
- Direct .claude/skills/<name>, .codex/skills/<name>, and .grok/skills/<name> paths.
These exclusions use paths for regular files and copied files too.
Replace the default policy#
To keep only some files, or one file, see Pick Which Files to Keep. If you pass only include or only redact, the default exclusions stay in place. If you pass exclude, copy defaultSandboxSnapshotPolicy() first. Then add your rules.
import { defaultSandboxSnapshotPolicy } from '@tanstack/ai-sandbox'
const policy = {
...defaultSandboxSnapshotPolicy(),
redact({ bytes }: { bytes: Uint8Array }) {
return bytes
},
}When you create the snapshots object, pass policy. See Keep Files After Reload.
The exact projection marker for the workspace stays protected. A custom policy cannot capture or restore that marker.
Secrets#
Resolved secret values are replaced with zero bytes before the content is hashed or stored.
Restore safety#
An invalid manifest, a missing blob, or changed blob content stops the restore before it writes the workspace. The failed private sandbox is then discarded. Your existing resumed sandbox stays unchanged.
See Providers for provider-native snapshot and resume support.