Skip to content

Commit d3de4b2

Browse files
authored
feat(sdk)!: remove retired agent helpers and mount examples (#21)
1 parent 1af1daa commit d3de4b2

13 files changed

Lines changed: 18 additions & 1901 deletions

File tree

‎EXAMPLES.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Runnable examples live in [`examples/`](./examples).
99

1010
- [Blueprint with Build Context](#blueprint-with-build-context)
1111
- [Devbox From Blueprint (Run Command, Shutdown)](#devbox-from-blueprint-lifecycle)
12-
- [Devbox Mounts (Agent, Code, Object)](#devbox-mounts)
12+
- [Devbox Mounts (Code, Object)](#devbox-mounts)
1313
- [Devbox Snapshots (Suspend, Resume, Restore, Delete)](#devbox-snapshots)
1414
- [Devbox Tunnel (HTTP Server Access)](#devbox-tunnel)
1515
- [MCP Hub + Claude Code + GitHub](#mcp-github-tools)
@@ -77,17 +77,17 @@ yarn test:examples
7777
**Source:** [`examples/devbox-from-blueprint-lifecycle.ts`](./examples/devbox-from-blueprint-lifecycle.ts)
7878

7979
<a id="devbox-mounts"></a>
80-
## Devbox Mounts (Agent, Code, Object)
80+
## Devbox Mounts (Code, Object)
8181

82-
**Use case:** Launch a devbox that combines an agent mount for Claude Code, a code mount for the Runloop CLI repo, and an object mount for startup files.
82+
**Use case:** Launch a devbox with a code mount for the Runloop CLI repo and an object mount for startup files, then install Claude Code with a command.
8383

8484
**Tags:** `devbox`, `mounts`, `agent`, `code`, `object`, `claude-code`, `agent-gateway`, `ttl`
8585

8686
### Workflow
87-
- Create or reuse an agent by name
8887
- Create a secret for an agent and route it through agent gateway
8988
- Upload a temporary directory as a storage object with a TTL
90-
- Launch a devbox with agent, code, and object mounts together
89+
- Launch a devbox with code and object mounts together
90+
- Install Claude Code with a command
9191
- Run Claude Code on Opus 4.5 through the Anthropic agent gateway
9292
- Verify the rl-cli repo and extracted object files are present on the devbox
9393
- Shutdown the devbox and delete the temporary secret and object

‎README.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ yarn generate:examples-md
7676

7777
Use direct `secrets` injection when code inside the devbox legitimately needs the secret value. For third-party API credentials that should stay off the devbox, prefer wiring a Runloop secret through agent gateway instead. See [`examples/secrets-with-devbox.ts`](./examples/secrets-with-devbox.ts) for both patterns side by side using `devbox.create({ secrets: ... })` and `devbox.create({ gateways: ... })`.
7878

79-
For mount patterns, see [`examples/devbox-mounts.ts`](./examples/devbox-mounts.ts). It shows when to use `agent_mount` for reusable agents like Claude Code, `code_mount` for Git repositories such as [`runloopai/rl-cli`](https://github.com/runloopai/rl-cli.git), and `object_mount` for blobs that should appear on the devbox at startup. The example also demonstrates agent gateway wiring for Anthropic credentials plus object TTL, `.tgz` compression, and extraction-on-mount behavior.
79+
For mount patterns, see [`examples/devbox-mounts.ts`](./examples/devbox-mounts.ts). It shows when to use `code_mount` for Git repositories such as [`runloopai/rl-cli`](https://github.com/runloopai/rl-cli.git), and `object_mount` for blobs that should appear on the devbox at startup. The example installs Claude Code with a command and demonstrates agent gateway wiring for Anthropic credentials plus object TTL, `.tgz` compression, and extraction-on-mount behavior.
8080

8181
For snapshot workflows, see [`examples/devbox-snapshots.ts`](./examples/devbox-snapshots.ts). It uploads a file to a source devbox, shows `suspend()` plus `resume()`, takes a disk snapshot, restores multiple devboxes from the same snapshot baseline, mutates the file independently in each devbox, and deletes the snapshot after the demo completes.
8282

@@ -107,7 +107,6 @@ complete, and do not forward API authentication or request-option headers to sto
107107
Treat signed URLs and headers as credentials. Signed PUTs do not follow redirects or
108108
retry, and their error messages exclude signed credentials and storage response bodies.
109109

110-
- **[`runloop.agent`](https://runloopai.github.io/api-client-ts/stable/classes/sdk.AgentOps.html)** - Agent management (create, list agents from npm/pip/git)
111110
- **[`runloop.axon`](https://runloopai.github.io/api-client-ts/stable/classes/sdk.AxonOps.html)** - [Beta] Axon management (create, publish events, subscribe via SSE)
112111
- **[`runloop.networkPolicy`](https://runloopai.github.io/api-client-ts/stable/classes/sdk.NetworkPolicyOps.html)** - Network policy management (create, list, update egress rules)
113112
- **[`runloop.gatewayConfig`](https://runloopai.github.io/api-client-ts/stable/classes/sdk.GatewayConfigOps.html)** - Gateway config management (create, list API proxy configurations)

‎examples/devbox-mounts.ts‎

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
/**
44
---
5-
title: Devbox Mounts (Agent, Code, Object)
5+
title: Devbox Mounts (Code, Object)
66
slug: devbox-mounts
7-
use_case: Launch a devbox that combines an agent mount for Claude Code, a code mount for the Runloop CLI repo, and an object mount for startup files.
7+
use_case: Launch a devbox with a code mount for the Runloop CLI repo and an object mount for startup files, then install Claude Code with a command.
88
workflow:
9-
- Create or reuse an agent by name
109
- Create a secret for an agent and route it through agent gateway
1110
- Upload a temporary directory as a storage object with a TTL
12-
- Launch a devbox with agent, code, and object mounts together
11+
- Launch a devbox with code and object mounts together
12+
- Install Claude Code with a command
1313
- Run Claude Code on Opus 4.5 through the Anthropic agent gateway
1414
- Verify the rl-cli repo and extracted object files are present on the devbox
1515
- Shutdown the devbox and delete the temporary secret and object
@@ -37,8 +37,6 @@ import { RunloopSDK } from '@runloop/api-client';
3737
import { wrapRecipe, runAsCli } from './_harness';
3838
import type { RecipeContext, RecipeOutput } from './types';
3939

40-
const CLAUDE_CODE_AGENT_NAME = 'example-claude-code-agent';
41-
const CLAUDE_CODE_AGENT_VERSION = '1.0.0';
4240
const CLAUDE_CODE_PACKAGE = '@anthropic-ai/claude-code';
4341
const CLAUDE_MODEL = 'claude-opus-4-5';
4442
const OBJECT_TTL_MS = 60 * 60 * 1000;
@@ -50,34 +48,6 @@ function uniqueName(prefix: string): string {
5048
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
5149
}
5250

53-
// example setup: get or create an agent so we can mount it
54-
async function ensureClaudeCodeAgent(sdk: RunloopSDK): Promise<{ agentId: string; reused: boolean }> {
55-
const existingAgentsList = await sdk.agent.list({ name: CLAUDE_CODE_AGENT_NAME, limit: 20 });
56-
const existingAgentDetails = await Promise.all(existingAgentsList.map((candidate) => candidate.getInfo()));
57-
58-
const matchingAgent = existingAgentDetails
59-
.filter(
60-
(info) =>
61-
info.name === CLAUDE_CODE_AGENT_NAME &&
62-
info.version === CLAUDE_CODE_AGENT_VERSION &&
63-
info.source?.type === 'npm' &&
64-
info.source?.npm?.package_name === CLAUDE_CODE_PACKAGE,
65-
)
66-
.sort((left, right) => right.create_time_ms - left.create_time_ms)[0];
67-
68-
if (matchingAgent) {
69-
return { agentId: matchingAgent.id, reused: true };
70-
}
71-
72-
const createdAgent = await sdk.agent.createFromNpm({
73-
name: CLAUDE_CODE_AGENT_NAME,
74-
version: CLAUDE_CODE_AGENT_VERSION,
75-
package_name: CLAUDE_CODE_PACKAGE,
76-
});
77-
78-
return { agentId: createdAgent.id, reused: false };
79-
}
80-
8151
export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
8252
const { cleanup } = ctx;
8353
const anthropicApiKey = process.env['ANTHROPIC_API_KEY'];
@@ -92,9 +62,6 @@ export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
9262

9363
const resourcesCreated: string[] = [];
9464

95-
const { agentId, reused } = await ensureClaudeCodeAgent(sdk);
96-
resourcesCreated.push(reused ? `agent:${agentId}:reused` : `agent:${agentId}`);
97-
9865
// best practice: create a secret for the agent's credentials and use agent gateway to route it through
9966
// so that credentials are not exposed to the agent.
10067
const anthropicSecret = await sdk.secret.create({
@@ -128,14 +95,7 @@ export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
12895

12996
const devbox = await sdk.devbox.create({
13097
name: uniqueName('mounts-example-devbox'),
131-
// Use agent mounts for reusable tools or agents that should be installed onto the devbox.
132-
// For npm-based agents like Claude Code, mounting by name makes it easy to reuse the latest matching agent.
13398
mounts: [
134-
{
135-
type: 'agent_mount',
136-
agent_id: null,
137-
agent_name: CLAUDE_CODE_AGENT_NAME,
138-
},
13999
// Use code mounts for Git projects that should be cloned onto the devbox.
140100
{
141101
type: 'code_mount',
@@ -171,6 +131,11 @@ export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
171131
const gatewayTokenResult = await devbox.cmd.exec(`echo $${GATEWAY_ENV_PREFIX}`);
172132
const gatewayToken = (await gatewayTokenResult.stdout()).trim();
173133

134+
const installResult = await devbox.cmd.exec(`npm install -g ${CLAUDE_CODE_PACKAGE}`);
135+
if (installResult.exitCode !== 0) {
136+
throw new Error(`Claude Code installation failed: ${await installResult.stderr()}`);
137+
}
138+
174139
const claudeVersionResult = await devbox.cmd.exec('claude --version');
175140
const claudeVersion = (await claudeVersionResult.stdout()).trim();
176141

@@ -228,7 +193,7 @@ export async function recipe(ctx: RecipeContext): Promise<RecipeOutput> {
228193
{
229194
name: 'object mount extracted the uploaded example file onto the devbox',
230195
passed:
231-
mountedExampleContents.includes('title: Devbox Mounts (Agent, Code, Object)') &&
196+
mountedExampleContents.includes('title: Devbox Mounts (Code, Object)') &&
232197
mountedExampleContents.startsWith('#!/usr/bin/env -S npm run tsn -T'),
233198
details: mountedExamplePath,
234199
},

‎examples/registry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const exampleRegistry: ExampleRegistryEntry[] = [
3636
},
3737
{
3838
slug: 'devbox-mounts',
39-
title: 'Devbox Mounts (Agent, Code, Object)',
39+
title: 'Devbox Mounts (Code, Object)',
4040
fileName: 'devbox-mounts.ts',
4141
requiredEnv: ['RUNLOOP_API_KEY', 'ANTHROPIC_API_KEY'],
4242
run: runDevboxMountsExample,

‎llms.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## Core Patterns
1111

1212
- [Devbox lifecycle example](examples/devbox-from-blueprint-lifecycle.ts): Create blueprint, launch devbox, run commands, cleanup
13-
- [Devbox mounts example](examples/devbox-mounts.ts): Show `agent_mount`, `code_mount`, and `object_mount` together, including Claude Code via Anthropic agent gateway, the `runloopai/rl-cli` repo, and object TTL/compression/extraction behavior
13+
- [Devbox mounts example](examples/devbox-mounts.ts): Show `code_mount` and `object_mount` together, including command-installed Claude Code via Anthropic agent gateway, the `runloopai/rl-cli` repo, and object TTL/compression/extraction behavior
1414
- [Devbox snapshots example](examples/devbox-snapshots.ts): Upload a file, suspend and resume the source devbox, snapshot the shared baseline, restore multiple devboxes from it, mutate each copy independently, and delete the snapshot
1515
- [MCP GitHub example](examples/mcp-github-tools.ts): MCP Hub integration with Claude Code
1616
- [Secrets with Devbox example](examples/secrets-with-devbox.ts): Show direct secret injection for app data alongside agent gateway for upstream credentials that should stay off the devbox

0 commit comments

Comments
 (0)