Skip to main content

Overview

One-shot execution is the simplest way to use buntime.sh. Perfect for quick calculations, data transformations, or testing code snippets without needing persistent state.

When to Use One-Shot Execution

Use one-shot execution when you need to:
  • ✅ Run quick calculations or algorithms
  • ✅ Test a code snippet
  • ✅ Process data without saving files
  • ✅ Verify API responses
  • ✅ Run independent tasks
Don’t use it when you need:
  • ❌ Files to persist between executions
  • ❌ Multiple related code executions
  • ❌ Long-running processes
  • ❌ Stateful operations

Quick Example

Simple Calculations

Mathematical Operations

Statistical Analysis

String Processing

Text Transformation

Regular Expressions

Array and Object Operations

Array Manipulation

Data Validation

Schema Validation with Zod

API Requests

Fetch External Data

POST Request

Date and Time Operations

Error Handling

Always check the exit code and stderr:

Using REST API Directly

For one-shot executions, you can use the REST API without an SDK:

Best Practices

For one-shot executions, use a short TTL (5-10 minutes) to automatically clean up sessions.
Delete sessions when done to free resources immediately.
Always verify the execution succeeded before using results.
Wrap risky operations in try-catch blocks in your code.

Common Use Cases

Data Transformation

Convert between formats (JSON, CSV, XML)

Quick Calculations

Mathematical operations and statistics

API Testing

Test external APIs and parse responses

String Processing

Text manipulation and regex operations

Next Steps

Multi-file Projects

Learn how to build complex applications

Execute API

View complete execution options

Sessions

Understand session lifecycle

AI Integration

Use buntime.sh with AI agents