Install
$ agentstack add skill-hkuds-openspace-fallback-script-execution ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Fallback Script Execution with writefile + runshell
When to Use This Skill
Use this pattern when:
shell_agentfails repeatedly with unclear error messagesexecute_code_sandboxconsistently errors or times out- You need better visibility into what's happening during execution
- Debugging inline code or delegated agents proves difficult
Core Pattern
Instead of delegating execution to an agent or running inline code, use this two-step approach:
- Write script to file using
write_file - Execute script using
run_shellwithpython script.py
This provides:
- Clearer error messages (full stack traces visible in run_shell output)
- Easier debugging (script persists for inspection)
- Better control over execution environment
- Ability to modify and re-run without rewriting code
Step-by-Step Instructions
Step 1: Write the Script File
Use write_file to create a self-contained Python script:
write_file with:
path: "path/to/script_name.py"
content: |
#!/usr/bin/env python3
# Your complete script here
# Include imports, logic, and error handling
Best Practices:
- Include descriptive comments
- Add try/except blocks for error handling
- Print intermediate results for debugging
- Use absolute or clear relative paths
Step 2: Execute the Script
Use run_shell to execute the script:
run_shell with:
command: "python path/to/script_name.py"
Best Practices:
- Capture and examine full output
- If errors occur, the script file is still available for inspection
- You can re-run with modifications without starting over
Example: Data Processing Task
❌ Problematic Approach (shell_agent fails repeatedly)
shell_agent with:
task: "Load Excel file, calculate correlations, save results"
Result: Agent struggles with path handling, unclear errors
✅ Recommended Approach (writefile + runshell)
# Step 1: Write script
write_file with:
path: "correlation_analysis.py"
content: |
import pandas as pd
import sys
try:
# Load data
df = pd.read_excel('data.xlsx', sheet_name='Returns')
print(f"Loaded {len(df)} rows")
# Calculate correlation
corr = df.corr()
print(f"Correlation matrix shape: {corr.shape}")
# Save results
with pd.ExcelWriter('output.xlsx') as writer:
df.to_excel(writer, sheet_name='Returns')
corr.to_excel(writer, sheet_name='Correlation')
print("SUCCESS: output.xlsx created")
except Exception as e:
print(f"ERROR: {type(e).__name__}: {e}", file=sys.stderr)
sys.exit(1)
# Step 2: Execute script
run_shell with:
command: "python correlation_analysis.py"
Debugging Tips
- Add print statements at key points to trace execution
- Check file paths - use
run_shellwithls -la path/to verify files exist - Inspect errors - run_shell output shows full Python stack traces
- Modify and re-run - edit the script file and execute again without rewriting
When to Escalate
If this pattern also fails:
- Verify Python is available:
run_shellwithwhich pythonorpython --version - Check file permissions:
run_shellwithls -la script.py - Try explicit Python path:
run_shellwith/usr/bin/python script.py - Consider task complexity - may need to break into smaller scripts
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: HKUDS
- Source: HKUDS/OpenSpace
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.