sandbox-failure-recovery
यह क्या करती है
यह कार्यप्रवाह AI एजेंट को विफल सैंडबॉक्स रन से कोड सहेजकर शेल से चलाकर रिकवर करने में मदद करता है। यह उन लोगों के लिए है जिन्हें ऐसे कोड से स्प्रेडशीट या दूसरी आउटपुट फ़ाइलें चाहिए जो पहले सही चल चुका है।
कब इस्तेमाल करें
- ✓जब फ़ाइल बनाने के काम पर कोड सैंडबॉक्स एरर लौटाए या टाइम आउट हो।
- ✓जब स्प्रेडशीट या CSV उस कोड से बनानी हो जो पहले से लिखा है।
- ✓जब कई प्रयासों में सैंडबॉक्स वातावरण अस्थिर लगे।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-failure-recovery/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“सैंडबॉक्स में विफल हुए कोड को स्क्रिप्ट बनाइए, उसे चलाइए, और जो Excel फ़ाइल बनी वह मुझे दीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट विफल कोड को लिखने वाले टूल से .py फ़ाइल में सहेजता है, फिर उसे समय सीमा के साथ python3 से शेल में चलाता है। वह पुष्टि करने के लिए आउटपुट पढ़ता है कि फ़ाइल बनी।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Sandbox Failure Recovery Workflow
When execute_code_sandbox fails (often due to infrastructure issues, timeouts, or complex dependencies), use this recovery pattern to achieve identical results by writing the code to a file and executing it directly.
When to Use This Skill
execute_code_sandboxreturns an error or times out- The task involves spreadsheet generation (Excel, CSV) or file output
- You have working Python code that needs to be executed
- The sandbox environment appears unstable
Step-by-Step Instructions
Step 1: Preserve the Failed Code
When execute_code_sandbox fails, capture the Python code that was attempted. If the code was generated but not saved, reconstruct it from the execution attempt.
Step 2: Write Code to File
Use write_file to save the Python script to a .py file:
write_file with:
- path: "script_name.py" (e.g., "generate_report.py", "process_data.py")
- content: <the full Python code>
Example:
# Content for write_file
import pandas as pd
from openpyxl import Workbook
# Your spreadsheet generation logic here
df = pd.DataFrame({'Revenue': [100, 200, 300]})
df.to_excel('output.xlsx', index=False)
Step 3: Execute via run_shell
Run the saved script using run_shell with Python 3:
run_shell with:
- command: "python3 script_name.py"
- timeout: 60 (or higher for complex operations)
Step 4: Verify Output
Check that the expected output files were created:
list_dir with:
- path: "."
Or read the generated file to confirm correctness:
read_file with:
- file_path: "output.xlsx"
- filetype: "xlsx"
Complete Example
Scenario: Generate an Excel P&L report after sandbox failure.
# Step 1: Write the Python script
write_file:
path: "generate_pnl_report.py"
content: |
import pandas as pd
from openpyxl import Workbook
# Create revenue data
data = {
'Tour Stop': ['London', 'Paris', 'Berlin'],
'Revenue': [50000, 45000, 38000],
'Withholding Tax': [5000, 4500, 3800],
'Expenses': [12000, 11000, 9500]
}
df = pd.DataFrame(data)
df['Net Income'] = df['Revenue'] - df['Withholding Tax'] - df['Expenses']
# Export to Excel
df.to_excel('pnl_report.xlsx', index=False)
print("Report generated successfully")
# Step 2: Execute the script
run_shell:
command: "python3 generate_pnl_report.py"
timeout: 60
# Step 3: Verify
list_dir:
path: "."
Best Practices
Use descriptive filenames - Name files after their purpose (e.g.,
generate_report.py,process_spreadsheet.py)Set appropriate timeouts - Complex operations may need 60+ seconds
Include error handling in your Python code - Add try/except blocks to capture and report issues:
try: # Your code here except Exception as e: print(f"Error: {e}") raiseClean up temporary files - After successful execution, you may remove the
.pyfile if not neededCheck dependencies - Ensure required packages (pandas, openpyxl, etc.) are available in the shell environment
Why This Works
run_shellexecutes in a more stable environment than the sandbox- File-based execution avoids sandbox memory/resource constraints
- The Python interpreter in the shell has full access to installed packages
- Output files are written directly to the workspace
अक्सर पूछे जाने वाले सवाल
अगर विफल कोड सहेजा ही न गया हो तो?
स्किल कहती है कि फ़ाइल लिखने से पहले प्रयास से कोड को फिर से तैयार करें।
समय सीमा कितनी होनी चाहिए?
स्किल के उदाहरण में 60 सेकंड है, और जटिल काम के लिए ज़्यादा मान सुझाया गया है।
क्या इससे नतीजा बदलता है?
स्किल का लक्ष्य फ़ाइल से वही कोड चलाकर वही नतीजे पाना है।
जानकारी
लेखक का मूल विवरण
Recover from execute_code_sandbox failures by writing code to file and executing via run_shell
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12987
- लाइसेंस
- 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 खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।