بنقرة واحدة
code-execution-fallback-e81068
Fallback workflow for executing Python code when execute_code_sandbox fails repeatedly
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Fallback workflow for executing Python code when execute_code_sandbox fails repeatedly
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.
Incremental audio production with duration mismatch handling, adaptive stem extension, and pre-mix alignment verification
Audio production with diagnostic analysis, timecode parsing from documents, and verified export workflow
Incremental audio production with duration alignment handling, per-stem verification, and adaptive extension strategies
Step-by-step audio production with per-stem verification, timing alignment, and incremental quality gates
End-to-end audio production workflow with stems, effects, archiving, and verification
| name | code-execution-fallback-e81068 |
| description | Fallback workflow for executing Python code when execute_code_sandbox fails repeatedly |
Use this skill when execute_code_sandbox fails repeatedly (2+ attempts) with unknown, persistent, or unexplained errors. This fallback approach uses write_file + run_shell to save Python scripts to disk and execute them via command line, which has proven more reliable in certain failure scenarios.
Monitor execute_code_sandbox attempts. After 2 consecutive failures with errors like:
Switch to the fallback workflow immediately.
Use write_file to save your Python code as a .py file in the working directory:
write_file(
path="script.py",
content="""
import sys
import json
# Your Python code here
def main():
# Your logic
result = {"status": "success", "data": "example"}
print(json.dumps(result))
if __name__ == "__main__":
main()
"""
)
Tips:
Use run_shell to execute the Python script via command line:
run_shell(
command="python3 script.py",
timeout=60 # Adjust timeout as needed
)
Alternative commands:
python script.py - if python3 alias isn't availablepython3 -u script.py - for unbuffered outputpython3 script.py arg1 arg2 - with argumentsCheck the stdout/stderr from run_shell to:
If the script writes output files, use read_file to retrieve results.
Remove temporary script files if they won't be reused:
run_shell(command="rm script.py")
Scenario: execute_code_sandbox failed twice while trying to process data.
Fallback execution:
# Step 1: Write the processing script
write_file(
path="process_data.py",
content="""
import pandas as pd
import json
def process():
data = [1, 2, 3, 4, 5]
result = {"sum": sum(data), "count": len(data)}
print(json.dumps(result))
# Also save to file for reliability
with open("result.json", "w") as f:
json.dump(result, f)
if __name__ == "__main__":
process()
"""
)
# Step 2: Execute via shell
output = run_shell(command="python3 process_data.py")
# Step 3: Read results from file
results = read_file(file_path="result.json", filetype="json")
| Issue | Solution |
|---|---|
python3: command not found | Try python instead, or check available interpreters with which python |
| Permission denied | Ensure the working directory is writable; write_file creates files in workspace by default |
| Module not found | Install dependencies via run_shell(command="pip install package_name") before execution |
| Script hangs | Increase timeout parameter in run_shell |
| Output too long | Redirect output to file within the script and read it separately |
task_specific_script.py)print(f"Step X complete: {value}")execute_code_sandboxexecute_code_sandbox succeeds consistently (no need to add complexity)