Guide7 min read
Run your team's AI tools inside your own network
A Zenitya runner is one Linux machine on your network that runs a project's tool calls, so agents can read Cloud Logging with a VM's service account or query a database behind your VPN, without a key ever leaving your infrastructure.
Jakub KotowskiCo-founder, Zenitya
The tools a team wants most often need something that lives inside its own network: the production logs, the orders database, an internal admin API. A tool that runs in someone else's cloud can only reach those if you open a hole for it or hand it a long-lived key. We did not want either, so we built runners.
A runner is one Linux machine on your network that runs a project's tool calls instead of Zenitya's cloud. It opens one outbound connection to Zenitya and needs no inbound port. Agents call the tools exactly as before, over the same MCP connection. Below are two setups we use: reading Cloud Logging from a Google Cloud VM with its service account and no key, and querying a Postgres database that only your VPN reaches.
How a runner works
Builds still happen on Zenitya. When a project moves to a runner, each of its calls is sent to the machine as a job signed with a key the runner release pins, and the runner checks the signature and the artifact's hash before anything runs. Each call then runs in its own gVisor sandbox with its own network, and is destroyed when the call ends.
The machine has the last word. Its policy file, /etc/zenitya-runner/config.yaml, lists which projects it runs, which networks and host names their calls may reach, and which local secrets they get. Zenitya can only send calls that file accepts and can never change it. Everything else is closed to a call: the internet, the machine itself, other calls, cloud metadata and IPv6, unless a rule or an explicit opt-in says otherwise.
Install a runner
Create a runner on the Runners page of the Zenitya app. It shows an install command with a single-use token, valid for 15 minutes. Run it as root on the machine:
curl -fsSL https://zenitya.dev/runner/install.sh | sudo sh -s -- --token zrt_…
sudo zenitya-runner statusThe installer verifies the release's signature, generates a machine key that never leaves the machine and starts the service. The runner keeps itself up to date and lets running calls finish before it restarts into a new release.
Read Cloud Logging with the VM's service account
Agents are good at triaging errors, if they can see them. On Google Cloud, the cleanest credential for that is the one you never copy: a VM's service account. Give the service account read access to logs and start a small VM with it:
gcloud iam service-accounts create zenitya-runner --display-name "Zenitya runner"
gcloud projects add-iam-policy-binding acme-prod \
--member serviceAccount:zenitya-runner@acme-prod.iam.gserviceaccount.com \
--role roles/logging.viewer
gcloud compute instances create zenitya-runner \
--zone europe-west1-b --machine-type e2-small \
--image-family ubuntu-2404-lts-amd64 --image-project ubuntu-os-cloud \
--service-account zenitya-runner@acme-prod.iam.gserviceaccount.com \
--scopes cloud-platformThe cloud-platform scope is what Google recommends: the token may call any API, and IAM decides what it can actually do, here only read logs. The VM needs no firewall rule, since the runner only connects out. Install the runner on it with the command above, then tell it which project gets the VM's credentials:
projects:
- a7e1d5fb-80aa-412a-8f53-c58a169ee47a # ops-tools
gcpCredentials:
- a7e1d5fb-80aa-412a-8f53-c58a169ee47a
egress:
- host: logging.googleapis.com
ports: [443]Calls normally cannot reach the metadata server at 169.254.169.254, where Google's client libraries find a VM's credentials. For the projects in gcpCredentials, the runner answers that address itself and passes on only the service account's tokens and the project ID. SSH keys, startup scripts and every other instance attribute stay out of reach, and every other project's calls still find nothing there. So the tool needs no secret at all:
import { Project } from "@zenitya/sdk";
import { s } from "@zenitya/sdk/schema";
import { GoogleAuth } from "google-auth-library";
const project = new Project();
export default project;
// The runner VM's service account, found by the client library.
const auth = new GoogleAuth({ scopes: "https://www.googleapis.com/auth/logging.read" });
project.tool("recentErrors", {
title: "Recent errors",
description: "Error log entries from production, newest first.",
schema: s.object({
hours: s.integer().describe("How far back to look, 1 to 24."),
limit: s.integer().describe("At most this many entries, 1 to 50."),
}),
outputSchema: s.array(
s.object({ timestamp: s.datetime(), severity: s.string(), message: s.string() }),
),
hints: { readOnlyHint: true, idempotentHint: true },
execute: async ({ hours, limit }, { signal }) => {
const since = new Date(Date.now() - Math.min(hours, 24) * 3_600_000).toISOString();
const client = await auth.getClient();
const { data } = await client.request<{ entries?: LogEntry[] }>({
url: "https://logging.googleapis.com/v2/entries:list",
method: "POST",
data: {
resourceNames: [`projects/${await auth.getProjectId()}`],
filter: `severity>=ERROR AND timestamp>="${since}"`,
orderBy: "timestamp desc",
pageSize: Math.min(limit, 50),
},
signal,
});
return (data.entries ?? []).map((entry) => ({
timestamp: entry.timestamp,
severity: entry.severity,
message: entry.textPayload ?? JSON.stringify(entry.jsonPayload ?? null),
}));
},
});
interface LogEntry {
timestamp: string;
severity: string;
textPayload?: string;
jsonPayload?: unknown;
}Deploy it with zya deploy, move ops-tools to the runner under Runs on on the project's page, and grant ops-tools.recentErrors to the group that handles incidents. An agent asked why checkout failed this morning can now read the errors itself, with exactly the access you gave one service account, and that account's credentials never leave Google Cloud.
Query a database behind your VPN
The second setup is the most common one: a Postgres database on a private network, reachable only over the company VPN. Put the runner on any Linux machine that is on that network, such as a small server in the office or a VM that joins the VPN, and allow exactly the database's address and port:
projects:
- 4c3f0a8e-2b1d-4e5f-9a6b-7c8d9e0f1a2b # order-tools
egress:
- cidr: 10.20.0.15/32 # orders database
ports: [5432]
secrets:
ORDERS_DB_PASSWORD: { env: ORDERS_DB_PASSWORD }The password is a local secret. It lives in /etc/zenitya-runner/environment, a file only root can read, and Zenitya never sees it: the runner adds it to the call's environment on the machine and masks it in the tool's logs and errors before the result leaves. Give the tool a role that can only read what it needs.
echo 'ORDERS_DB_PASSWORD=…' | sudo tee -a /etc/zenitya-runner/environment > /dev/null
sudo systemctl restart zenitya-runnerThe tool connects as if it ran next to the database. Deployed tools run on Bun, so its built-in Postgres client is enough:
import { Project } from "@zenitya/sdk";
import { s } from "@zenitya/sdk/schema";
import { SQL } from "bun";
const project = new Project();
export default project;
const db = new SQL(
`postgres://tools_readonly:${encodeURIComponent(process.env.ORDERS_DB_PASSWORD ?? "")}@10.20.0.15:5432/orders`,
);
project.tool("lateOrders", {
title: "Late orders",
description: "Orders past their promised delivery date, oldest first.",
schema: s.object({
limit: s.integer().describe("At most this many orders, 1 to 50."),
}),
outputSchema: s.array(
s.object({ id: s.integer(), customer: s.string(), promisedAt: s.datetime() }),
),
hints: { readOnlyHint: true, idempotentHint: true },
execute: async ({ limit }) => {
const rows: { id: number; customer: string; promised_at: Date }[] = await db`
select id, customer, promised_at
from orders
where delivered_at is null and promised_at < now()
order by promised_at
limit ${Math.min(limit, 50)}`;
return rows.map((row) => ({
id: row.id,
customer: row.customer,
promisedAt: row.promised_at.toISOString(),
}));
},
});Nothing else on that network is reachable from the call, not even the runner machine. If the tool tries another host, the connection is refused, and the call's event in sudo zenitya-runner logs says what it reached for.
What we chose not to do
- No inbound connections. The runner dials out over HTTPS, so it works behind NAT and needs no firewall change.
- No fallback. If the runner is offline, the call fails with runner_unavailable instead of quietly running in our cloud.
- No pools. One runner is one machine with its own key. A second machine is a second runner, so a leaked token cannot add one silently.
- No remote control of the policy. We show the policy the runner reports on its page, and only someone with root on the machine can change it.
Do agents need anything new to use tools on a runner?
No. Agents call the same MCP endpoint with the same groups. Only where the calls run changes.
Can a tool on a runner reach the internet?
Only the hosts and networks the runner's policy lists. A project's network.allowEgress setting does not apply on a runner.
Does Zenitya ever see local secrets or the VM's credentials?
No. Local secret values and the service account's tokens stay on the machine. Zenitya sees only the names of local secrets and which projects get Google Cloud credentials.
What does a runner need?
A Linux machine, amd64 or arm64, with systemd, nftables and cgroup v2, root on it, and outbound HTTPS to api.zenitya.com and zenitya.dev.
Further reading
- Zenitya docs: Running tools on your network
- Zenitya docs: Runner reference
- Google Cloud: Application Default Credentials
- Google Cloud: Service accounts for Compute Engine
- gVisor: What is gVisor?
Jakub Kotowski is a co-founder and engineer at Zenitya, building the infrastructure that shares tools and skills across a whole team, in any agent or harness.
Jakub Kotowski on LinkedIn
zenitya