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

sandbox-execution-fallback-717e65

하는 일

이 스킬은 계속 실패하는 코드 샌드박스에서 AI 에이전트가 벗어나, 셸에서 저장된 스크립트 파일을 실행하도록 돕습니다. 샌드박스가 불안정하거나 시간 초과가 나는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓두세 번 재시도한 뒤에도 코드 샌드박스가 다시 실패할 때.
  • ✓오류가 코드 실수가 아니라 서비스 문제를 가리킬 때.
  • ✓파일 읽기와 쓰기가 들어간 복잡한 코드에 더 명확한 오류 메시지가 필요할 때.

스킬 링크

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

AI에게 요청하는 예시

“코드 샌드박스에서 데이터 작업이 계속 시간 초과됩니다. 스크립트로 만들어 셸에서 실행해서 오류를 볼 수 있게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 Python 코드를 파일에 씁니다. 필요하면 큰 작업을 여러 파일로 나눕니다. 셸로 스크립트를 실행한 뒤 출력과 오류를 읽고 다음 단계를 정합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Sandbox Execution Fallback

When to Use

Apply this pattern when execute_code_sandbox fails repeatedly or exhibits instability. Common triggers include:

  • Sandbox returns errors after 2-3 retry attempts
  • Error messages indicate provider/system issues rather than code bugs
  • Execution times out or hangs inconsistently
  • Complex multi-step code with file I/O is needed
  • Better error visibility and debugging is required

Procedure

Step 1: Detect When to Switch

Recognize the failure pattern:

  • execute_code_sandbox produces repeated errors despite code corrections
  • Error output suggests infrastructure issues (not syntax/logic errors)
  • The sandbox environment appears unstable or limited

Step 2: Write Python Script to File

Use write_file to save your script:

write_file(
    path="script.py",
    content="#!/usr/bin/env python3

# Your Python code here
import sys
print('Executing via file-based approach')
# ... rest of your code
"
)

For multi-file projects, write each file separately:

write_file(path="utils.py", content="# Utility functions\ndef helper(): ...")
write_file(path="main.py", content="from utils import helper\nhelper()")

Step 3: Execute via Shell

Run the script using run_shell:

run_shell(command="python3 script.py")

For scripts in subdirectories:

run_shell(command="cd mydir && python3 script.py")

Step 4: Handle Output and Clean Up

  • Parse stdout/stderr from run_shell output
  • Inspect created files directly using read_file if needed
  • Remove temporary scripts after successful execution:
    run_shell(command="rm script.py")
    

Advantages Over Sandbox Execution

Benefit Explanation
Bypasses provider limitations No sandbox resource constraints
Better error visibility Full stack traces and system errors
Environment control Direct access to system Python and packages
Multi-file support Easy imports and module structure
Persistence Files remain for inspection and debugging
Reliability More consistent execution behavior

Complete Example

# Scenario: execute_code_sandbox failing on data processing task

# Step 1: Write the script
write_file(
    path="process_data.py",
    content="#!/usr/bin/env python3
import json
import csv

# Load and process data
with open('input.json', 'r') as f:
    data = json.load(f)

# Transform data
results = []
for item in data:
    results.append({'processed': item['value'] * 2})

# Write output
with open('output.csv', 'w', newline='') as f:
    writer = csv.DictWriter(f, fieldnames=['processed'])
    writer.writeheader()
    writer.writerows(results)

print('Processing complete')
"
)

# Step 2: Execute via shell
run_shell(command="python3 process_data.py")

# Step 3: Read results
read_file(filetype="csv", file_path="output.csv")

# Step 4: Clean up (optional)
run_shell(command="rm process_data.py")

Best Practices

  1. Use absolute or clear relative paths - Avoid ambiguity in file locations
  2. Add error handling in scripts - Catch exceptions and print meaningful messages
  3. Validate script content before writing - Ensure proper Python syntax
  4. Log execution steps - Track what was written and executed for debugging
  5. Clean up temporary files - Remove scripts after use unless needed for later inspection

Troubleshooting

Issue Solution
python3 not found Try python or specify full path /usr/bin/python3
Import errors Use run_shell(command="pip3 install package") first
Permission denied Add execute permission: run_shell(command="chmod +x script.py")
Working directory issues Use absolute paths or cd in the command
자주 묻는 질문

샌드박스가 문제라는 것을 어떻게 알 수 있나요?

스킬은 코드 실수가 아니라 반복 실패나 시간 초과처럼 인프라 문제를 암시하는 오류가 보이면 전환하라고 안내합니다.

작업을 여러 파일로 나눌 수 있나요?

네, 스킬은 각 파일을 따로 쓰고, 다른 파일을 가져오는 주 파일을 실행하라고 안내합니다.

하위 폴더의 스크립트도 실행할 수 있나요?

네, 스킬은 하위 폴더로 이동한 다음 스크립트를 실행하는 방법을 보여 줍니다.

상세 정보

작성자의 원본 설명

Fallback from execute_code_sandbox to file-based run_shell execution when sandbox fails

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12985
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬