fallback-python-execution
하는 일
이 스킬은 샌드박스나 도우미 에이전트가 Python을 실행하지 못할 때 쓰는 예비 방법입니다. 데이터나 문서 파일을 만들기 위해 Python이 필요한 사람에게 맞습니다.
사용하는 경우
- ✓샌드박스가 알 수 없는 오류를 내거나 계속 실패할 때.
- ✓스프레드시트, 문서 또는 데이터 파일을 Python으로 만들어야 할 때.
- ✓도우미 에이전트가 Python 코드를 올바르게 실행하지 못한 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-python-execution/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“도우미가 스프레드시트를 만드는 Python 스크립트를 실행하지 못합니다. 스크립트를 파일로 저장해서 직접 실행해 주세요.”
매주 새 스킬 5개. 읽는 데 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
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.