Zum Inhalt springen
Skillpedia
Allgemeines Programmieren7.8k · #12882

fallback-python-execution

Was er macht

Dieser Skill ist eine Ersatzmethode, Python auszuführen, wenn die Sandbox oder ein Helfer-Agent es nicht kann. Er richtet sich an Menschen, die Python zum Erstellen von Daten- oder Dokumentdateien brauchen.

Wann du ihn nutzt

  • ✓Wenn die Sandbox unbekannte Fehler liefert oder wiederholt scheitert.
  • ✓Wenn ich Python brauche, um Tabellen, Dokumente oder Datendateien zu erstellen.
  • ✓Wenn ein Helfer-Agent Python-Code nicht richtig ausführen konnte.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-python-execution/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Der Helfer kann mein Python-Skript für die Tabelle nicht ausführen. Bitte speichere das Skript in einer Datei und führe es direkt aus.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die KI schreibt den vollständigen Python-Code in eine .py-Datei, führt sie mit einem Shell-Befehl aus, prüft, dass die erwarteten Dateien entstehen, und löscht das Skript optional danach.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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
Häufige Fragen

Warum den Helfer-Agenten umgehen?

Die Anleitung sagt, dieser Weg vermeide zusätzliche Interpretationsschichten, die Fehler einführen können.

Kann das Skript danach gelöscht werden?

Ja. Das Entfernen des temporären Skripts ist ein optionaler letzter Schritt.

Was sollte am Ende geprüft werden?

Die Ausgabe auf Erfolg oder Fehler sowie ob die erwarteten Dateien erstellt wurden.

Details

Originalbeschreibung des Autors

Reliable Python execution workflow when execute_code_sandbox or shell_agent fail

repo: HKUDS/AgentPilot

Beliebtheit

GitHub-Sterne
7.8k
Platz im Ranking
#12882
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills