Install
npx skillscat add strikersam/autonomous-ai-agency/agents-skills-sandboxed-exec Install via the SkillsCat registry.
SKILL.md
Skill: sandboxed-exec
Purpose
Run shell commands or code snippets in an isolated subprocess environment, preventing side effects from leaking into the host workspace. Mirrors the "Modal Sandbox" pattern described in the OpenAI Agents SDK blog post — give an agent a safe "home computer" to work on.
When to Use
- You need to run untrusted or exploratory code (e.g. test a one-off script, validate a dependency, try a risky refactor) without touching the real working tree.
- You want to verify that generated code actually executes before committing it.
- You need a clean-room environment (fresh temp dir, isolated env vars) for reproducible testing.
How It Works
- Creates a temporary directory as the sandbox root.
- Copies (or writes) the target files into the sandbox.
- Executes the requested command inside that directory with a sanitised environment.
- Captures stdout, stderr, and exit code.
- Reports results back — nothing is written to the real workspace unless explicitly requested.
Usage
@sandboxed-exec
command: <shell command to run>
files: <optional list of workspace-relative files to copy into sandbox>
write_back: <true|false — default false>Example — validate a generated script before saving
@sandboxed-exec
command: python validate.py
files: [scripts/validate.py, data/sample.json]
write_back: falseExample — run tests in isolation
@sandboxed-exec
command: npm test
files: [src/, package.json, tsconfig.json]
write_back: falseSteps (for Claude to follow)
- Identify the command and files from the invocation.
- Create sandbox:
SANDBOX=$(mktemp -d) - Copy files into
$SANDBOXpreserving relative paths. - Execute with a clean environment:
cd "$SANDBOX" && env -i HOME="$SANDBOX" PATH="/usr/local/bin:/usr/bin:/bin" <command> - Capture exit code, stdout, stderr.
- Report full output. If
write_back: trueand exit code is 0, copy results back to workspace. - Cleanup sandbox dir.
Security Notes
- Never pass host secrets or API keys into the sandbox unless explicitly needed.
write_backdefaults tofalse— always confirm before overwriting workspace files.- For long-running or GPU-intensive tasks, see the
parallel-agentsskill instead.
Output Format
SANDBOX RESULT
==============
Exit code : 0
Command : <command>
Stdout :
<stdout>
Stderr :
<stderr>
Write-back: false (no workspace files modified)