Fallback workflow for executing Python code when execute_code_sandbox fails
54
60%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Critical
Do not install without reviewing
Fix and improve this skill with Tessl
tessl review fix ./benchmarks/gdpval/skills/sandbox-fallback-execution/SKILL.mdUse this pattern when execute_code_sandbox fails with unknown errors, timeouts, or persistent execution failures. This fallback bypasses sandbox restrictions by using run_shell with a Python heredoc script.
execute_code_sandbox fails → run_shell with pip install → Python heredoc executionMonitor for these failure indicators from execute_code_sandbox:
Use run_shell to install any required Python packages:
pip install <package_name>For multiple packages:
pip install package1 package2 package3Run Python code using a heredoc script with run_shell:
python3 << 'EOF'
# Your Python code here
import sys
print("Hello from fallback execution")
EOFKey heredoc syntax notes:
<< 'EOF' (quoted) to prevent shell variable expansion<< EOF (unquoted) if you need shell variable interpolationEOF on its own lineScenario: Need to create a Word document but execute_code_sandbox keeps failing.
# Step 1: Install required package
pip install python-docx
# Step 2: Execute Python script via heredoc
python3 << 'EOF'
from docx import Document
doc = Document()
doc.add_heading('Proposal Document', 0)
doc.add_paragraph('This is the proposal content.')
doc.save('proposal.docx')
print("Document created successfully")
EOF'EOF') to avoid unintended shell expansion of Python code| Issue | Solution |
|---|---|
pip not found | Try pip3 or python3 -m pip install |
| Script hangs | Add timeout to run_shell command |
| Permission errors | Check file paths are writable |
| Import errors | Verify package was installed successfully |
run_shell: Execute shell commands directlyexecute_code_sandbox: Primary Python execution tool (try first)shell_agent: For more complex multi-step shell tasksc5a9c4b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.