fallback-python-execution
यह क्या करती है
यह स्किल Python चलाने का बैकअप तरीका है, जब सैंडबॉक्स या सहायक उसे न चला पाए। यह उन लोगों के लिए है जिन्हें डेटा या दस्तावेज़ फ़ाइलें बनाने के लिए Python चाहिए।
कब इस्तेमाल करें
- ✓जब सैंडबॉक्स अज्ञात एरर दे या बार-बार विफल हो।
- ✓जब मुझे स्प्रेडशीट, दस्तावेज़ या डेटा फ़ाइलें बनाने के लिए Python चाहिए।
- ✓जब एक सहायक एजेंट Python कोड सही तरीके से चलाने में असमर्थ रहा हो।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-python-execution/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“सहायक मेरी स्प्रेडशीट बनाने वाली Python स्क्रिप्ट नहीं चला पा रहा। कृपया स्क्रिप्ट को फ़ाइल में सहेजिए और सीधे चलाइए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI पूरा Python कोड .py फ़ाइल में लिखता है, शेल कमांड से चलाता है, जाँचता है कि अपेक्षित फ़ाइलें बनी हैं, और चाहे तो बाद में स्क्रिप्ट हटा देता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Fallback Python Execution Pattern
When to Use
Use this pattern when:
execute_code_sandboxreturns unknown errors or fails repeatedlyshell_agentcannot successfully execute Python code- You need to create files (spreadsheets, documents, data files) via Python
- Direct delegated approaches prove unreliable in the current environment
Core Technique
Instead of delegating Python execution to agents, use this two-step inline approach:
- Write Python code to a
.pyfile usingwrite_file - Execute the file using
run_shellwithpython <script.py>
Step-by-Step Instructions
Step 1: Write Python Code to File
Use write_file to create a Python script with all necessary code inline:
write_file
path: /path/to/script.py
content: |
import pandas as pd
# Your complete Python code here
df = pd.DataFrame({...})
df.to_excel('output.xlsx', index=False)
Step 2: Execute via run_shell
Run the script directly:
run_shell
command: python /path/to/script.py
Step 3: Verify and Clean Up
- Check the output for success/errors
- Verify the expected files were created
- Optionally remove the temporary script if no longer needed
Why This Works
This approach is more reliable because:
- Avoids agent interpretation layers that can introduce errors
- Provides direct control over execution environment
- Gives clear error output for debugging
- Bypasses sandbox delegation issues
Example: Excel File Creation
# Step 1: Write the script
write_file:
path: create_report.py
content: |
import pandas as pd
from openpyxl import Workbook
# Create data
data = {'Column1': [1, 2, 3], 'Column2': ['A', 'B', 'C']}
df = pd.DataFrame(data)
# Save to Excel
df.to_excel('report.xlsx', index=False)
print('Excel file created successfully')
# Step 2: Execute
run_shell:
command: python create_report.py
Tips
- Include error handling in your Python code for better debugging
- Use absolute paths when possible to avoid working directory issues
- Add print statements to track execution progress
- Keep scripts self-contained with all imports at the top
- For complex tasks, break into multiple scripts if needed
Troubleshooting
| Issue | Solution |
|---|---|
| Module not found | Add pip install commands before python command |
| Permission errors | Check file paths are writable |
| Script not found | Use absolute path or cd to directory first |
| Output not created | Check for Python errors in run_shell output |
अक्सर पूछे जाने वाले सवाल
सहायक एजेंट से क्यों बचें?
गाइड कहती है कि यह तरीका अतिरिक्त व्याख्या की परतों से बचता है, जो एरर ला सकती हैं।
क्या स्क्रिप्ट बाद में हटाई जा सकती है?
हाँ, अस्थायी स्क्रिप्ट हटाना एक वैकल्पिक अंतिम चरण है।
अंत में क्या जाँचें?
सफलता या एरर के लिए आउटपुट, और यह कि अपेक्षित फ़ाइलें बनीं या नहीं।
जानकारी
लेखक का मूल विवरण
Reliable Python execution workflow when execute_code_sandbox or shell_agent fail
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12882
- लाइसेंस
- 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 खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।