NaviGator AI

Install and configure Docker Sandboxes

Run OpenCode or pi in an isolated Docker sandbox connected to NaviGator AI Toolkit

Docker Sandboxes runs a coding agent inside a small virtual machine on your computer. The agent can edit files and run commands freely inside the sandbox, but it cannot reach the rest of your computer. Its network access is limited to the destinations you allow.

Your NaviGator AI Toolkit key never enters the sandbox. The agent sees a stand-in value, and Docker swaps in the real key only on requests to api.navigator.ai.ufl.edu.

What you need

  • Your NaviGator AI Toolkit key stored as shown in Store your key.
  • A free Docker account. Docker Desktop is not required.
  • One of these computers:
    • macOS 14 or later on Apple silicon
    • Windows 11 on an Intel or AMD processor
    • Ubuntu 24.04 or later with KVM virtualization turned on
  • A project in a Git repository.
  1. Install Docker Sandboxes

    brew trust docker/tap
    brew install docker/tap/sbx

    Sign in to Docker. The command opens a browser:

    sbx login
  2. Give sandboxes your key

    Register your key as a custom secret. The command reads the key from where you stored it each time a sandbox needs it, so the key never appears in the command, your shell history or the sandbox:

    sbx secret set-custom \
      --host api.navigator.ai.ufl.edu \
      --env NAVIGATOR_TOOLKIT_API_KEY \
      --command 'security find-generic-password -a "$USER" -s navigator-toolkit -w'

    Inside every sandbox, NAVIGATOR_TOOLKIT_API_KEY now holds a stand-in value that starts with sbx-cs-. When the agent sends a request to api.navigator.ai.ufl.edu, Docker replaces the stand-in with your real key on your computer.

    Custom secrets are an experimental Docker Sandboxes feature, so check this step after upgrading sbx.

  3. Allow NaviGator AI Toolkit on the network

    Choose a starting network policy, then allow the Toolkit address:

    sbx policy init balanced
    sbx policy allow network api.navigator.ai.ufl.edu

    Balanced allows common development services such as package registries. It blocks everything else. To see the rules, run sbx policy ls.

  4. Add the configuration to your project

    Sandboxes do not read your user-level configuration, such as ~/.config/opencode/opencode.json. Put the agent configuration in the project instead. Commit it, because a clone-mode sandbox sees only committed files.

    For OpenCode, save opencode.json at the project root. It is the same file as in Install and configure OpenCode:

    opencode.jsonOpenCode configuration for NaviGator AI Toolkit. Reads your key from NAVIGATOR_TOOLKIT_API_KEY.Download opencode.json
    git add opencode.json
    git commit -m "Add OpenCode configuration for NaviGator AI Toolkit"

    pi's configuration goes inside the sandbox instead. See Run pi.

Run OpenCode

From your project folder, create a sandbox and start OpenCode in it:

cd path/to/your-project
sbx run --name my-project opencode

The first run downloads the sandbox image, which takes a few minutes. OpenCode then opens as usual. Enter /models, confirm GPT OSS 120B under NaviGator AI Toolkit and ask a question that changes nothing:

Read this project and tell me what it does and how to run its tests. Don't change anything.

Quitting OpenCode leaves the sandbox in place. To return later, run sbx run --name my-project again. To pause it, run sbx stop my-project.

OpenCode Desktop runs on your computer, not in a sandbox. To sandbox your work, use OpenCode in the terminal as shown here.

Run pi

Docker Sandboxes has no built-in pi sandbox, so use a shell sandbox and install pi in it.

  1. Start a shell sandbox

    cd path/to/your-project
    sbx run --name my-project-pi shell

    You are now in a Bash shell inside the sandbox, in your project folder.

  2. Install and connect pi

    Inside the sandbox, install pi and add its NaviGator AI Toolkit configuration:

    npm install -g --ignore-scripts @earendil-works/pi-coding-agent
    mkdir -p ~/.pi/agent
    cat > ~/.pi/agent/models.json <<'EOF'
    {
      "providers": {
        "navigator": {
          "baseUrl": "https://api.navigator.ai.ufl.edu/v1",
          "api": "openai-completions",
          "apiKey": "$NAVIGATOR_TOOLKIT_API_KEY",
          "models": [
            { "id": "gpt-oss-120b", "name": "GPT OSS 120B", "reasoning": true, "input": ["text"], "contextWindow": 128000 }
          ]
        }
      }
    }
    EOF

    The sandbox keeps pi and this file until you remove it.

  3. Start pi

    pi

    Enter /model, select GPT OSS 120B under navigator and press Ctrl+S to make it your default. Then ask a question that changes nothing, as in Install and configure pi.

    To return later, run sbx run --name my-project-pi and start pi.

Choose how the sandbox sees your project

ModeHow to startWhat the agent changes
Direct (default)sbx run --name my-project opencodeYour project folder on your computer, live. Removing the sandbox does not undo changes
Clonesbx run --clone --name my-project opencodeA private Git clone inside the sandbox. Your project folder stays read-only to the agent

Choose the mode when you create the sandbox; it cannot change later. Clone mode starts from the commit checked out on your computer, so commit the configuration first. Create clone-mode sandboxes from the main checkout, not a linked Git worktree.

Basic use

CommandAction
sbxOpen the dashboard: every sandbox, its status and its network activity
sbx lsList sandboxes
sbx run --name NAMEReattach to a sandbox
sbx exec -it NAME bashOpen a shell in a running sandbox
sbx stop NAMEStop a sandbox and keep it for later
sbx rm NAMEDelete a sandbox and everything inside it
sbx policy lsShow network rules

In the dashboard, press Tab to see outbound connections and allow or block hosts. Press ? for shortcuts.

Get your work out before removing a sandbox

Direct mode: the changes are already in your project folder. Review them with git status and git diff.

Clone mode: the changes are in the sandbox's private clone. Ask the agent to commit them on a new branch, then, while the sandbox is still running, fetch the branch on your computer. Replace task-branch with the agent's branch and main with your base branch:

git fetch sandbox-my-project
git log --oneline sandbox-my-project/task-branch
git diff main...sandbox-my-project/task-branch

Uncommitted clone-mode changes cannot be fetched. Copy specific files out instead:

sbx cp my-project:/absolute/path/to/file ./sandbox-recovery/

When your work is safely on your computer, remove the sandbox:

sbx rm my-project

Removing a sandbox deletes everything inside it, including uncommitted clone-mode changes and the sandbox-my-project Git remote. Do not use sbx reset to clean up: it removes every sandbox, cached image and stored secret.

Work safely

  • The sandbox limits what the agent can reach, not what it gets wrong. Review every change with git diff before you keep it.
  • A direct-mode project folder is live. The agent can change or delete anything in it. Commit or stash your work before you start, or use clone mode.
  • Allow only the network destinations you need. Every allowed host can receive whatever the agent can read.
  • Do not give the sandbox other credentials, such as deployment or production keys, unless the task needs them.
  • Start read-only for unfamiliar projects: add the read-only profile to the project's opencode.json, or start pi with pi --tools read,grep,find,ls.

See Operate coding agents safely for the full operating loop.

Troubleshooting

ProblemWhat to do
Not authenticated to DockerRun sbx login
The model fails with an authentication errorRun sbx secret ls to check the custom secret exists for api.navigator.ai.ufl.edu, and check your key loads as shown in Store your key. Then remove the sandbox and create a new one, because sandboxes pick up new secrets only when they are created
The request is blocked by the network policyRun sbx policy allow network api.navigator.ai.ufl.edu
NaviGator AI Toolkit doesn't appear in OpenCodeCommit opencode.json at the project root. In clone mode, recreate the sandbox after committing
npm install fails in the pi sandboxCheck the network policy allows the npm registry. Balanced allows it by default
Linux: the sandbox doesn't startCheck that KVM is available and that you are in the kvm group, as in the Linux install step

References

On this page