मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग7.8k · #12986

sandbox-execution-fallback

यह क्या करती है

यह स्किल AI एजेंट को विफल कोड रन को .py फ़ाइल में सहेजकर शेल में चलाने से रिकवर करना दिखाती है। यह उन लोगों के लिए है जिनके स्प्रेडशीट या डेटा काम सैंडबॉक्स में टाइम आउट हो जाते हैं।

कब इस्तेमाल करें

  • ✓जब स्प्रेडशीट या डेटा काम पर कोड सैंडबॉक्स टाइम आउट हो।
  • ✓जब काम को pandas या openpyxl जैसी बाहरी लाइब्रेरी चाहिए।
  • ✓जब लंबी गणना बार-बार सैंडबॉक्स की समय सीमा से टकराए।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरा pandas काम सैंडबॉक्स में टाइम आउट हो रहा है। कोड को फ़ाइल में सहेजिए और लंबी सीमा के साथ शेल में चलाइए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट विफल हुए कोड को एक साफ़ नाम वाली .py फ़ाइल में लिखता है, उसे सिस्टम के Python से चलाता है, और जाँचता है कि अपेक्षित फ़ाइलें और नतीजे मौजूद हैं।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Sandbox Execution Fallback

When to Use

Apply this pattern when execute_code_sandbox fails or times out, particularly for:

  • Spreadsheet generation (pandas, openpyxl, xlsxwriter)
  • Complex data processing with file I/O
  • Tasks requiring external library imports
  • Long-running computations that hit timeout limits

Recovery Procedure

Step 1: Capture the Python Code

Extract or reconstruct the Python code that failed in execute_code_sandbox.

Step 2: Write Code to File

Use write_file to save the script with a .py extension:

write_file(
    path="script_name.py",
    content="""
import pandas as pd
# Your implementation here
"""
)

Step 3: Execute via run_shell

Run the script using the system Python interpreter:

run_shell(command="python3 script_name.py")

Step 4: Verify Output

Confirm the results match expected outputs (files created, data processed correctly, etc.).

Complete Example

# Failed: execute_code_sandbox with pandas Excel generation

# Recovery - Step 1 & 2: Write script to file
write_file(
    path="generate_pnl_report.py",
    content="""
import pandas as pd
from openpyxl import Workbook

# Create sample data
data = {
    'Category': ['Revenue', 'Expenses', 'Tax'],
    'Amount': [10000, 3000, 500]
}
df = pd.DataFrame(data)

# Write to Excel
df.to_excel('pnl_report.xlsx', index=False)
print('Report generated: pnl_report.xlsx')
"""
)

# Step 3: Execute via shell
run_shell(command="python3 generate_pnl_report.py")

# Step 4: Verify file was created
run_shell(command="ls -la pnl_report.xlsx")

Why This Works

Aspect execute_code_sandbox run_shell + write_file
Environment Sandboxed, limited Full system Python
File I/O Restricted Full access
Timeout Strict limits More flexible
Library Support May be limited System-installed packages
Result Identical output Identical output

Best Practices

  1. Use descriptive filenames - e.g., generate_report.py, process_data.py
  2. Add error handling - Include try/except blocks in your script
  3. Print progress - Use print statements for debugging
  4. Clean up - Remove temporary scripts after successful execution if needed
  5. Verify results - Always confirm outputs before proceeding

Common Use Cases

  • Excel/CSV report generation
  • Data transformation pipelines
  • Batch file processing
  • API data aggregation
  • Chart and visualization creation

Troubleshooting

If run_shell also fails:

  1. Check Python is available: run_shell(command="python3 --version")
  2. Install missing packages: run_shell(command="pip3 install pandas openpyxl")
  3. Check file permissions and paths
  4. Review stderr output for specific errors
अक्सर पूछे जाने वाले सवाल

अगर कोड खो गया हो तो क्या एजेंट उसे वापस बना सकता है?

स्किल कहती है कि अगर कोड सहेजा न गया हो, तो विफल प्रयास से उसे फिर से बनाएँ।

किस Python कमांड का इस्तेमाल होता है?

स्किल शेल से स्क्रिप्ट python3 के साथ चलाती है।

एजेंट सफलता कैसे जाँचता है?

वह पक्का करता है कि फ़ाइलें बनीं और डेटा अपेक्षित रूप से प्रोसेस हुआ।

जानकारी

लेखक का मूल विवरण

Recover from execute_code_sandbox failures by writing Python scripts to files and executing via run_shell

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#12986
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills