For the complete documentation index, see llms.txt. A markdown version of this page is at /quickstart/agent/index.md.

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

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-box is 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.matchLabels picks the workstations the configuration applies to: every one labeled role: agent, which includes my-opencode-box.
  • devtools installs Node.js and OpenCode. OpenCode installs through npm, which comes with Node.js.
  • environment sets OPENROUTER_API_KEY to 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: httpProxy means Ringleader adds a key to requests as they leave the workstation.
  • selector picks the workstations the integration reaches. ownerScope: true limits it to workstations you own, and matchLabels narrows that to the ones labeled role: agent.
  • rules says which requests get the key. On each request to openrouter.ai, Ringleader replaces the Authorization header with Bearer and the value of your openrouter-api-key secret, so the stand-in never reaches OpenRouter.

Apply the file:

rl apply -f opencode.yaml

Ringleader 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 local

Give 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_KEY

The output is not-the-real-key. Start OpenCode:

opencode

In 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

  1. rl secret create stored your key in Ringleader, under the name openrouter-api-key.
  2. The integration refers to that secret by name, as ${secret:openrouter-api-key/value}, so the key is in none of your files.
  3. OpenCode sent each request to openrouter.ai with the stand-in key, not-the-real-key, in its Authorization header.
  4. As each request left my-opencode-box, Ringleader replaced that header with Bearer and 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 local

Use 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 local

With -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.yaml say 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 own role: agent and 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