Fallback pattern for when execute_code_sandbox fails - write script to file and execute directly with run_shell
53
58%
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-execution-fallback-238489/SKILL.mdThis skill provides a reliable fallback pattern when execute_code_sandbox fails for code execution tasks (especially PDF generation, complex file operations, or library-dependent tasks).
Use this fallback pattern when:
execute_code_sandbox returns errors or fails to produce expected outputInstead of executing code directly in the sandbox, use write_file to create a standalone Python script:
Use write_file to create a script (e.g., script.py) with your complete Python code.Run the script using run_shell with Python:
Use run_shell with command: python3 script.pyCheck that the script executed successfully and produced the expected files or output.
Instead of this (sandbox execution):
execute_code_sandbox with code using libraries like reportlab, fpdf, etc.Do this (fallback pattern):
# Step 1: Create the script
write_file:
path: generate_pdf.py
content: |
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
def create_pdf(filename):
c = canvas.Canvas(filename, pagesize=letter)
c.drawString(100, 750, "Hello World")
c.save()
create_pdf("output.pdf")
# Step 2: Execute directly
run_shell:
command: python3 generate_pdf.pyIf run_shell also fails:
run_shell command: python3 --versionrun_shell command: pip3 install package_nameThis pattern bypasses sandbox limitations by:
This skill captures a genuinely reusable pattern that:
c5a9c4b
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.