fallback-script-execution
하는 일
이 스킬은 Python 스크립트를 두 단계로 실행해 더 분명한 오류 메시지를 얻는 반복 가능한 방법입니다. 평소 도구로 실행되지 않는 코드를 디버깅하는 사람에게 맞습니다.
사용하는 경우
- ✓도우미 에이전트가 코드를 실행하다가 불분명한 메시지로 반복 실패할 때.
- ✓샌드박스가 같은 코드에서 시간 초과되거나 오류를 낼 때.
- ✓스크립트를 매번 다시 쓰지 않고 고쳐서 다시 실행하고 싶은 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-script-execution/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“도우미가 제 스크립트를 실행하다 계속 실패합니다. 스크립트를 파일로 저장하고 실행해서 전체 오류를 볼 수 있게 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 오류 처리가 포함된 독립적인 스크립트를 파일로 쓰고, 셸 명령으로 실행해 전체 스택 추적과 출력이 보이게 합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Fallback Script Execution with write_file + run_shell
When to Use This Skill
Use this pattern when:
shell_agentfails repeatedly with unclear error messagesexecute_code_sandboxconsistently errors or times out- You need better visibility into what's happening during execution
- Debugging inline code or delegated agents proves difficult
Core Pattern
Instead of delegating execution to an agent or running inline code, use this two-step approach:
- Write script to file using
write_file - Execute script using
run_shellwithpython script.py
This provides:
- Clearer error messages (full stack traces visible in run_shell output)
- Easier debugging (script persists for inspection)
- Better control over execution environment
- Ability to modify and re-run without rewriting code
Step-by-Step Instructions
Step 1: Write the Script File
Use write_file to create a self-contained Python script:
write_file with:
path: "path/to/script_name.py"
content: |
#!/usr/bin/env python3
# Your complete script here
# Include imports, logic, and error handling
Best Practices:
- Include descriptive comments
- Add try/except blocks for error handling
- Print intermediate results for debugging
- Use absolute or clear relative paths
Step 2: Execute the Script
Use run_shell to execute the script:
run_shell with:
command: "python path/to/script_name.py"
Best Practices:
- Capture and examine full output
- If errors occur, the script file is still available for inspection
- You can re-run with modifications without starting over
Example: Data Processing Task
❌ Problematic Approach (shell_agent fails repeatedly)
shell_agent with:
task: "Load Excel file, calculate correlations, save results"
Result: Agent struggles with path handling, unclear errors
✅ Recommended Approach (write_file + run_shell)
# Step 1: Write script
write_file with:
path: "correlation_analysis.py"
content: |
import pandas as pd
import sys
try:
# Load data
df = pd.read_excel('data.xlsx', sheet_name='Returns')
print(f"Loaded {len(df)} rows")
# Calculate correlation
corr = df.corr()
print(f"Correlation matrix shape: {corr.shape}")
# Save results
with pd.ExcelWriter('output.xlsx') as writer:
df.to_excel(writer, sheet_name='Returns')
corr.to_excel(writer, sheet_name='Correlation')
print("SUCCESS: output.xlsx created")
except Exception as e:
print(f"ERROR: {type(e).__name__}: {e}", file=sys.stderr)
sys.exit(1)
# Step 2: Execute script
run_shell with:
command: "python correlation_analysis.py"
Debugging Tips
- Add print statements at key points to trace execution
- Check file paths - use
run_shellwithls -la path/to verify files exist - Inspect errors - run_shell output shows full Python stack traces
- Modify and re-run - edit the script file and execute again without rewriting
When to Escalate
If this pattern also fails:
- Verify Python is available:
run_shellwithwhich pythonorpython --version - Check file permissions:
run_shellwithls -la script.py - Try explicit Python path:
run_shellwith/usr/bin/python script.py - Consider task complexity - may need to break into smaller scripts
자주 묻는 질문
디버깅에 파일이 왜 더 좋은가요?
스크립트가 디스크에 남아 있어서 변경 후에도 검사하고 다시 실행할 수 있습니다.
오류 출력을 더 분명하게 만드는 것은 무엇인가요?
전체 스택 추적이 숨겨지지 않고 셸 출력에 나타납니다.
스크립트에는 무엇이 들어 있어야 하나요?
import 문, 주요 로직, try와 except 블록, 진행 상황을 알리는 출력 메시지가 필요합니다.
상세 정보
작성자의 원본 설명
Two-step script execution workflow for debugging when shell_agent and execute_code_sandbox consistently fail
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12884
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.