Skip to main content

Quickstart

This guide will walk you through executing your first code snippet with Runtime. You’ll learn how to make API requests and interpret the results.

Prerequisites

Before you begin, ensure you have:
1

Runtime server running

The Runtime API server should be running on http://localhost:8081. See the Setup Guide for installation instructions.Verify the server is running:
curl http://localhost:8081/api/execute
2

HTTP client

You can use any HTTP client like cURL, Postman, or your favorite programming language’s HTTP library.

Execute Your First Code

Let’s execute a simple “Hello, World!” program in Python.

Using cURL

curl -X POST http://localhost:8081/api/execute \
  -H "Content-Type: application/json" \
  -d '{
    "code": "print(\"Hello, World!\")",
    "language": "python"
  }'

Response

You’ll receive a JSON response with the execution results:
{
  "success": true,
  "message": "Code Executed successfully",
  "data": {
    "output": "Hello, World!\n",
    "exitCode": 0,
    "executionTime": 1247
  }
}
The executionTime is measured in milliseconds and includes container startup, code execution, and cleanup time.

Try Different Languages

Runtime supports multiple programming languages. Here are examples for each:
{
  "code": "for i in range(5):\n    print(f'Number: {i}')",
  "language": "python"
}

Understanding the Response

The API returns an ApiResponse wrapper containing the execution results:
FieldTypeDescription
successbooleanWhether the request was successful
messagestringHuman-readable status message
dataobjectThe execution result (if successful)
data.outputstringCombined stdout and stderr output
data.exitCodeintProcess exit code (0 = success)
data.executionTimelongExecution time in milliseconds

Error Handling

If the code fails to execute, you’ll receive an error response:
{
  "success": true,
  "message": "Code Executed successfully",
  "data": {
    "output": "  File \"main.py\", line 1\n    print('Hello\nSyntaxError: unterminated string literal",
    "exitCode": 0,
    "executionTime": 892
  }
}
Note that compilation and runtime errors are captured in the output field. The execution itself succeeds even if your code has errors.

Unsupported Language

{
  "success": false,
  "message": "Unsupported language: ruby",
  "data": null
}

Next Steps

Now that you’ve executed your first code snippet, explore more:

Supported Languages

Learn about all supported languages and their configurations

API Reference

Explore the complete API documentation

Architecture

Understand how Docker isolation works

Deployment

Deploy Runtime to production

Build docs developers (and LLMs) love