Skip to content

Latest commit

 

History

History
135 lines (99 loc) · 3.68 KB

File metadata and controls

135 lines (99 loc) · 3.68 KB

Examples

This file is auto-generated from metadata in examples/*.ts. Do not edit this file manually. Run yarn generate:examples-md 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.

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

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

yarn tsn -T examples/blueprint-with-build-context.ts

Test

yarn test:examples

Source: examples/blueprint-with-build-context.ts

Devbox From Blueprint (Run Command, Shutdown)

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

Tags: devbox, blueprint, commands, logs, cleanup

Workflow

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

Prerequisites

  • RUNLOOP_API_KEY

Run

yarn tsn -T examples/devbox-from-blueprint-lifecycle.ts

Test

yarn test:examples

Source: examples/devbox-from-blueprint-lifecycle.ts

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 yarn tsn -T examples/mcp-github-tools.ts

Test

yarn test:examples

Source: examples/mcp-github-tools.ts

Secrets with Devbox (Create, Inject, Verify, Delete)

Use case: Create a secret, inject it into a devbox as an environment variable, verify access, and clean up.

Tags: secrets, devbox, environment-variables, cleanup

Workflow

  • Create a secret with a test value
  • Create a devbox with the secret mapped to an env var
  • Execute a command that reads the secret from the environment
  • Verify the value matches
  • Shutdown devbox and delete secret

Prerequisites

  • RUNLOOP_API_KEY

Run

yarn tsn -T examples/secrets-with-devbox.ts

Test

yarn test:examples

Source: examples/secrets-with-devbox.ts