Skip to content

docs: add mounts example#752

Merged
james-rl merged 6 commits into
mainfrom
james/ex-mounts
Mar 23, 2026
Merged

docs: add mounts example#752
james-rl merged 6 commits into
mainfrom
james/ex-mounts

Conversation

@james-rl

@james-rl james-rl commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

User description

⚠️ PR Title Must Follow Conventional Commits

Format: feat[optional scope]: <description>

Examples: feat: add new SDK method · feat(storage): support file uploads · feat!: breaking API change


Description

Shows how to use our main types of mount and short guidance on when to use each one:

  • agent
  • code
  • object

Note that the object mount includes TTL settings and the agent mount uses an agent gateway. This is to increase the chance that an agent generates high quality code from the examples

Motivation

Changes

Testing

  • Unit tests added
  • Integration tests added
  • Smoke Tests added/updated
  • Tested locally

Breaking Changes

Checklist

  • PR title follows Conventional Commits format (feat: or feat(scope):)
  • Documentation updated (if needed)
  • Breaking changes documented (if applicable)

CodeAnt-AI Description

Add a runnable example for combining agent, code, and object mounts

What Changed

  • Added a new devbox example that shows three mount types together: a reusable Claude Code agent, the runloopai/rl-cli repository, and startup files from an uploaded object
  • Demonstrates routing Anthropic access through agent gateway so Claude Code can run without exposing the raw API key on the devbox
  • Shows object upload with a TTL, .tgz storage, and extraction onto the devbox at startup
  • Updated the example registry, README, and example index so the new workflow is easy to find and run

Impact

✅ Clearer mount usage examples
✅ Easier Claude Code setup on devboxes
✅ Fewer mistakes when wiring secrets and startup files

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Mar 23, 2026
@codeant-ai

codeant-ai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Sequence Diagram

This PR adds a new runnable example that demonstrates how to combine agent, code, and object mounts in one devbox. The flow also shows routing model access through an agent gateway, validating mounted content, and cleaning up temporary resources.

sequenceDiagram
    participant User
    participant ExampleScript
    participant RunloopAPI
    participant Devbox

    User->>ExampleScript: Run devbox mounts example
    ExampleScript->>RunloopAPI: Get or create Claude Code agent
    ExampleScript->>RunloopAPI: Create gateway secret and upload object with TTL
    ExampleScript->>RunloopAPI: Create devbox with agent code and object mounts
    RunloopAPI-->>Devbox: Provision devbox with mounts and gateway
    ExampleScript->>Devbox: Run Claude and verify repo plus object files
    Devbox-->>ExampleScript: Return verification outputs
    ExampleScript->>RunloopAPI: Shutdown devbox and delete temporary resources
Loading

Generated by CodeAnt AI

@codeant-ai

codeant-ai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Missing Validation
    The SDK is created without checking that RUNLOOP_API_KEY is present. If the variable is missing, the example will fail later with a less clear API error. Verify that the required key is validated before any SDK calls are made.

  • Pagination Risk
    The agent lookup only inspects the first 20 results. If more matching agents exist, an existing reusable agent could be missed and a duplicate created. Confirm the lookup covers all pages or otherwise guarantees the full search space is checked.

Comment thread examples/devbox-mounts.ts Outdated
Comment on lines +186 to +187
const repoPackageJson =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The repository verification check uses repoPackageJson.includes(...), but repoPackageJson is never populated with file contents. This makes the check crash instead of reporting pass/fail. Read /package.json from the mounted repo path before calling includes. [logic error]

Severity Level: Critical 🚨
- ❌ examples/registry import chain breaks on devbox-mounts module.
- ❌ examples smoketest suite cannot load this example file.
- ⚠️ Repo mount validation check never executes.
Suggested change
const repoPackageJson =
const repoPackageJson = await devbox.file.read({
file_path: path.posix.join(repoMountPath, 'package.json'),
});
Steps of Reproduction ✅
1. Import the examples test entrypoint at `tests/smoketests/examples/examples.test.ts:2`,
which imports `exampleRegistry`.

2. `exampleRegistry` at `examples/registry.ts:8` imports `runDevboxMountsExample` from
`examples/devbox-mounts.ts`.

3. While parsing `recipe()` in `examples/devbox-mounts.ts:186`, code contains `const
repoPackageJson =` with no initializer.

4. Module load fails before any checks run; the `repoPackageJson.includes(...)` check at
`examples/devbox-mounts.ts:220` is never reachable.

5. Fixing this line by actually reading `/package.json` from `repoMountPath` restores
executable flow for the repo-mount validation check.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** examples/devbox-mounts.ts
**Line:** 186:187
**Comment:**
	*Logic Error: The repository verification check uses `repoPackageJson.includes(...)`, but `repoPackageJson` is never populated with file contents. This makes the check crash instead of reporting pass/fail. Read `/package.json` from the mounted repo path before calling `includes`.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

Comment thread examples/devbox-mounts.ts Outdated
const repoPackageJson =

const mountedExamplePath = path.posix.join(OBJECT_MOUNT_DIR, COPIED_EXAMPLE_FILE_NAME);
const mountedExampleContents = await devbox.file.read({ path: mountedExamplePath });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: devbox.file.read expects a file_path parameter, not path; sending the wrong field means the API request is malformed and the mounted file check will fail. Use file_path to match the SDK contract. [API contract violations]

Severity Level: Major ⚠️
- ⚠️ Object-mount file verification request body is malformed.
- ⚠️ Mounted-file check can fail despite successful mount.
Suggested change
const mountedExampleContents = await devbox.file.read({ path: mountedExamplePath });
const mountedExampleContents = await devbox.file.read({ file_path: mountedExamplePath });
Steps of Reproduction ✅
1. Run `recipe()` in `examples/devbox-mounts.ts` after devbox creation; execution reaches
mounted file verification at line 189.

2. `DevboxFileOps.read()` at `src/sdk/devbox.ts:31-33` forwards params unchanged to API
client.

3. `readFileContents()` at `src/resources/devboxes/devboxes.ts:389-396` POSTs body as-is
to `/read_file_contents`.

4. Contract `DevboxReadFileContentsParams` at `src/resources/devboxes/devboxes.ts:16-22`
requires `file_path`, not `path`.

5. Existing tests consistently call `devbox.file.read({ file_path: ... })` (e.g.,
`tests/objects/devbox.test.ts:165`), confirming this is the expected field.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** examples/devbox-mounts.ts
**Line:** 189:189
**Comment:**
	*Api Contract Violations: `devbox.file.read` expects a `file_path` parameter, not `path`; sending the wrong field means the API request is malformed and the mounted file check will fail. Use `file_path` to match the SDK contract.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

@codeant-ai

codeant-ai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

CodeAnt AI finished reviewing your PR.

@github-actions

github-actions Bot commented Mar 23, 2026

Copy link
Copy Markdown

❌ Object Smoke Tests Failed

Test Results

❌ Some smoke tests failed

Please fix the failing tests before checking coverage.

📋 View full test logs

@james-rl
james-rl merged commit 8b8eda2 into main Mar 23, 2026
8 of 9 checks passed
@james-rl
james-rl deleted the james/ex-mounts branch March 23, 2026 23:39
@stainless-app stainless-app Bot mentioned this pull request Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants