AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Code Exec Fallback 266cba

skill-hkuds-openspace-code-exec-fallback-266cba · by HKUDS

Fallback workflow for reliable code execution when sandbox fails repeatedly

No reviews yet
0 installs
40 views
0.0% view→install

Install

$ agentstack add skill-hkuds-openspace-code-exec-fallback-266cba

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No 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.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-hkuds-openspace-code-exec-fallback-266cba)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

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 →
Are you the author of Code Exec Fallback 266cba? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Code Execution Fallback Pattern

When to Use This Skill

Apply this pattern when you encounter repeated failures with execute_code_sandbox:

  • 2+ consecutive failures with opaque or unknown errors
  • Timeout errors that persist across retry attempts
  • Environment-related errors that don't resolve with code fixes

The Fallback Workflow

Step 1: Detect Repeated Failures

Track execution failures. After 2 consecutive failures with execute_code_sandbox, switch to the fallback approach.

Step 2: Write Script to File

Use write_file to save your Python script:

write_file(
    path="/workspace/script_name.py",
    content="# Your Python code here\nimport sys\n..."
)

Step 3: Execute via Shell

Use run_shell to run the script:

run_shell(
    command="python /workspace/script_name.py",
    timeout=300
)

Step 4: Capture Output

Parse stdout/stderr from run_shell output to verify success or diagnose issues.

Complete Example

# Instead of this (which may fail):
result = execute_code_sandbox(code="import pandas as pd\n...")

# Use this fallback pattern:
script_content = """
import pandas as pd
import sys

try:
    # Your logic here
    df = pd.DataFrame({'col': [1, 2, 3]})
    print(df.to_csv())
    sys.exit(0)
except Exception as e:
    print(f"ERROR: {e}", file=sys.stderr)
    sys.exit(1)
"""

# Write the script
write_file(path="/workspace/my_script.py", content=script_content)

# Execute via shell
result = run_shell(command="python /workspace/my_script.py", timeout=300)

Best Practices

  1. Add error handling in your script - use try/except with sys.exit() codes
  2. Set appropriate timeouts - run_shell default is 30s, increase for heavy operations
  3. Clean up temporary files after execution if needed
  4. Log the fallback trigger - document why you switched approaches
  5. Verify Python availability - Most sandboxes have Python 3.x by default

Why This Works

  • write_file is more reliable for file I/O operations
  • run_shell gives you direct control over execution environment
  • Shell execution bypasses sandbox serialization issues
  • Better error visibility through stdout/stderr streams

When NOT to Use This Pattern

  • First-time execution failures (retry the sandbox first)
  • Simple one-liner code (sandbox is faster)
  • When sandbox errors are clearly code bugs (fix the code instead)
  • Security-sensitive operations requiring sandbox isolation

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.