code-exec-fallback
यह क्या करती है
यह स्किल Python कोड चलाने का बैकअप तरीका है, जब अंतर्निहित रनर बार-बार विफल हो। यह उन लोगों के लिए है जिन्हें अपने AI के डेटा या गणना की स्क्रिप्ट हर हाल में चलानी है।
कब इस्तेमाल करें
- ✓जब सीमा, टाइम आउट या गायब पैकेज की वजह से रनर दो या अधिक बार विफल हो।
- ✓जब मुझे डेटा स्क्रिप्ट शेल से तय समय सीमा के साथ चलानी हो।
- ✓जब मैं चाहता हूँ कि AI रन का आउटपुट पढ़े और कोई एरर हो तो बताए।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/code-exec-fallback/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“Python रनर मेरी स्प्रेडशीट पर बार-बार टाइम आउट हो रहा है। क्या आप स्क्रिप्ट को फ़ाइल में सहेजकर उसे चला सकते हैं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI स्क्रिप्ट को फ़ाइल में लिखता है, शेल में python3 से चलाता है, तय समय तक इंतज़ार करता है और आउटपुट पढ़ता है। बाद में फ़ाइल हटाई जा सकती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Code Execution Fallback
When to Use
Use this pattern when execute_code_sandbox fails repeatedly (typically 2+ attempts) due to environment limitations, timeouts, dependency issues, or sandbox restrictions.
The Pattern
Instead of executing code directly in the sandbox, write the Python script to a file and execute it via shell:
- Write the script using
write_file - Execute via shell using
run_shellwithpython3 script.py - Clean up (optional) remove the temporary file
Step-by-Step Instructions
Step 1: Write the Python Script
Use write_file to save your Python code:
- Path: Choose a descriptive name (e.g., "process_data.py", "analyze.py")
- Content: Your complete Python script with all imports and logic
Step 2: Execute via Shell
Use run_shell to execute:
- Command: "python3 <script_name>.py"
- Timeout: Set appropriately for your task (default 30s, increase if needed)
Step 3: Handle Output
- Capture stdout/stderr from run_shell
- Parse results as needed
- Optionally delete the script file after execution
Example
# Instead of this (which may fail):
execute_code_sandbox(code="import pandas as pd; df = pd.read_csv('data.csv')...")
# Do this:
write_file(path="analyze.py", content="""
import pandas as pd
import json
df = pd.read_csv('data.csv')
result = df.groupby('category').sum()
print(json.dumps(result.to_dict()))
""")
run_shell(command="python3 analyze.py", timeout=60)
Tips for Success
- Include all imports in the script file - the shell environment may differ from the sandbox
- Use absolute paths or ensure working directory is correct
- Add error handling to your script for better debugging
- Increase timeout for long-running operations (default is 30s)
- Print structured output (JSON) if you need to parse results
- Clean up temporary files after successful execution to avoid clutter
When This Helps
- Sandbox has missing dependencies
- Code execution times out in sandbox but would work in shell
- File I/O operations are restricted in sandbox
- Need to run external commands or system utilities
- Complex multi-file projects that need proper file structure
अक्सर पूछे जाने वाले सवाल
रनर की बजाय फ़ाइल क्यों?
गाइड के अनुसार कुछ विफलता के मामलों में यह तरीका ज़्यादा भरोसेमंद साबित हुआ है।
डिफ़ॉल्ट समय सीमा क्या है?
डिफ़ॉल्ट 30 सेकंड है, और ज़रूरत हो तो इसे बढ़ाया जा सकता है।
क्या स्क्रिप्ट को कोई खास सेटअप चाहिए?
स्क्रिप्ट में सभी imports और लॉजिक होने चाहिए, ताकि वह अपने-आप चल सके।
जानकारी
लेखक का मूल विवरण
Fallback pattern for executing Python code when execute_code_sandbox fails
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12845
- लाइसेंस
- 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 खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।