본문으로 건너뛰기
Skillpedia
일반 코딩7.8k · #12986

sandbox-execution-fallback

하는 일

이 스킬은 실패한 코드 실행을 .py 파일로 저장하고 셸에서 실행해 복구하는 방법을 AI 에이전트에게 보여 줍니다. 스프레드시트나 데이터 작업이 샌드박스에서 시간 초과되는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓코드 샌드박스가 스프레드시트나 데이터 작업에서 시간 초과될 때.
  • ✓pandas나 openpyxl 같은 외부 라이브러리가 필요한 작업일 때.
  • ✓오래 걸리는 계산이 샌드박스의 시간 제한에 계속 걸릴 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-execution-fallback/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“pandas 작업이 샌드박스에서 시간 초과됩니다. 코드를 파일로 저장하고 더 긴 제한 시간으로 셸에서 실행해 주세요.”

매주 새 스킬 5개. 읽는 데 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
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬