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

fallback-code-execution

하는 일

이 스킬은 샌드박스가 알 수 없거나 불안정한 오류를 계속 낼 때 Python 코드를 실행하는 우회 방법입니다. 결과가 필요한 코드를 AI가 실행하는 사람에게 맞습니다.

사용하는 경우

  • ✓같은 코드로 샌드박스가 두 번 이상 연속 실패했을 때.
  • ✓오류가 일반적이어서 코드 실수보다 환경 문제를 가리키는 경우.
  • ✓스크립트를 검사하고 다시 실행할 수 있도록 파일로 보관하고 싶을 때.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-code-execution/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/fallback-code-execution/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분.

작동 방식

AI는 작업 공간에 설명이 담긴 이름으로 스크립트를 쓰고, 먼저 의존성을 설치한 뒤, 셸에서 실행하며 출력을 기록합니다.

기술 내용 (원본 SKILL.md)

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

Fallback Code Execution Workflow

Overview

This skill defines a robust workaround for executing code (specifically Python) when the primary execute_code_sandbox tool fails repeatedly with unknown or transient errors. Instead of continuing to retry the failing tool, the agent switches to a manual file-write and shell-execution pattern.

Trigger Conditions

Activate this workflow when:

  1. execute_code_sandbox fails 2 or more times consecutively for the same logic.
  2. Error messages are generic, unknown, or indicate environment issues rather than syntax errors.
  3. The code logic itself is verified correct but the execution environment is unstable.

Procedure

Step 1: Write Script to File

Use the write_file tool to save the Python script to a specific path in the workspace.

  • Path: Choose a descriptive name ending in .py (e.g., scripts/generate_report.py).
  • Content: Ensure the script includes necessary error handling and print statements for debugging.
  • Dependencies: If the script requires external libraries, ensure a requirements.txt is updated or installed via shell beforehand.

Example:

tool: write_file
path: workspace/scripts/process_data.py
content: |
  import sys
  # ... script logic ...
  print("Success")

Step 2: Execute via Shell

Use the run_shell tool to execute the script using the system Python interpreter.

  • Command: python3 <path_to_script> or python <path_to_script>.
  • Working Directory: Ensure the shell command runs from the workspace root or the directory containing the script.
  • Capture Output: Store stdout and stderr for verification.

Example:

tool: run_shell
command: python3 scripts/process_data.py

Step 3: Verify Execution

  1. Check Exit Code: Ensure the shell command returned exit code 0.
  2. Check Output: Verify expected files were created or expected stdout messages appeared.
  3. Handle Errors: If the shell execution fails, inspect the stderr output. This often provides more detailed tracebacks than the sandbox tool.

Best Practices

  • Absolute Paths: When writing scripts that access files, use absolute paths or resolve paths relative to __file__ to avoid working directory issues.
  • Permissions: Ensure the workspace directory allows file creation and execution.
  • Cleanup: Optionally remove temporary scripts after successful execution if cleanliness is required.
  • Logging: Add explicit print() statements in the Python script to log progress, as shell output capture is sometimes more reliable than sandbox return values.

Example Scenario

Problem: execute_code_sandbox times out while generating a PDF. Solution:

  1. Write generate_pdf.py to workspace/scripts/.
  2. Run python3 workspace/scripts/generate_pdf.py via run_shell.
  3. Confirm output.pdf exists in the workspace.
자주 묻는 질문

스크립트를 파일로 보관하는 이유는 무엇인가요?

저장된 파일은 검사하고 바꿔서 다시 실행할 수 있으므로 코드를 매번 다시 쓸 필요가 없습니다.

스크립트는 어디에 저장되나요?

작업 공간에 설명이 담긴 이름으로, .py로 끝나게 저장됩니다.

패키지가 필요하면 어떻게 하나요?

가이드는 requirements 파일이나 셸을 통해 미리 설치하라고 안내합니다.

상세 정보

작성자의 원본 설명

Fallback workflow for running code via file write and shell when sandbox execution fails

repo: HKUDS/AgentPilot

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬