Skip to content

docs: add mount examples#763

Open
james-rl wants to merge 2 commits intomainfrom
james/ex-mounts
Open

docs: add mount examples#763
james-rl wants to merge 2 commits intomainfrom
james/ex-mounts

Conversation

@james-rl
Copy link
Copy Markdown
Contributor

Shows off how to use our main types of mounts with the usage patterns we expect:

  • agent: mounts claude and uses agent gateway to protect credentials
  • code: shows off how to mount a project stored on github
  • object store: for blobs & files (with TTL)

@james-rl james-rl requested a review from sid-rl March 24, 2026 17:56
Comment on lines +235 to +243
ExampleCheck(
name="Claude Code gateway invocation is documented without executing it",
passed=(
"ANTHROPIC_BASE_URL" in claude_gateway_command
and "ANTHROPIC_API_KEY" in claude_gateway_command
and "claude --model" in claude_gateway_command
),
details=claude_gateway_command,
),
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.

low value check: strings are hardcoded om build_claude_gateway_command()

Comment on lines +134 to +135
agent_id, reused_agent = await ensure_claude_code_agent(sdk)
resources_created.append(f"agent:{agent_id}:reused" if reused_agent else f"agent:{agent_id}")
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.

do we need to add a cleanup() call for the agent?

- Upload a temporary bootstrap directory as a storage object with a TTL
- Launch a devbox with agent, code, and object mounts together
- Verify the gateway token and URL are present instead of the raw Anthropic key
- Run Claude Code through the Anthropic agent gateway
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.

should we clarify that we build the command but don't actually execute it?

resources_created.append(f"secret:{secret.name}")
cleanup.add(f"secret:{secret.name}", secret.delete)

bootstrap_dir = create_bootstrap_dir()
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.

why not use with tempfile.TemporaryDirectory() like in blueprint_with_build_context.py? feels more pythonic

Comment on lines +61 to +88
async def ensure_claude_code_agent(sdk: AsyncRunloopSDK) -> tuple[str, bool]:
"""Return a reusable Claude Code agent, creating it if needed."""
existing_agents = await sdk.agent.list(name=CLAUDE_CODE_AGENT_NAME, limit=20)
existing_infos = await asyncio.gather(*(agent.get_info() for agent in existing_agents))

matching_agents = sorted(
(
info
for info in existing_infos
if info.name == CLAUDE_CODE_AGENT_NAME
and info.version == CLAUDE_CODE_AGENT_VERSION
and info.source is not None
and info.source.type == "npm"
and info.source.npm is not None
and info.source.npm.package_name == CLAUDE_CODE_PACKAGE
),
key=lambda info: info.create_time_ms,
reverse=True,
)
if matching_agents:
return matching_agents[0].id, True

agent = await sdk.agent.create_from_npm(
name=CLAUDE_CODE_AGENT_NAME,
version=CLAUDE_CODE_AGENT_VERSION,
package_name=CLAUDE_CODE_PACKAGE,
)
return agent.id, False
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.

feels like too much boilerplate for an example. we should just create a new agent and clean it up to more cleanly demonstrate the happy path

Comment on lines +106 to +107
"if [ -d /home/user/rl-cli ]; then printf /home/user/rl-cli; "
"elif [ -d /home/user/rl-clis ]; then printf /home/user/rl-clis; "
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.

why are there two possibilities?

f'ANTHROPIC_API_KEY="${GATEWAY_ENV_PREFIX}" '
f"claude --model {shlex.quote(CLAUDE_MODEL)} "
f"-p {shlex.quote(CLAUDE_PROMPT)} "
"--dangerously-skip-permissions"
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.

what is this flag? feels suspect to use a "dangerous" flag as part of our example code: agents might read this as the recommended pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants