Fallback pattern for executing Python code when execute_code_sandbox fails by writing to file and running via shell
48
50%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./benchmarks/gdpval/skills/sandbox-exec-fallback/SKILL.mdUse this skill when execute_code_sandbox fails during Python code execution, particularly for tasks involving:
When execute_code_sandbox returns an error or fails to produce expected output:
Use write_file to save your Python script to a file:
# Use write_file tool with:
path: "script.py"
content: <your complete Python code as a string>Use run_shell to execute the script:
# Use run_shell tool with:
command: "python3 script.py"
timeout: <appropriate timeout, e.g., 300 for long-running tasks>Check the shell output for:
If the script creates output files (e.g., spreadsheets), they will be in the current working directory. Use list_dir to confirm, then read_file to access if needed.
python3 in the shell uses the same environment as the sandboxOriginal code that failed in execute_code_sandbox:
import pandas as pd
data = {'A': [1, 2, 3], 'B': [4, 5, 6]}
df = pd.DataFrame(data)
df.to_excel('output.xlsx', index=False)
print("File created successfully")Recovery Execution:
write_file with path="generate_spreadsheet.py" and the code above as contentrun_shell with command="python3 generate_spreadsheet.py"list_dirtimeout for complex operations (default 30s may be insufficient)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.