Skip to content

Commit 05ed79f

Browse files
committed
merged
1 parent 212175a commit 05ed79f

2 files changed

Lines changed: 57 additions & 22 deletions

File tree

EXAMPLES.md

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,46 @@ Runnable examples live in [`examples/`](./examples).
77

88
## Table of Contents
99

10-
- [Blueprint with Build Context](#blueprint-with-build-context)
11-
- [Devbox From Blueprint (Run Command, Shutdown)](#devbox-from-blueprint-lifecycle)
12-
<<<<<<< HEAD
13-
- [Devbox Tunnel (HTTP Server Access)](#devbox-tunnel)
14-
=======
15-
- [Devbox Snapshot and Resume](#devbox-snapshot-resume)
16-
>>>>>>> main
17-
- [MCP Hub + Claude Code + GitHub](#mcp-github-tools)
18-
- [Secrets with Devbox (Create, Inject, Verify, Delete)](#secrets-with-devbox)
10+
- [Examples](#examples)
11+
- [Table of Contents](#table-of-contents)
12+
- [Blueprint with Build Context](#blueprint-with-build-context)
13+
- [Workflow](#workflow)
14+
- [Prerequisites](#prerequisites)
15+
- [Run](#run)
16+
- [Test](#test)
17+
- [Devbox From Blueprint (Run Command, Shutdown)](#devbox-from-blueprint-run-command-shutdown)
18+
- [Workflow](#workflow-1)
19+
- [Prerequisites](#prerequisites-1)
20+
- [Run](#run-1)
21+
- [Test](#test-1)
22+
- [Devbox Tunnel (HTTP Server Access)](#devbox-tunnel-http-server-access)
23+
- [Workflow](#workflow-2)
24+
- [Devbox Snapshot and Resume](#devbox-snapshot-and-resume)
25+
- [Workflow](#workflow-3)
26+
- [Prerequisites](#prerequisites-2)
27+
- [Run](#run-2)
28+
- [Test](#test-2)
29+
- [MCP Hub + Claude Code + GitHub](#mcp-hub--claude-code--github)
30+
- [Workflow](#workflow-4)
31+
- [Prerequisites](#prerequisites-3)
32+
- [Run](#run-3)
33+
- [Test](#test-3)
34+
- [Secrets with Devbox (Create, Inject, Verify, Delete)](#secrets-with-devbox-create-inject-verify-delete)
35+
- [Workflow](#workflow-5)
36+
- [Prerequisites](#prerequisites-4)
37+
- [Run](#run-4)
38+
- [Test](#test-4)
1939

2040
<a id="blueprint-with-build-context"></a>
41+
2142
## Blueprint with Build Context
2243

2344
**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.
2445

2546
**Tags:** `blueprint`, `object-store`, `build-context`, `devbox`, `cleanup`, `async`
2647

2748
### Workflow
49+
2850
- Create a temporary directory with sample application files
2951
- Upload the directory to object storage as build context
3052
- Create a blueprint with a Dockerfile that copies the context files
@@ -33,28 +55,33 @@ Runnable examples live in [`examples/`](./examples).
3355
- Shutdown devbox and delete blueprint and storage object
3456

3557
### Prerequisites
58+
3659
- `RUNLOOP_API_KEY`
3760

3861
### Run
62+
3963
```sh
4064
uv run python -m examples.blueprint_with_build_context
4165
```
4266

4367
### Test
68+
4469
```sh
4570
uv run pytest -m smoketest tests/smoketests/examples/
4671
```
4772

4873
**Source:** [`examples/blueprint_with_build_context.py`](./examples/blueprint_with_build_context.py)
4974

5075
<a id="devbox-from-blueprint-lifecycle"></a>
76+
5177
## Devbox From Blueprint (Run Command, Shutdown)
5278

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

5581
**Tags:** `devbox`, `blueprint`, `commands`, `logs`, `cleanup`
5682

5783
### Workflow
84+
5885
- Create a blueprint
5986
- Fetch blueprint build logs
6087
- Create a devbox from the blueprint
@@ -64,84 +91,87 @@ uv run pytest -m smoketest tests/smoketests/examples/
6491
- Shutdown devbox and delete blueprint
6592

6693
### Prerequisites
94+
6795
- `RUNLOOP_API_KEY`
6896

6997
### Run
98+
7099
```sh
71100
uv run python -m examples.devbox_from_blueprint_lifecycle
72101
```
73102

74103
### Test
104+
75105
```sh
76106
uv run pytest -m smoketest tests/smoketests/examples/
77107
```
78108

79109
**Source:** [`examples/devbox_from_blueprint_lifecycle.py`](./examples/devbox_from_blueprint_lifecycle.py)
80110

81-
<<<<<<< HEAD
82111
<a id="devbox-tunnel"></a>
112+
83113
## Devbox Tunnel (HTTP Server Access)
84114

85115
**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.
86116

87117
**Tags:** `devbox`, `tunnel`, `networking`, `http`, `async`
88118

89119
### Workflow
120+
90121
- Create a devbox
91122
- Start an HTTP server inside the devbox
92123
- Enable a tunnel for external access
93124
- Make an HTTP request from the local machine through the tunnel
94125
- Validate the response
95126
- Shutdown the devbox
96-
=======
97-
<a id="devbox-snapshot-resume"></a>
127+
<a id="devbox-snapshot-resume"></a>
128+
98129
## Devbox Snapshot and Resume
99130

100131
**Use case:** Create a devbox, snapshot its disk, resume from the snapshot, and demonstrate that changes in the original devbox do not affect the clone. Uses the async SDK.
101132

102133
**Tags:** `devbox`, `snapshot`, `resume`, `cleanup`, `async`
103134

104135
### Workflow
136+
105137
- Create a devbox
106138
- Write a file to the devbox
107139
- Create a disk snapshot
108140
- Create a new devbox from the snapshot
109141
- Modify the file on the original devbox
110142
- Verify the clone has the original content
111143
- Shutdown both devboxes and delete the snapshot
112-
>>>>>>> main
113144

114145
### Prerequisites
146+
115147
- `RUNLOOP_API_KEY`
116148

117149
### Run
150+
118151
```sh
119-
<<<<<<< HEAD
120152
uv run python -m examples.devbox_tunnel
121-
=======
122153
uv run python -m examples.devbox_snapshot_resume
123-
>>>>>>> main
124154
```
125155

126156
### Test
157+
127158
```sh
128159
uv run pytest -m smoketest tests/smoketests/examples/
129160
```
130161

131-
<<<<<<< HEAD
132162
**Source:** [`examples/devbox_tunnel.py`](./examples/devbox_tunnel.py)
133-
=======
134163
**Source:** [`examples/devbox_snapshot_resume.py`](./examples/devbox_snapshot_resume.py)
135-
>>>>>>> main
136164

137165
<a id="mcp-github-tools"></a>
166+
138167
## MCP Hub + Claude Code + GitHub
139168

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

142171
**Tags:** `mcp`, `devbox`, `github`, `commands`, `cleanup`
143172

144173
### Workflow
174+
145175
- Create an MCP config for GitHub
146176
- Store GitHub token as a Runloop secret
147177
- Launch a devbox with MCP Hub wiring
@@ -150,30 +180,35 @@ uv run pytest -m smoketest tests/smoketests/examples/
150180
- Shutdown devbox and clean up cloud resources
151181

152182
### Prerequisites
183+
153184
- `RUNLOOP_API_KEY`
154185
- `GITHUB_TOKEN (GitHub PAT with repo scope)`
155186
- `ANTHROPIC_API_KEY`
156187

157188
### Run
189+
158190
```sh
159191
GITHUB_TOKEN=ghp_xxx ANTHROPIC_API_KEY=sk-ant-xxx uv run python -m examples.mcp_github_tools
160192
```
161193

162194
### Test
195+
163196
```sh
164197
uv run pytest -m smoketest tests/smoketests/examples/
165198
```
166199

167200
**Source:** [`examples/mcp_github_tools.py`](./examples/mcp_github_tools.py)
168201

169202
<a id="secrets-with-devbox"></a>
203+
170204
## Secrets with Devbox (Create, Inject, Verify, Delete)
171205

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

174208
**Tags:** `secrets`, `devbox`, `environment-variables`, `cleanup`
175209

176210
### Workflow
211+
177212
- Create a secret with a test value
178213
- Create a devbox with the secret mapped to an env var
179214
- Execute a command that reads the secret from the environment
@@ -183,14 +218,17 @@ uv run pytest -m smoketest tests/smoketests/examples/
183218
- Shutdown devbox and delete secret
184219

185220
### Prerequisites
221+
186222
- `RUNLOOP_API_KEY`
187223

188224
### Run
225+
189226
```sh
190227
uv run python -m examples.secrets_with_devbox
191228
```
192229

193230
### Test
231+
194232
```sh
195233
uv run pytest -m smoketest tests/smoketests/examples/
196234
```

examples/registry.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,16 @@
3333
"run": run_devbox_from_blueprint_lifecycle_example,
3434
},
3535
{
36-
<<<<<<< HEAD
3736
"slug": "devbox-tunnel",
3837
"title": "Devbox Tunnel (HTTP Server Access)",
3938
"file_name": "devbox_tunnel.py",
4039
"required_env": ["RUNLOOP_API_KEY"],
4140
"run": run_devbox_tunnel_example,
42-
=======
4341
"slug": "devbox-snapshot-resume",
4442
"title": "Devbox Snapshot and Resume",
4543
"file_name": "devbox_snapshot_resume.py",
4644
"required_env": ["RUNLOOP_API_KEY"],
4745
"run": run_devbox_snapshot_resume_example,
48-
>>>>>>> main
4946
},
5047
{
5148
"slug": "mcp-github-tools",

0 commit comments

Comments
 (0)