Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.runloop.ai/llms.txt

Use this file to discover all available pages before exploring further.

Start with the Runloop Quickstart to use the examples below.

Manual Stopping

You can stop a running Devbox any time using the devbox.shutdown call in the client SDK.
devbox = await runloop.devbox.create()
...
await devbox.shutdown()

Devbox Max Lifetime

When you create a Devbox, it is automatically given a maximum lifetime. This prevents unwanted charges by leaving Devboxes running when they are not needed. The default lifetime is 1 hour, but this can be configured when you create the Devbox:
devbox = await runloop.devbox.create(
    launch_parameters={
        "keep_alive_time_seconds": 1800,
    },
)

Idle Behavior

You can also configure your Devboxes to automatically shutdown or suspend when they are idle using the lifecycle.after_idle launch parameter. By default, Runloop will do nothing if your Devbox is idle. on_idle only applies to RUNNING Devboxes and the action won’t be taken if the Devbox is not in RUNNING state.
devbox = await runloop.devbox.create(
    launch_parameters={
        "lifecycle": {
            "after_idle": {"idle_time_seconds": 1800, "on_idle": "suspend"},
        }
    },
)

Network Access Control

You can restrict what network resources a Devbox can access by applying a Network Policy. This is useful for security, compliance, and controlling costs.
# Create a policy that only allows specific hosts
policy = await runloop.network_policies.create(
    name="restricted-policy",
    allow_all=False,
    allowed_hostnames=["github.com", "api.openai.com"]
)

# Create a devbox with the network policy
devbox = await runloop.devbox.create(
    launch_parameters={
        "network_policy_id": policy.id
    }
)
See the Network Policies documentation for more details on creating and managing policies.