fallback-code-execution
यह क्या करती है
यह स्किल Python कोड चलाने का एक तरीका है, जब सैंडबॉक्स अज्ञात या अस्थिर एरर के साथ बार-बार विफल हो। यह उन लोगों के लिए है जिनका AI ऐसा कोड चलाता है जिससे नतीजे आने ही चाहिए।
कब इस्तेमाल करें
- ✓जब सैंडबॉक्स एक ही कोड पर लगातार दो या अधिक बार विफल हो।
- ✓जब एरर सामान्य हों और संकेत दें कि समस्या वातावरण की है, कोड की गलती की नहीं।
- ✓जब मैं चाहता हूँ कि स्क्रिप्ट फ़ाइल के रूप में रहे, ताकि उसे जाँचा और फिर चलाया जा सके।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-code-execution/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“सैंडबॉक्स मेरी स्क्रिप्ट पर सामान्य एरर दे रहा है, जबकि तर्क सही है। कृपया इसे फ़ाइल में सहेजकर चलाइए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI स्क्रिप्ट को कार्य-क्षेत्र में एक स्पष्ट नाम से लिखता है, पहले ज़रूरी डिपेंडेंसी इंस्टॉल करता है, और कैप्चर किए गए आउटपुट के साथ शेल से चलाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Fallback Code Execution Workflow
Overview
This skill defines a robust workaround for executing code (specifically Python) when the primary execute_code_sandbox tool fails repeatedly with unknown or transient errors. Instead of continuing to retry the failing tool, the agent switches to a manual file-write and shell-execution pattern.
Trigger Conditions
Activate this workflow when:
execute_code_sandboxfails 2 or more times consecutively for the same logic.- Error messages are generic, unknown, or indicate environment issues rather than syntax errors.
- The code logic itself is verified correct but the execution environment is unstable.
Procedure
Step 1: Write Script to File
Use the write_file tool to save the Python script to a specific path in the workspace.
- Path: Choose a descriptive name ending in
.py(e.g.,scripts/generate_report.py). - Content: Ensure the script includes necessary error handling and print statements for debugging.
- Dependencies: If the script requires external libraries, ensure a
requirements.txtis updated or installed via shell beforehand.
Example:
tool: write_file
path: workspace/scripts/process_data.py
content: |
import sys
# ... script logic ...
print("Success")
Step 2: Execute via Shell
Use the run_shell tool to execute the script using the system Python interpreter.
- Command:
python3 <path_to_script>orpython <path_to_script>. - Working Directory: Ensure the shell command runs from the workspace root or the directory containing the script.
- Capture Output: Store stdout and stderr for verification.
Example:
tool: run_shell
command: python3 scripts/process_data.py
Step 3: Verify Execution
- Check Exit Code: Ensure the shell command returned exit code
0. - Check Output: Verify expected files were created or expected stdout messages appeared.
- Handle Errors: If the shell execution fails, inspect the stderr output. This often provides more detailed tracebacks than the sandbox tool.
Best Practices
- Absolute Paths: When writing scripts that access files, use absolute paths or resolve paths relative to
__file__to avoid working directory issues. - Permissions: Ensure the workspace directory allows file creation and execution.
- Cleanup: Optionally remove temporary scripts after successful execution if cleanliness is required.
- Logging: Add explicit
print()statements in the Python script to log progress, as shell output capture is sometimes more reliable than sandbox return values.
Example Scenario
Problem: execute_code_sandbox times out while generating a PDF.
Solution:
- Write
generate_pdf.pytoworkspace/scripts/. - Run
python3 workspace/scripts/generate_pdf.pyviarun_shell. - Confirm
output.pdfexists in the workspace.
अक्सर पूछे जाने वाले सवाल
स्क्रिप्ट फ़ाइल के रूप में क्यों रखें?
सहेजी गई फ़ाइल को जाँचा, बदला और फिर चलाया जा सकता है, बिना कोड दोबारा लिखे।
स्क्रिप्ट कहाँ सहेजी जाती है?
कार्य-क्षेत्र में, .py पर खत्म होने वाले स्पष्ट नाम से।
अगर पैकेज चाहिए हों तो?
गाइड कहती है कि उन्हें पहले requirements फ़ाइल से या शेल के ज़रिए इंस्टॉल करें।
जानकारी
लेखक का मूल विवरण
Fallback workflow for running code via file write and shell when sandbox execution fails
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12879
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।