Run your own coding agent in Ringleader
Install a command-line coding agent on a workstation and give it its API key without storing the key there.
Install a command-line coding agent on a workstation and give it its API key without storing the key there. You want this for an agent that Ringleader does not configure, such as Aider, Gemini CLI or Goose, or one you wrote. It also fits Cursor CLI and Antigravity CLI, which Ringleader installs without configuring. The steps work for an agent that sends its key in a header over HTTPS to a fixed host. The examples use Gemini CLI, but it is only an example: replace its package, command, host and header with your agent’s.
Prerequisites
- Install Ringleader, with the Ringleader application running.
- A running workstation in the namespace
localthat you own. The examples use a workstation namedmy-agent-box; replace it with yours. To create one, follow the Quickstart and use your own name. A cloud workstation needs an Edge in its namespace, and these examples do not cover it. - Your agent’s package name, the command it provides, and the host, header and variable it
uses for its API key. The agent’s own documentation lists them. The examples use the npm
package
@google/gemini-cli, the commandgeminiand the variableGEMINI_API_KEY. They use the hostgenerativelanguage.googleapis.comand the headerx-goog-api-key, as Gemini CLI and the Gemini API document them. - The agent’s API key, which the examples call
<your-api-key>.
Install the agent
A WorkstationConfig installs the agent as a package on every workstation with a label. It also sets the variable the agent reads for its key to a stand-in value, because the agent expects one.
Add a label that selects the workstation. The examples use
role: agent:rl workstation label my-agent-box role=agent -n localSave this file as
my-agent.yaml. Changerole: agentto your label:apiVersion: workstations.ringleader.dev/v1 kind: WorkstationConfig metadata: name: my-agent namespace: local spec: selector: matchLabels: role: agent devtools: - name: nodejs # installs Node.js 24, which an npm package needs packages: - type: npm # pypi or mise for an agent that is not on npm name: "@google/gemini-cli" # the example agent: replace it with yours bin: gemini # the command the package must provide environment: GEMINI_API_KEY: not-the-real-keyRun
rl apply -f my-agent.yaml. Ringleader then installs the agent on every workstation labeledrole: agent.Wait until the installation finishes:
rl workstation wait my-agent-box --for condition=Configured --timeout 15m -n local
bin applies to npm only. For a PyPI package, remove it and name the package, as in
type: pypi, name: aider-chat, and the command aider. Ringleader skips any version
published in the last 24 hours, as Package installation
describes. Packages and repositories
lists the package types and their fields.
An agent such as Goose is neither on npm nor on PyPI. Install it with a setup script, as Run a setup script shows.
Keep the agent’s key off the workstation
Ringleader adds the real key to each request as it leaves the workstation, so the agent holds only the stand-in value. Whenever Ringleader withholds the key, the stand-in reaches the API instead. It does so, for example, when another person owns the workstation.
Store the key in a Secret:
rl secret create gemini-api-key -n local --from-string token=<your-api-key>Save this file as
my-agent-key.yaml. Changerole: agentto your label, and the host and header to your agent’s:apiVersion: workstations.ringleader.dev/v1 kind: Integration metadata: name: my-agent-key namespace: local spec: type: httpProxy selector: ownerScope: true matchLabels: role: agent httpProxy: rules: - host: generativelanguage.googleapis.com inject: header: x-goog-api-key value: "${secret:gemini-api-key/token}"Run
rl apply -f my-agent-key.yaml.Wait until your computer’s network process holds the new rule:
rl workstation wait my-agent-box --for=EgressApplied --timeout 5m -n localOpen a shell with
rl shell my-agent-box -n local.Start the agent with the command from the first task, such as
gemini. Ringleader adds the key to its requests to the host, although the workstation holds onlynot-the-real-key.
Gemini CLI reads GOOGLE_API_KEY before GEMINI_API_KEY, so do not set both. If the agent asks
how to authenticate, choose its API key option.
Any header name works except Host. Text around the Secret reference is kept, so a scheme
prefix such as Bearer goes in the value. Ringleader replaces a header of that name
that the agent sent. For an agent that takes Basic authentication, see
Inject a key for a service that takes Basic authentication.
Ringleader decrypts the traffic to a host a rule names. It installs its certificate in the
system trust store. It also sets SSL_CERT_FILE, CURL_CA_BUNDLE, REQUESTS_CA_BUNDLE,
GIT_SSL_CAINFO, CARGO_HTTP_CAINFO and NODE_EXTRA_CA_CERTS on a Debian, Ubuntu or Alpine
workstation. A login shell, an SSH command and a Ringleader agent session get these variables.
A systemd service or cron job does not, so set SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
in its unit. An agent built on Node.js, Python, Go, curl or git then needs no other setup.
Effects of injection on a workstation
says what else changes.
Optional: Use your team’s LLM gateway
An LLM Integration delivers the gateway’s address and key onto every workstation it reaches, as environment variables for any agent to read. This section is for an agent that talks to your team’s LLM gateway instead of to its vendor. It replaces the previous task for that agent, because the gateway key is then on the workstation.
- Apply an
llmIntegration for the gateway, as Connect a coding agent to an LLM gateway shows. - Open a new shell with
rl shell my-agent-box -n localand read/etc/ringleader/integrations/<integration-name>.json. Itsenvironmentlist names the variables the agent reads.
The endpoint files describes each key. The provider file describes the OpenAI-style address that some vendors add.
The agent must read these values itself. Ringleader configures only the agents it supports, which Supported agents lists.
Optional: Give the agent MCP servers
An Integration that registers an MCP server writes the server’s name and address to
/etc/ringleader/mcp/<integration-name>.json on every workstation it reaches, whether or not a
supported agent is installed. An agent that can read the file connects to the server itself.
- Register the server in
injectedmode, as Register an MCP server with the key kept off the workstation shows. - Open a new shell with
rl shell my-agent-box -n localand runcat /etc/ringleader/mcp/<integration-name>.json. The file holdsnameandurl, and no header and no key. - Set the agent to call that
urlwith no credential. Ringleader adds the key to each request as it leaves the workstation.
Do not use local mode for an agent Ringleader does not configure. In that mode the file’s
value is a ${secret:…} reference that nothing on the workstation resolves.
Injected and local modes
says where each mode adds a key.
Optional: Sign in with a browser
An agent that signs in through a browser needs the setup in Sign in to a tool from a workstation. Follow that guide to turn on URL forwarding for the workstation, then approve the sign-in link on your computer.
Check what the agent reaches
Confirm that Ringleader adds the key, and see which hosts the agent calls.
- On your computer, run
rl integration describe my-agent-key -n local. The Credential injection section readsInjectingfor the host. - After the agent has made a request, run
rl workstation egress my-agent-box --credentials -n local. The output lists the host and its request count. New records can take a few minutes to appear.
To find every host the agent calls, set enforcement: audit on the workstation first. Then
follow Workstation reach audit to record
the hosts, and list the ones that need rules.
Troubleshoot
If the agent fails with a certificate error, it ignores the six certificate variables or checks for one fixed certificate. A Java keystore,
aptand Rust’swebpki-rootsdo this. Add the host toexclude, as Exclude a host from decryption shows. Ringleader then adds no key to that host, so the agent needs its real key another way.If the API answers
401, Ringleader is not adding the key. Read the Credential injection section ofrl integration describe my-agent-key -n local. Reasons a host is not injected says what to do for each reason.If the agent ignores an environment variable, set the value in the agent’s own settings file. Add a
filesentry to the WorkstationConfig, as Files describes:files: - path: ~/.config/my-agent/settings.json content: '{"apiKey": "not-the-real-key"}'If the agent refuses the stand-in as malformed, use a value in the shape the agent expects, with the same prefix and length as a real key.
If the API rejects the stand-in, the agent may send its key in a URL parameter or a body. Ringleader replaces a header only, so the stand-in reaches the API. Gemini’s REST
?key=form is one example.If the connection fails for another reason, check the limits. A rule names one exact host, with no wildcard or IP address, and an Integration takes 32 rules. Only HTTPS on port 443 is decrypted, so a client that speaks only HTTP/2 fails. Ringleader cannot inject a signed request such as AWS SigV4, an SSH key, a gRPC credential or a database key. Injection fields and Effects of injection on a workstation say more.
If a host reports
DaemonPlacementNotAllowed, you do not own the workstation, or someone else applied the Integration. Apply it yourself on a workstation you own. Reasons a host is not injected has the other reasons.If a shell does not show a new variable, it is older than the change. Open a new shell.
Next steps
- Supported agents says which agents Ringleader installs and configures, and what an agent loses without that support.
- Injected credentials says which hosts and headers Ringleader can add a key to.
- LLM gateways for coding agents explains the two ways to connect an agent to a gateway.
- MCP servers for coding agents explains the modes of an MCP server.
- Lock down Claude Code for unattended runs shows the same ideas for Claude Code: allowed hosts, keys held by Ringleader and a deadline.