sandbox-fallback-python
यह क्या करती है
यह स्किल AI एजेंट को तब शेल से Python चलाने का मार्गदर्शन देती है जब सैंडबॉक्स तक पहुँच न हो। यह उन लोगों के लिए है जिनके Python काम पैकेज और फ़ाइल आउटपुट पर निर्भर हैं।
कब इस्तेमाल करें
- ✓जब सैंडबॉक्स बताए कि वह उपलब्ध नहीं है या कनेक्शन विफल हुआ।
- ✓जब Python स्क्रिप्ट को चलने से पहले कुछ पैकेज इंस्टॉल करने पड़ें।
- ✓जब स्क्रिप्ट को वर्किंग फ़ोल्डर में फ़ाइलें पढ़नी या लिखनी हों।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-fallback-python/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“सैंडबॉक्स उपलब्ध नहीं है। मेरी स्क्रिप्ट के लिए ज़रूरी पैकेज इंस्टॉल कीजिए, फिर उसे चलाकर आउटपुट मेरे वर्कस्पेस में सहेजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट pip से पैकेज इंस्टॉल करता है, फिर heredoc से Python कोड शेल में चलाता है। फ़ाइलों के लिए वह स्पष्ट पाथ इस्तेमाल करता है और यह पुष्टि करने के लिए फ़ोल्डर की सूची देखता है कि आउटपुट सहेजा गया।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Sandbox Fallback: Python via run_shell
When to Use This Skill
Apply this skill when execute_code_sandbox fails with errors indicating:
- e2b service unavailability
- Sandbox timeout or connection issues
- Code execution environment not accessible
This fallback allows you to execute Python code directly via shell, bypassing the sandbox infrastructure.
Fallback Procedure
Step 1: Detect Sandbox Failure
Identify fallback necessity from error messages like:
- "e2b unavailable"
- "sandbox connection failed"
- "execution environment error"
- Timeout errors during code execution
Step 2: Switch to run_shell with Embedded Python
Instead of execute_code_sandbox, use run_shell with a Python heredoc or inline script:
python3 << 'EOF'
# Your Python code here
print("Hello from fallback execution")
EOF
Step 3: Install Dependencies First
If your Python code requires packages not guaranteed to be installed:
pip install package_name package_name2 && python3 << 'EOF'
# Your Python code here
import package_name
print("Code with dependencies executed")
EOF
Step 4: Handle File I/O
For scripts that need to read/write files:
- Use absolute or explicit relative paths
- Files persist in the workspace directory
- List directory contents with
lsto verify file operations
python3 << 'EOF'
import os
# Write output to file
with open("output.txt", "w") as f:
f.write("Results here")
# Verify
print(f"Working directory: {os.getcwd()}")
EOF
Code Examples
Simple Calculation
python3 << 'EOF'
result = sum(range(100))
print(f"Sum: {result}")
EOF
With Package Installation
pip install requests -q && python3 << 'EOF'
import requests
response = requests.get("https://api.example.com/data")
print(response.json())
EOF
With JSON Processing
python3 << 'EOF'
import json
data = {"key": "value", "count": 42}
output = json.dumps(data, indent=2)
print(output)
# Save to file
with open("data.json", "w") as f:
f.write(output)
EOF
Best Practices
- Use heredoc syntax -
<< 'EOF'prevents variable expansion issues - Install quietly - Use
pip install -qto reduce output noise - Error handling - Add try/except blocks in Python code for robustness
- Verify execution - Check stdout/stderr from run_shell to confirm success
- Keep code compact - Long scripts are harder to debug in shell context
Caveats
- No persistent state between run_shell calls (unlike execute_code_sandbox)
- Longer execution time for complex scripts due to Python interpreter startup
- Limited debugging - Cannot easily inspect variables between statements
- Output size limits - Very large outputs may be truncated
When NOT to Use This Fallback
- If the task specifically requires sandbox isolation for security
- If you need persistent state across multiple code executions
- If the code execution is extremely long-running (consider backgrounding)
अक्सर पूछे जाने वाले सवाल
एजेंट आउटपुट कैसे जाँचता है?
वह शेल के संदेश पढ़ता है और नई फ़ाइलें देखने के लिए फ़ोल्डर की सूची बनाता है।
स्पष्ट पाथ क्यों इस्तेमाल करें?
स्पष्ट पाथ पक्का करते हैं कि फ़ाइलें उसी वर्कस्पेस फ़ोल्डर में सहेजी जाएँ जिसकी आप उम्मीद करते हैं।
क्या बिना कुछ इंस्टॉल किए यह काम करता है?
अगर पैकेज पहले से मौजूद हों, तो इंस्टॉल चरण छोड़ा जा सकता है।
जानकारी
लेखक का मूल विवरण
Fallback to run_shell with embedded Python when execute_code_sandbox fails due to e2b unavailability
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12992
- लाइसेंस
- 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 खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।