What you will build
An authenticated OpenCode browser workspace operating on a disposable repository. You will reach it through an SSH tunnel, ask for one bounded change, and verify the diff and test result.
This guide teaches the underlying browser-agent pattern, not deployment of theLAB's private ADI Code configuration. Allow 1-2 hours. Model requests may be metered if you choose a hosted provider.
Before you start
Use an authorized Linux server or local machine, Git, a supported OpenCode release with opencode web, and access to a tool-capable model. Follow the official installer for your platform, inspect installation changes, then record:
opencode --version
opencode web --help
git --version
Do not expose the server to the Internet for this exercise. A browser coding agent can execute code with the privileges of its process. Run it under a non-administrator account without production keys, database credentials, or the Docker socket.
1. Make a disposable repository
Create a new agent-lab directory and initialize it:
git init
Create maths.py containing:
def double(value):
return value + 2
Create test_maths.py:
import unittest
from maths import double
class MathsTest(unittest.TestCase):
def test_double(self):
self.assertEqual(double(3), 6)
self.assertEqual(double(-2), -4)
Run python3 -m unittest -v; it should fail. Commit these files using your existing Git identity after reviewing the diff. Do not change global Git configuration merely to complete a lab.
2. Configure model access and permissions
Use the installed release's provider configuration or connection UI to select a model. Confirm where inference occurs before sharing source code. A local gateway may still route to a hosted model.
Review the release's permissions documentation. Require approval for risky commands, external directory access, and deployment actions. No prompt can enforce OS-level isolation; the operating-system account and sandbox are the real limits.
This guide intentionally avoids installing a shared permissive agent configuration or enabling unrestricted tool execution.
3. Start the browser service privately
From agent-lab, set a strong password without placing it in command history:
read -rsp 'Workspace password: ' OPENCODE_SERVER_PASSWORD
printf '\n'
export OPENCODE_SERVER_PASSWORD
opencode web --hostname 127.0.0.1 --port 4096
Keep that terminal open. In another terminal, an unauthenticated request to http://127.0.0.1:4096/global/health should be rejected. A normal authenticated browser visit should succeed. Verify behavior against your installed version rather than assuming the environment variable was accepted.
For remote use, run on your laptop:
ssh -N -L 4097:127.0.0.1:4096 user@your-authorized-server
Visit http://127.0.0.1:4097; the default Basic-auth username is opencode unless explicitly changed. The local HTTP connection is carried through authenticated SSH. Do not bind the service to every interface just to avoid using a tunnel.
4. Give one bounded task
Ask: "Fix double so it returns twice its input. Preserve the test expectations. Run python3 -m unittest -v. Do not install dependencies, commit, or touch files outside this repository."
Review each requested permission. After the response, independently run:
git status --short
git diff
python3 -m unittest -v
Checkpoint: the implementation multiplies by two, the tests pass unchanged, and no unrelated files changed. The agent saying that it ran tests is not a replacement for the observed result.
When it breaks
A connection error may belong to the SSH tunnel, browser port, Basic authentication, or provider; check each separately. If the agent cannot use tools, verify model compatibility before weakening permissions. If it edits tests to match a bug, reject that change and restore only your own disposable lab changes deliberately.
Cleanup
Stop the web process with Ctrl-C, close the SSH tunnel, and unset the password variable in the shell. Preserve the sample repository if useful. For durable operation, add a supervised service only after deciding authentication, filesystem boundaries, backups, and update policy.