2026-06-28 20:16:52 -07:00
<p align="center"><img src=".github/hero.svg" alt="runtime" width="880"></p>
2024-03-07 19:22:31 +01:00
<div align="center">
2025-07-14 20:18:42 -05:00
[](https://github.com/hanzoai/runtime)
2025-04-28 21:02:24 +02:00

2025-07-14 20:18:42 -05:00
[](https://goreportcard.com/report/github.com/hanzoai/runtime)
[](https://github.com/hanzoai/runtime/issues)

2024-04-05 11:43:15 +02:00
2024-02-10 18:46:28 +01:00
</div>
2024-02-06 09:22:15 +01:00
2025-01-17 15:37:41 +01:00
2024-02-10 18:46:28 +01:00
<div align="center">
2025-07-14 20:18:42 -05:00
<h1>Hanzo Runtime</h1>
2025-01-17 15:37:41 +01:00
</div>
<h3 align="center">
2025-07-14 20:18:42 -05:00
AI Generated Code Execution Runtime
2025-04-28 21:02:24 +02:00
<br/>
2025-07-14 20:18:42 -05:00
Secure, Fast, and Scalable Infrastructure for
AI-Generated Code Execution.
2025-01-17 15:37:41 +01:00
</h3>
2024-02-10 18:46:28 +01:00
<p align="center">
2025-07-14 20:18:42 -05:00
<a href="https://github.com/hanzoai/runtime"> Documentation </a>·
<a href="https://github.com/hanzoai/runtime/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=%F0%9F%90%9B+Bug+Report%3A+"> Report Bug </a>·
<a href="https://github.com/hanzoai/runtime/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.md&title=%F0%9F%9A%80+Feature%3A+"> Request Feature </a>·
<a href="https://hanzo.ai"> Visit Hanzo AI </a>
2025-01-17 15:37:41 +01:00
</p>
2024-02-06 09:22:15 +01:00
2025-05-05 16:04:21 +02:00
2025-04-28 21:02:24 +02:00
---
2024-02-10 18:46:28 +01:00
2025-04-28 21:02:24 +02:00
## Installation
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
### Python SDK
2024-10-25 17:15:53 +02:00
2024-03-16 20:28:25 +01:00
```bash
2025-07-14 20:18:42 -05:00
pip install hanzo-runtime
2024-03-16 20:28:25 +01:00
```
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
### TypeScript SDK
2024-03-05 14:36:09 +00:00
2024-02-10 18:46:28 +01:00
```bash
2025-07-14 20:18:42 -05:00
npm install @hanzo/runtime
2024-02-10 18:46:28 +01:00
```
2024-10-25 17:15:53 +02:00
---
2024-03-06 15:29:11 +01:00
2025-01-17 15:37:41 +01:00
## Features
2024-02-10 18:46:28 +01:00
2025-04-28 21:02:24 +02:00
- **Lightning-Fast Infrastructure**: Sub-90ms Sandbox creation from code to execution.
- **Separated & Isolated Runtime**: Execute AI-generated code with zero risk to your infrastructure.
- **Massive Parallelization for Concurrent AI Workflows**: Fork Sandbox filesystem and memory state (Coming soon!)
- **Programmatic Control**: File, Git, LSP, and Execute API
- **Unlimited Persistence**: Your Sandboxes can live forever
- **OCI/Docker Compatibility**: Use any OCI/Docker image to create a Sandbox
2024-02-10 18:46:28 +01:00
2025-01-17 15:37:41 +01:00
---
2024-02-06 09:22:15 +01:00
2025-04-28 21:02:24 +02:00
## Quick Start
2024-10-25 17:15:53 +02:00
2025-07-14 20:18:42 -05:00
1. Create an account at https://hanzo.ai
1. Generate a new API key from your dashboard
1. Start using the Hanzo Runtime SDK
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
## Creating your first Sandbox
2024-03-16 00:04:05 +01:00
2025-04-28 21:02:24 +02:00
### Python SDK
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
```py
2025-07-14 20:18:42 -05:00
from hanzo_runtime import HanzoRuntime , HanzoRuntimeConfig , CreateSandboxParams
2024-02-10 18:46:28 +01:00
2025-07-14 20:18:42 -05:00
# Initialize the Hanzo Runtime client
runtime = HanzoRuntime ( HanzoRuntimeConfig ( api_key = "YOUR_API_KEY" ))
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
# Create the Sandbox instance
2025-07-14 20:18:42 -05:00
sandbox = runtime . create ( CreateSandboxParams ( language = "python" ))
2025-04-28 21:02:24 +02:00
# Run code securely inside the Sandbox
response = sandbox . process . code_run ( 'print("Sum of 3 and 4 is " + str(3 + 4))' )
if response . exit_code != 0 :
print ( f "Error running code: { response . exit_code } { response . result } " )
else :
print ( response . result )
# Clean up the Sandbox
2025-07-14 20:18:42 -05:00
runtime . remove ( sandbox )
2024-02-06 09:22:15 +01:00
```
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
### Typescript SDK
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
```jsx
2025-07-14 20:18:42 -05:00
import { HanzoRuntime } from '@hanzo/runtime'
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
async function main () {
2025-07-14 20:18:42 -05:00
// Initialize the Hanzo Runtime client
const runtime = new HanzoRuntime ({
2025-04-28 21:02:24 +02:00
apiKey : 'YOUR_API_KEY' ,
})
2024-02-10 18:46:28 +01:00
2025-04-28 21:02:24 +02:00
let sandbox
try {
// Create the Sandbox instance
2025-07-14 20:18:42 -05:00
sandbox = await runtime . create ({
2025-04-28 21:02:24 +02:00
language : 'python' ,
})
// Run code securely inside the Sandbox
const response = await sandbox . process . codeRun ( 'print("Sum of 3 and 4 is " + str(3 + 4))' )
if ( response . exitCode !== 0 ) {
console . error ( 'Error running code:' , response . exitCode , response . result )
} else {
console . log ( response . result )
}
} catch ( error ) {
console . error ( 'Sandbox flow error:' , error )
} finally {
2025-07-14 20:18:42 -05:00
if ( sandbox ) await runtime . remove ( sandbox )
2025-04-28 21:02:24 +02:00
}
}
2024-10-25 17:15:53 +02:00
2025-04-28 21:02:24 +02:00
main (). catch ( console . error )
2024-02-06 09:22:15 +01:00
```
2025-01-17 15:37:41 +01:00
---
2024-02-06 09:22:15 +01:00
2025-01-17 15:37:41 +01:00
## Contributing
2024-10-25 17:15:53 +02:00
2025-07-14 20:18:42 -05:00
Hanzo Runtime is Open Source under the [GNU AFFERO GENERAL PUBLIC LICENSE ](LICENSE ). If you would like to contribute to the software, read the Developer Certificate of Origin Version 1.1 (https://developercertificate.org/). Afterwards, navigate to the [contributing guide ](CONTRIBUTING.md ) to get started.