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

fallback-python-execution

O que ela faz

Esta skill é um método de backup para rodar Python quando o sandbox ou um agente auxiliar não consegue fazê-lo. Ela é para quem precisa que o Python crie arquivos de dados ou de documentos.

Quando usar

  • ✓Quando o sandbox retorna erros desconhecidos ou falha repetidamente.
  • ✓Quando preciso que o Python crie planilhas, documentos ou arquivos de dados.
  • ✓Quando um agente auxiliar não conseguiu rodar o código Python corretamente.

Link da skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-python-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/fallback-python-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 auxiliar não consegue rodar meu script Python para criar a planilha. Salve o script em um arquivo e execute-o diretamente.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A IA escreve o código Python completo em um arquivo .py, roda-o com um comando de shell, confere se os arquivos esperados aparecem e, se quiser, apaga o script depois.

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

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

Fallback Python Execution Pattern

When to Use

Use this pattern when:

  • execute_code_sandbox returns unknown errors or fails repeatedly
  • shell_agent cannot successfully execute Python code
  • You need to create files (spreadsheets, documents, data files) via Python
  • Direct delegated approaches prove unreliable in the current environment

Core Technique

Instead of delegating Python execution to agents, use this two-step inline approach:

  1. Write Python code to a .py file using write_file
  2. Execute the file using run_shell with python <script.py>

Step-by-Step Instructions

Step 1: Write Python Code to File

Use write_file to create a Python script with all necessary code inline:

write_file
path: /path/to/script.py
content: |
    import pandas as pd
    # Your complete Python code here
    df = pd.DataFrame({...})
    df.to_excel('output.xlsx', index=False)

Step 2: Execute via run_shell

Run the script directly:

run_shell
command: python /path/to/script.py

Step 3: Verify and Clean Up

  • Check the output for success/errors
  • Verify the expected files were created
  • Optionally remove the temporary script if no longer needed

Why This Works

This approach is more reliable because:

  • Avoids agent interpretation layers that can introduce errors
  • Provides direct control over execution environment
  • Gives clear error output for debugging
  • Bypasses sandbox delegation issues

Example: Excel File Creation

# Step 1: Write the script
write_file:
  path: create_report.py
  content: |
    import pandas as pd
    from openpyxl import Workbook
    
    # Create data
    data = {'Column1': [1, 2, 3], 'Column2': ['A', 'B', 'C']}
    df = pd.DataFrame(data)
    
    # Save to Excel
    df.to_excel('report.xlsx', index=False)
    print('Excel file created successfully')

# Step 2: Execute
run_shell:
  command: python create_report.py

Tips

  • Include error handling in your Python code for better debugging
  • Use absolute paths when possible to avoid working directory issues
  • Add print statements to track execution progress
  • Keep scripts self-contained with all imports at the top
  • For complex tasks, break into multiple scripts if needed

Troubleshooting

Issue Solution
Module not found Add pip install commands before python command
Permission errors Check file paths are writable
Script not found Use absolute path or cd to directory first
Output not created Check for Python errors in run_shell output
Perguntas frequentes

Por que evitar o agente auxiliar?

O guia diz que essa abordagem evita camadas extras de interpretação que podem introduzir erros.

O script pode ser apagado depois?

Sim. Remover o script temporário é uma etapa final opcional.

O que deve ser verificado no fim?

A saída, para ver sucesso ou erros, e se os arquivos esperados foram criados.

Detalhes

Descrição original do autor

Reliable Python execution workflow when execute_code_sandbox or shell_agent fail

repo: HKUDS/AgentPilot

Popularidade

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

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas