code-exec-fallback
하는 일
이 스킬은 내장 실행기가 반복해서 실패할 때 Python 코드를 실행하는 대체 방법입니다. AI의 데이터나 계산 스크립트를 어떻게든 실행해야 하는 사람을 위한 것입니다.
사용하는 경우
- ✓한도, 시간 초과, 누락된 패키지 때문에 실행기가 두 번 이상 실패할 때.
- ✓정해진 시간 제한과 함께 데이터 스크립트를 셸에서 실행해야 할 때.
- ✓AI가 실행 결과를 읽고 오류를 보고하기를 원하는 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/code-exec-fallback/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“Python 실행기가 제 스프레드시트에서 계속 시간 초과됩니다. 스크립트를 파일로 저장하고 대신 실행해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 스크립트를 파일에 쓰고, python3로 셸에서 실행하며, 설정한 시간까지 기다리고, 출력을 읽습니다. 나중에 파일을 삭제할 수 있습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Code Execution Fallback
When to Use
Use this pattern when execute_code_sandbox fails repeatedly (typically 2+ attempts) due to environment limitations, timeouts, dependency issues, or sandbox restrictions.
The Pattern
Instead of executing code directly in the sandbox, write the Python script to a file and execute it via shell:
- Write the script using
write_file - Execute via shell using
run_shellwithpython3 script.py - Clean up (optional) remove the temporary file
Step-by-Step Instructions
Step 1: Write the Python Script
Use write_file to save your Python code:
- Path: Choose a descriptive name (e.g., "process_data.py", "analyze.py")
- Content: Your complete Python script with all imports and logic
Step 2: Execute via Shell
Use run_shell to execute:
- Command: "python3 <script_name>.py"
- Timeout: Set appropriately for your task (default 30s, increase if needed)
Step 3: Handle Output
- Capture stdout/stderr from run_shell
- Parse results as needed
- Optionally delete the script file after execution
Example
# Instead of this (which may fail):
execute_code_sandbox(code="import pandas as pd; df = pd.read_csv('data.csv')...")
# Do this:
write_file(path="analyze.py", content="""
import pandas as pd
import json
df = pd.read_csv('data.csv')
result = df.groupby('category').sum()
print(json.dumps(result.to_dict()))
""")
run_shell(command="python3 analyze.py", timeout=60)
Tips for Success
- Include all imports in the script file - the shell environment may differ from the sandbox
- Use absolute paths or ensure working directory is correct
- Add error handling to your script for better debugging
- Increase timeout for long-running operations (default is 30s)
- Print structured output (JSON) if you need to parse results
- Clean up temporary files after successful execution to avoid clutter
When This Helps
- Sandbox has missing dependencies
- Code execution times out in sandbox but would work in shell
- File I/O operations are restricted in sandbox
- Need to run external commands or system utilities
- Complex multi-file projects that need proper file structure
자주 묻는 질문
실행기 대신 파일을 쓰는 이유는 무엇인가요?
안내서는 이 경로가 일부 실패 상황에서 더 안정적이었다고 설명합니다.
기본 시간 제한은 얼마인가요?
기본값은 30초이며, 작업에 더 많은 시간이 필요하면 늘릴 수 있습니다.
스크립트에 특별한 설정이 필요한가요?
스크립트는 모든 import와 로직을 포함해서 스스로 실행되어야 합니다.
상세 정보
작성자의 원본 설명
Fallback pattern for executing Python code when execute_code_sandbox fails
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12845
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.