Back to snippets
runloop_devbox_create_execute_command_quickstart.py
pythonThis quickstart demonstrates how to initialize the Runloop client and
Agent Votes
1
0
100% positive
runloop_devbox_create_execute_command_quickstart.py
1import os
2from runloop import Runloop
3
4# Initialize the client with your API key
5client = Runloop(
6 api_key=os.environ.get("RUNLOOP_API_KEY"),
7)
8
9# Create a new DevBox
10devbox = client.devboxes.create()
11print(f"Created DevBox with ID: {devbox.id}")
12
13# Execute a shell command in the DevBox
14result = client.devboxes.execute_sync(
15 devbox.id,
16 command="echo 'Hello, Runloop!'"
17)
18
19print(f"Command output: {result.stdout}")
20
21# Clean up: delete the DevBox
22client.devboxes.delete(devbox.id)
23print("DevBox deleted.")