Pular para o conteúdo
Skillpedia
Código em geral7,8 mil · #12990

sandbox-fallback-execution

O que ela faz

Esta skill mostra ao agente de IA uma alternativa simples para código Python quando o sandbox falha ou estoura o tempo limite. É para pessoas que precisam concluir um trabalho curto de Python sem usar o sandbox.

Quando usar

  • ✓Quando o sandbox de código falha com erros desconhecidos ou tempos limite.
  • ✓Quando o sandbox já falhou mais de duas vezes no mesmo trabalho.
  • ✓Quando um pacote Python precisa ser instalado antes de o código poder rodar.

Link da skill

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

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-fallback-execution/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“O sandbox deu um erro desconhecido no meu script. Instale o pandas se for preciso e execute o código pelo shell.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

O agente instala os pacotes necessários com pip e depois executa o código Python pelo shell usando um heredoc. Confere a saída em busca de mensagens de sucesso ou erros antes de seguir adiante.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

Sandbox Fallback Execution

When to Use This Skill

Use this pattern when execute_code_sandbox fails with unknown errors, timeouts, or persistent execution failures. This fallback bypasses sandbox restrictions by using run_shell with a Python heredoc script.

Pattern Overview

execute_code_sandbox fails → run_shell with pip install → Python heredoc execution

Step-by-Step Instructions

Step 1: Detect Sandbox Failure

Monitor for these failure indicators from execute_code_sandbox:

  • Unknown or unexplained errors
  • Repeated execution failures (>2 attempts)
  • Timeout errors
  • Environment/package availability issues

Step 2: Install Required Dependencies (If Needed)

Use run_shell to install any required Python packages:

pip install <package_name>

For multiple packages:

pip install package1 package2 package3

Step 3: Execute Python via Heredoc

Run Python code using a heredoc script with run_shell:

python3 << 'EOF'
# Your Python code here
import sys
print("Hello from fallback execution")
EOF

Key heredoc syntax notes:

  • Use << 'EOF' (quoted) to prevent shell variable expansion
  • Use << EOF (unquoted) if you need shell variable interpolation
  • Close with EOF on its own line

Step 4: Verify and Iterate

  • Check stdout/stderr for success indicators
  • If errors persist, inspect output and adjust the script
  • Capture any generated artifacts (files, outputs) for verification

Complete Example

Scenario: Need to create a Word document but execute_code_sandbox keeps failing.

# Step 1: Install required package
pip install python-docx

# Step 2: Execute Python script via heredoc
python3 << 'EOF'
from docx import Document

doc = Document()
doc.add_heading('Proposal Document', 0)
doc.add_paragraph('This is the proposal content.')
doc.save('proposal.docx')
print("Document created successfully")
EOF

Best Practices

  1. Quote the heredoc delimiter ('EOF') to avoid unintended shell expansion of Python code
  2. Install packages first before running the script to ensure availability
  3. Print status messages in your script for easier debugging
  4. Save outputs to files when possible for verification
  5. Keep scripts focused - break complex tasks into multiple heredoc executions if needed

Troubleshooting

Issue Solution
pip not found Try pip3 or python3 -m pip install
Script hangs Add timeout to run_shell command
Permission errors Check file paths are writable
Import errors Verify package was installed successfully

Related Tools

  • run_shell: Execute shell commands directly
  • execute_code_sandbox: Primary Python execution tool (try first)
  • shell_agent: For more complex multi-step shell tasks
Perguntas frequentes

Qual a diferença entre EOF com aspas e EOF sem aspas?

Um marcador de fim entre aspas impede o shell de substituir variáveis, enquanto um marcador sem aspas permite que o shell as preencha.

O agente instala pacotes?

Sim. Se o código precisar de um pacote, a skill diz para instalá-lo com pip antes.

E se os erros continuarem?

A skill diz para ler a saída, ajustar o código e executá-lo de novo.

Detalhes

Descrição original do autor

Fallback workflow for executing Python code when execute_code_sandbox fails

repo: HKUDS/AgentPilot

Popularidade

Estrelas no GitHub
7,8 mil
Posição no ranking
#12990
Licença
MIT
Atualizada em
01/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas