Run a coding agent
Add the OpenCode coding agent to a running workstation, connect it to OpenRouter with your key, then give the agent a task.
Add the OpenCode coding agent to a running workstation, connect it to OpenRouter with your key, then give the agent a task.
The agent works inside the workstation, so it sees the files and tools you put there and none of the files on your own computer. It never sees your key: Ringleader adds the key to its requests after they leave the workstation.
Prerequisites
- Ringleader installed, with the Ringleader application running.
- The
my-opencode-boxworkstation from Build a workstation, running Debian 13 with the labelrole: agent. - An OpenRouter API key. A free OpenRouter account is enough.
Understand workstations and configurations
Ringleader keeps a workstation, what goes on it, and the services it uses in separate resources:
- A Workstation is the workstation
itself.
my-opencode-boxis one. - A WorkstationConfig is a set of contents and settings you can reuse: packages, development tools, ports, environment variables, and more.
- An Integration connects workstations to an outside service, such as OpenRouter, and adds the key the service needs, which it reads from a secret.
One configuration can apply to many workstations, and one workstation can take several configurations.
A configuration finds its workstations by label. This page uses the role: agent label
you gave my-opencode-box on the previous page, so the configuration reaches every
workstation that carries it, without editing each one.
Store your key
Save your OpenRouter key in Ringleader as a secret called openrouter-api-key.
Use the application
Run this command:
rl secret create openrouter-api-key -n local --from-string value=<your-openrouter-key>Use the command line
Run:
rl secret create openrouter-api-key -n local --from-string value=<your-openrouter-key>Ringleader keeps the value and masks it wherever it shows the secret. The integration you write next refers to the secret by name, so the key never appears in a file.
Add OpenCode to the workstation
Add a configuration that installs OpenCode, and an integration that adds your key to OpenCode’s requests.
Use the application
Use the Use the command line tab.
Use the command line
Create a file called opencode.yaml with a configuration and an integration. Both have a
selector that matches the role: agent label on my-opencode-box:
apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
name: opencode
namespace: local
spec:
selector:
matchLabels:
role: agent
devtools:
- name: nodejs
- name: opencode
environment:
OPENROUTER_API_KEY: not-the-real-key
---
apiVersion: workstations.ringleader.dev/v1
kind: Integration
metadata:
name: openrouter
namespace: local
spec:
type: httpProxy
selector:
ownerScope: true
matchLabels:
role: agent
httpProxy:
rules:
- host: openrouter.ai
inject:
header: Authorization
value: "Bearer ${secret:openrouter-api-key/value}"The first part of the file, the WorkstationConfig, says what to put on the workstation:
selector.matchLabelspicks the workstations the configuration applies to: every one labeledrole: agent, which includesmy-opencode-box.devtoolsinstalls Node.js and OpenCode. OpenCode installs through npm, which comes with Node.js.environmentsetsOPENROUTER_API_KEYto a stand-in,not-the-real-key, because OpenCode needs a value there before it sends a request.
The second part, the Integration, gives OpenCode access to OpenRouter:
type: httpProxymeans Ringleader adds a key to requests as they leave the workstation.selectorpicks the workstations the integration reaches.ownerScope: truelimits it to workstations you own, andmatchLabelsnarrows that to the ones labeledrole: agent.rulessays which requests get the key. On each request toopenrouter.ai, Ringleader replaces theAuthorizationheader withBearerand the value of youropenrouter-api-keysecret, so the stand-in never reaches OpenRouter.
Apply the file:
rl apply -f opencode.yamlRingleader installs the tools on the running workstation. It does not rebuild it, so the files you left there are still there.
Wait until the tools are installed, then until Ringleader is adding your key to requests:
rl workstation wait my-opencode-box --for condition=Configured --timeout 15m -n local
rl workstation wait my-opencode-box --for=EgressApplied --timeout 5m -n localGive OpenCode a task
Open a shell on the workstation. In the application, click the terminal button on its
card. On the command line, run rl shell my-opencode-box -n local. Then check which key
the workstation holds:
echo $OPENROUTER_API_KEYThe output is not-the-real-key. Start OpenCode:
opencodeIn OpenCode, type /models and choose an OpenRouter model. A free model is enough for
this task. Then give the agent its task:
Create hello.py that prints today's date, then run it.OpenCode writes hello.py and runs it. If it asks before it runs a command, allow it.
When you are done, leave OpenCode, then type exit to leave the shell.
And you’re done! You have a coding agent working in a workstation of its own.
Understand what happened
Applying opencode.yaml added the opencode configuration and the openrouter
integration. Their selectors matched the role: agent label on my-opencode-box, so
Ringleader installed Node.js and OpenCode on it and started adding your key to its
requests to OpenRouter.
How your key reached OpenRouter
rl secret createstored your key in Ringleader, under the nameopenrouter-api-key.- The integration refers to that secret by name, as
${secret:openrouter-api-key/value}, so the key is in none of your files. - OpenCode sent each request to
openrouter.aiwith the stand-in key,not-the-real-key, in itsAuthorizationheader. - As each request left
my-opencode-box, Ringleader replaced that header withBearerand your real key, and sent the request on to OpenRouter.
Nothing running in the workstation can read your key, the agent included. Ringleader holds the key on your computer, outside the workstation. To see what Ringleader adds to which requests, and on which providers it works, see Injected credentials. To see what else changes on a workstation once Ringleader adds a key, see Effects of injection on a workstation.
Optional: Clean up
Remove the configuration, the integration, the workstation and the secret that this quickstart created. Skip this section to keep using the workstation and its agent.
Use the application
On the workstation’s card, open the menu, choose Delete, and type my-opencode-box
to confirm.
Remove them from the command line. Type y
when rl asks you to confirm deleting the secret:
rl workstation delete -f opencode.yaml
rl secret delete openrouter-api-key -n localUse the command line
Delete the configuration and the integration, then the workstation, then the secret:
rl workstation delete -f opencode.yaml
rl workstation delete my-opencode-box -n local
rl secret delete openrouter-api-key -n localWith -f, rl workstation delete deletes everything the file declares, so the first
command removes both the configuration and the integration. The other two commands ask
you to confirm: type y each time.
Summary
Ringleader gave the agent a workstation that is secure, consistent and isolated:
- Your key stays secure. The workstation holds only
not-the-real-key, so the agent can’t print your key or send it anywhere. - Your setup stays consistent. The workstation’s own description and
opencode.yamlsay everything that is on it. Apply them on another computer, or give them to a teammate who stores their own key, and you get the same workstation. Label another workstation you ownrole: agentand it gets the same tools and the same access to OpenRouter. - The agent stays isolated. It works inside
my-opencode-box, so it sees only the files and tools you put there, and none of the files, repositories or credentials on your own computer. When you delete the workstation, its disk goes with it, along with every file the agent left there.
Next steps
- Coding agent setup says what each agent comes with, and how to start and sign in to it.
- LLM gateways for coding agents points the coding agents on every workstation you label at an LLM gateway.
- Stacks create a ready-made workstation with the tools and agent for one kind of work.
- Lock down Claude Code for unattended runs keeps your keys and your local network away from Claude Code, and sets a date when the workstation deletes itself.
- Run your own coding agent in Ringleader keeps an agent’s key off the workstation for any agent that sends it in a header.
- Run VS Code in a browser on a workstation builds a workstation with VS Code in your browser.