Skip to content

Latest commit

 

History

History
134 lines (98 loc) · 3.76 KB

File metadata and controls

134 lines (98 loc) · 3.76 KB

Examples

This file is auto-generated from metadata in examples/*.py. Do not edit this file manually. Run uv run python scripts/generate_examples_md.py instead.

Runnable examples live in examples/.

Table of Contents

Blueprint with Build Context

Use case: Create a blueprint using the object store to provide docker build context files, then verify files are copied into the image. Uses the async SDK.

Tags: blueprint, object-store, build-context, devbox, cleanup, async

Workflow

  • Create a temporary directory with sample application files
  • Upload the directory to object storage as build context
  • Create a blueprint with a Dockerfile that copies the context files
  • Create a devbox from the blueprint
  • Verify the files were copied into the image
  • Shutdown devbox and delete blueprint and storage object

Prerequisites

  • RUNLOOP_API_KEY

Run

uv run python -m examples.blueprint_with_build_context

Test

uv run pytest -m smoketest tests/smoketests/examples/

Source: examples/blueprint_with_build_context.py

Devbox From Blueprint (Run Command, Shutdown)

Use case: Create a devbox from a blueprint, run a command, validate output, and cleanly tear everything down.

Tags: devbox, blueprint, commands, cleanup

Workflow

  • Create a blueprint
  • Create a devbox from the blueprint
  • Execute a command in the devbox
  • Validate exit code and stdout
  • Shutdown devbox and delete blueprint

Prerequisites

  • RUNLOOP_API_KEY

Run

uv run python -m examples.devbox_from_blueprint_lifecycle

Test

uv run pytest -m smoketest tests/smoketests/examples/

Source: examples/devbox_from_blueprint_lifecycle.py

Devbox Tunnel (HTTP Server Access)

Use case: Create a devbox, start an HTTP server, enable a tunnel, and access the server from the local machine through the tunnel. Uses the async SDK.

Tags: devbox, tunnel, networking, http, async

Workflow

  • Create a devbox
  • Start an HTTP server inside the devbox
  • Enable a tunnel for external access
  • Make an HTTP request from the local machine through the tunnel
  • Validate the response
  • Shutdown the devbox

Prerequisites

  • RUNLOOP_API_KEY

Run

uv run python -m examples.devbox_tunnel

Test

uv run pytest -m smoketest tests/smoketests/examples/

Source: examples/devbox_tunnel.py

MCP Hub + Claude Code + GitHub

Use case: Connect Claude Code running in a devbox to GitHub tools through MCP Hub without exposing raw GitHub credentials to the devbox.

Tags: mcp, devbox, github, commands, cleanup

Workflow

  • Create an MCP config for GitHub
  • Store GitHub token as a Runloop secret
  • Launch a devbox with MCP Hub wiring
  • Install Claude Code and register MCP endpoint
  • Run a Claude prompt through MCP tools
  • Shutdown devbox and clean up cloud resources

Prerequisites

  • RUNLOOP_API_KEY
  • GITHUB_TOKEN (GitHub PAT with repo scope)
  • ANTHROPIC_API_KEY

Run

GITHUB_TOKEN=ghp_xxx ANTHROPIC_API_KEY=sk-ant-xxx uv run python -m examples.mcp_github_tools

Test

uv run pytest -m smoketest tests/smoketests/examples/

Source: examples/mcp_github_tools.py