sandbox-execution-fallback-717e65
यह क्या करती है
यह स्किल AI एजेंट को उस कोड सैंडबॉक्स से हटने में मदद करती है जो बार-बार विफल होता है, और शेल में चलने वाली सहेजी स्क्रिप्ट फ़ाइलों पर जाती है। यह उन लोगों के लिए है जिनका सैंडबॉक्स अस्थिर है या समय सीमा पार कर जाता है।
कब इस्तेमाल करें
- ✓जब दो-तीन बार दोबारा कोशिश के बाद भी कोड सैंडबॉक्स विफल हो।
- ✓जब एरर आपके कोड की गलती की बजाय सेवा की समस्या की ओर इशारा करे।
- ✓जब फ़ाइल पढ़ने और लिखने वाले जटिल कोड को ज़्यादा साफ़ एरर संदेश चाहिए।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback-717e65/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“कोड सैंडबॉक्स मेरे डेटा काम पर बार-बार समय सीमा पार कर रहा है। इसे स्क्रिप्ट के रूप में लिखिए और शेल से चलाइए, ताकि मैं एरर देख सकूँ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट Python कोड एक फ़ाइल में लिखता है, और ज़रूरत हो तो बड़े काम को कई फ़ाइलों में बाँटता है। वह स्क्रिप्ट शेल से चलाता है और आउटपुट व एरर पढ़कर अगला कदम तय करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Sandbox Execution Fallback
When to Use
Apply this pattern when execute_code_sandbox fails repeatedly or exhibits instability. Common triggers include:
- Sandbox returns errors after 2-3 retry attempts
- Error messages indicate provider/system issues rather than code bugs
- Execution times out or hangs inconsistently
- Complex multi-step code with file I/O is needed
- Better error visibility and debugging is required
Procedure
Step 1: Detect When to Switch
Recognize the failure pattern:
execute_code_sandboxproduces repeated errors despite code corrections- Error output suggests infrastructure issues (not syntax/logic errors)
- The sandbox environment appears unstable or limited
Step 2: Write Python Script to File
Use write_file to save your script:
write_file(
path="script.py",
content="#!/usr/bin/env python3
# Your Python code here
import sys
print('Executing via file-based approach')
# ... rest of your code
"
)
For multi-file projects, write each file separately:
write_file(path="utils.py", content="# Utility functions\ndef helper(): ...")
write_file(path="main.py", content="from utils import helper\nhelper()")
Step 3: Execute via Shell
Run the script using run_shell:
run_shell(command="python3 script.py")
For scripts in subdirectories:
run_shell(command="cd mydir && python3 script.py")
Step 4: Handle Output and Clean Up
- Parse stdout/stderr from
run_shelloutput - Inspect created files directly using
read_fileif needed - Remove temporary scripts after successful execution:
run_shell(command="rm script.py")
Advantages Over Sandbox Execution
| Benefit | Explanation |
|---|---|
| Bypasses provider limitations | No sandbox resource constraints |
| Better error visibility | Full stack traces and system errors |
| Environment control | Direct access to system Python and packages |
| Multi-file support | Easy imports and module structure |
| Persistence | Files remain for inspection and debugging |
| Reliability | More consistent execution behavior |
Complete Example
# Scenario: execute_code_sandbox failing on data processing task
# Step 1: Write the script
write_file(
path="process_data.py",
content="#!/usr/bin/env python3
import json
import csv
# Load and process data
with open('input.json', 'r') as f:
data = json.load(f)
# Transform data
results = []
for item in data:
results.append({'processed': item['value'] * 2})
# Write output
with open('output.csv', 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=['processed'])
writer.writeheader()
writer.writerows(results)
print('Processing complete')
"
)
# Step 2: Execute via shell
run_shell(command="python3 process_data.py")
# Step 3: Read results
read_file(filetype="csv", file_path="output.csv")
# Step 4: Clean up (optional)
run_shell(command="rm process_data.py")
Best Practices
- Use absolute or clear relative paths - Avoid ambiguity in file locations
- Add error handling in scripts - Catch exceptions and print meaningful messages
- Validate script content before writing - Ensure proper Python syntax
- Log execution steps - Track what was written and executed for debugging
- Clean up temporary files - Remove scripts after use unless needed for later inspection
Troubleshooting
| Issue | Solution |
|---|---|
python3 not found |
Try python or specify full path /usr/bin/python3 |
| Import errors | Use run_shell(command="pip3 install package") first |
| Permission denied | Add execute permission: run_shell(command="chmod +x script.py") |
| Working directory issues | Use absolute paths or cd in the command |
अक्सर पूछे जाने वाले सवाल
मुझे कैसे पता चले कि समस्या सैंडबॉक्स की है?
स्किल कहती है कि बार-बार विफलता या टाइम आउट जैसे बुनियादी ढाँचे की समस्या के संकेत मिलें तो स्विच करें, कोड की गलती नहीं।
क्या काम कई फ़ाइलों से हो सकता है?
हाँ, स्किल कहती है कि हर फ़ाइल अलग लिखें और मुख्य फ़ाइल चलाएँ, जो बाकी को इम्पोर्ट करती है।
क्या सबफ़ोल्डर की स्क्रिप्ट चल सकती है?
हाँ, स्किल स्क्रिप्ट चलाने से पहले सबफ़ोल्डर में जाने का उदाहरण दिखाती है।
जानकारी
लेखक का मूल विवरण
Fallback from execute_code_sandbox to file-based run_shell execution when sandbox fails
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12985
- लाइसेंस
- 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 खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।