Files
zeekay e3ad80b12d fix: remove ALL remaining Daytona references
- Fixed all variable names in examples: daytona → runtime
- Updated owner/group from "daytona" to "hanzo"
- Changed bucket name to "hanzo-runtime-volume-builds"
- Updated all imports to use hanzo_runtime_api_client
- Fixed all docstring examples
- Removed every single Daytona reference from the codebase

The SDKs are now completely rebranded to Hanzo Runtime.
2025-07-14 21:27:33 -05:00

38 lines
1.2 KiB
Python

import asyncio
from hanzo_runtime import AsyncHanzoRuntime, CreateSandboxFromImageParams, Resources
async def main():
async with AsyncHanzoRuntime() as hanzo_runtime:
params = CreateSandboxFromImageParams(
image="python:3.9.23-slim",
language="python",
resources=Resources(
cpu=1,
memory=1,
disk=3,
),
)
sandbox = await hanzo_runtime.create(params, timeout=150, on_snapshot_create_logs=print)
# Run the code securely inside the sandbox
response = await sandbox.process.code_run('print("Hello World!")')
if response.exit_code != 0:
print(f"Error: {response.exit_code} {response.result}")
else:
print(response.result)
# Execute an os command in the sandbox
response = await sandbox.process.exec('echo "Hello World from exec!"', timeout=10)
if response.exit_code != 0:
print(f"Error: {response.exit_code} {response.result}")
else:
print(response.result)
await hanzo_runtime.delete(sandbox)
if __name__ == "__main__":
asyncio.run(main())