Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion docs/inference/set-up-sub-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,40 @@ The primary orchestration model remains responsible for conversation, planning,

## Update the Sandbox Config

<Note>
Finish the [Quickstart](../get-started/quickstart) and start the target sandbox before you run the `docker exec` commands in this section.
These commands run on the host that owns the sandbox containers and discover the running sandbox container from the `openshell.ai/sandbox-name` Docker label.
If you have not created a sandbox yet, onboard one first, such as `my-assistant`.
</Note>

Fetch the current OpenClaw config from the sandbox, patch it with your auxiliary provider and `agents.list` changes, then upload it back.
On Docker-driver sandboxes, run these commands from the host that owns the sandbox containers.
The container name includes a runtime suffix, so discover it from the OpenShell sandbox label:

```bash
export SANDBOX=my-assistant
export SANDBOX_CTR=$(docker ps --filter "label=openshell.ai/sandbox-name=$SANDBOX" --format "{{.Names}}" | sed -n '1p')
if [ -z "$SANDBOX_CTR" ]; then
echo "No running sandbox container found for $SANDBOX. Start the sandbox before editing its config."
exit 1
fi
docker exec --user root "$SANDBOX_CTR" cat /sandbox/.openclaw/openclaw.json > /tmp/openclaw.json
```

If `SANDBOX_CTR` is empty, the sandbox is not running on this host.
Start the sandbox, confirm that `docker ps` shows the matching `openshell.ai/sandbox-name` label, then rerun the export commands before continuing.

Create `/tmp/openclaw.updated.json` with the OpenClaw sub-agent config.
For the Omni example, the demo provides `vlm-demo/vlm-subagent/openclaw-patch.py`.
Set `VLM_DEMO_DIR` to the local `vlm-demo` directory from the demo assets, then run the patch helper:

```bash
export VLM_DEMO_DIR=/path/to/nemoclaw-demos/vlm-demo
python3 "$VLM_DEMO_DIR/vlm-subagent/openclaw-patch.py" "$NVIDIA_API_KEY" < /tmp/openclaw.json > /tmp/openclaw.updated.json
```

The helper reads `/tmp/openclaw.json` from standard input, adds the Omni provider and `vision-operator` entry, and writes the patched config to `/tmp/openclaw.updated.json`.
Do not commit `/tmp/openclaw.updated.json` or any other file that contains a real API key.
Comment on lines +79 to +87

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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

helper=$(fd -a 'openclaw-patch.py' . | head -n1)
sed -n '1,220p' "$helper"
rg -n --context 2 'argparse|sys\.argv|NVIDIA_API_KEY|openclaw-patch' "$(dirname "$helper")"

Repository: NVIDIA/NemoClaw

Length of output: 103


🏁 Script executed:

git ls-files | grep -i 'openclaw-patch\|vlm-demo' | head -20

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

fd -type f -name '*patch*.py' | grep -v node_modules | head -20

Repository: NVIDIA/NemoClaw

Length of output: 230


🏁 Script executed:

rg -l 'openclaw-patch' --type python

Repository: NVIDIA/NemoClaw

Length of output: 90


🏁 Script executed:

rg -i 'vlm-demo|openclaw-patch' --max-count 20

Repository: NVIDIA/NemoClaw

Length of output: 3377


🏁 Script executed:

cat docs/inference/set-up-sub-agent.mdx | head -100

Repository: NVIDIA/NemoClaw

Length of output: 6305


🌐 Web query:

openclaw-patch.py NVIDIA_API_KEY brevdev nemoclaw-demos vlm-demo usage

💡 Result:

The term openclaw-patch.py refers to a specific utility script provided within the brevdev/nemoclaw-demos repository [1][2], designed to help users configure and patch OpenClaw environments, particularly for setting up advanced sub-agents like the Vision Language Model (VLM) demo [3][2]. Usage Summary: 1. Context and Purpose: The script is part of the vlm-demo and openclaw-omni-demo workflows [1][3][2]. It is used to programmatically modify the OpenClaw configuration (openclaw.json) to include auxiliary providers, such as the NVIDIA Omni provider, and to update agent configurations for task-specific delegation [3][2]. 2. NVIDIA API Key: To use the NVIDIA provider (required for these demos), you must set the NVIDIA_API_KEY environment variable [4][3]. This key is obtained from build.nvidia.com and follows the nvapi- prefix format [4][5][6]. OpenClaw natively recognizes this variable for authentication without needing explicit provider configuration in many cases [4]. 3. Patching Workflow: When running the VLM or Omni sub-agent demos, the workflow typically involves: - Using the provided openclaw-patch.py script to automate the injection of the sub-agent provider and agent list settings into your local openclaw.json [3][2]. - Ensuring the sandbox environment is correctly configured with the necessary network policies and credentials [3][7][2]. - Validating the setup via provided verification scripts (e.g., verify-omni-demo.sh) [3]. Important Technical Notes: - Config Management: OpenClaw has evolved its configuration management. While older or community workflows like those in brevdev/nemoclaw-demos use custom scripts like openclaw-patch.py [2], recent versions of OpenClaw have introduced a native openclaw config apply command to handle JSON5 configuration patches directly [8]. - Plugin Caveats: Be aware that some older versions of the NVIDIA provider plugin had issues with correctly persisting API keys, which could lead to validation errors in models.json [9]. Ensure your OpenClaw installation is up to date to avoid these issues. - Security: Never share or commit your NVIDIA_API_KEY to public repositories [5]. Use environment variables to keep keys out of shell history and configuration files whenever possible [4].

Citations:


🌐 Web query:

github.com brevdev nemoclaw-demos vlm-subagent openclaw-patch.py

💡 Result:

The reference to openclaw-patch.py in the context of brevdev/nemoclaw-demos likely relates to automated scripts for configuring or patching OpenClaw environments. The brevdev/nemoclaw-demos repository provides a collection of guides and demo setups for users who have completed the initial installation of NemoClaw [1]. Within this repository, specifically in the openclaw-omni-demo project, there is a focus on configuring sub-agents, such as the Nemotron Omni vision sub-agent [1][2]. While the repository contains several scripts to automate these setups—such as apply-omni-subagent.sh, verify-omni-demo.sh, and fix-spark-gateway.sh [2]—the specific filename openclaw-patch.py is not listed as a primary, documented component of the main demo directory structure [2][3]. However, OpenClaw-related patching and configuration scripts are common in the ecosystem; for instance, the mahsumaktas/openclaw-patchkit repository utilizes various Python-based patching strategies and scripts for maintaining OpenClaw environments [4][5]. Additionally, there is a documented apply_patch tool within the OpenClaw framework used for structured file changes [6], and other community packs have historically included files such as ensure-openclaw-postfix-patch.py [7]. If you are looking for specific functionality related to patching an OpenClaw instance for a VLM sub-agent, the recommended approach is to use the scripts/apply-omni-subagent.sh provided in the openclaw-omni-demo folder, which handles the necessary modifications to openclaw.json, policy.yaml, and workspace agent files [2].

Citations:


Use an environment variable instead of a positional argument for the API key.

The search results confirm a security best practice: "Never share or commit your NVIDIA_API_KEY to public repositories. Use environment variables to keep keys out of shell history and configuration files whenever possible."

Passing "$NVIDIA_API_KEY" as a positional argument in the command line exposes the secret in shell history and process listings. Update the docs to show the helper accepting the key via the NVIDIA_API_KEY environment variable instead:

export VLM_DEMO_DIR=/path/to/nemoclaw-demos/vlm-demo
export NVIDIA_API_KEY=your-api-key
python3 "$VLM_DEMO_DIR/vlm-subagent/openclaw-patch.py" < /tmp/openclaw.json > /tmp/openclaw.updated.json

Also verify with the vlm-demo maintainers that the script supports environment variable input, or confirm whether the recommended approach is to use apply-omni-subagent.sh from the openclaw-omni-demo folder instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/inference/set-up-sub-agent.mdx` around lines 79 - 87, The command
example in the documentation passes the NVIDIA_API_KEY as a positional argument
to the openclaw-patch.py script, which exposes the secret in shell history and
process listings. Update the code block to instead export NVIDIA_API_KEY as an
environment variable before running the script, and remove the "$NVIDIA_API_KEY"
positional argument from the python3 command invocation. Verify with the
vlm-demo maintainers that the openclaw-patch.py script properly supports reading
the API key from the NVIDIA_API_KEY environment variable, or confirm if the
recommended approach is to use apply-omni-subagent.sh from the
openclaw-omni-demo folder instead.


Upload the patched config and refresh the hash.
In the default mutable state, this keeps the local hash consistent but does not make it tamper-proof.
Expand All @@ -78,7 +100,21 @@ docker exec --user root "$SANDBOX_CTR" chmod 444 /sandbox/.openclaw/openclaw.jso
docker exec --user root "$SANDBOX_CTR" chmod 444 /sandbox/.openclaw/.config-hash
```

Check `/tmp/gateway.log` after upload and confirm the gateway hot-reloaded the provider or `agents.list` change.
Check `/tmp/gateway.log` after upload and confirm the gateway hot-reloaded the provider or `agents.list` change:

```bash
nemoclaw "$SANDBOX" logs --since 5m --tail 200
nemoclaw "$SANDBOX" agents list --json
```

Expected output:

```text
config change detected; evaluating reload (...)
config hot reload applied (...)
```

The `agents list` output should include `vision-operator`.

## Add Sub-Agent Credentials

Expand All @@ -90,6 +126,14 @@ For the Omni example:
```

Use the same provider ID that appears in `models.providers`, such as `nvidia-omni`.
Create `/tmp/auth-profiles.json` from `vlm-demo/vlm-subagent/auth-profiles.template.json`, replace `YOUR_NVIDIA_API_KEY_HERE` with the provider key, then upload it into the sandbox:

```bash
docker exec --user root "$SANDBOX_CTR" mkdir -p /sandbox/.openclaw/agents/vision-operator/agent
docker exec --user root -i "$SANDBOX_CTR" sh -c 'cat > /sandbox/.openclaw/agents/vision-operator/agent/auth-profiles.json' < /tmp/auth-profiles.json
docker exec --user root "$SANDBOX_CTR" chmod 600 /sandbox/.openclaw/agents/vision-operator/agent/auth-profiles.json
```

After uploading the auth profile, make sure the sandbox user owns the sub-agent directory:

```bash
Expand Down
Loading