Agents
Weik.io 2026.2Enrol and revoke agents with the weikio CLI, and choose which deployments each one runs. Video
Watch: Sites and agents, 4:25
The video enrols an agent and runs its bundle on a host, then checks that the agent is online.
This part of the video couldn't be loaded.
On this page
- Commands on this page
- weikio agent enrol
- weikio get agents
- weikio describe agent
- weikio agent desired
- weikio agent status
- weikio agent diff
- weikio agent logs
- weikio agent set-capabilities
- weikio agent set-projects
- weikio agent drain
- weikio agent undrain
- weikio agent credentials
- weikio agent revoke
- weikio delete agent
- Exit codes
- See also
Use the commands on this page to enrol and manage the agents that run your integrations on hosts in your network, in your cloud or beside the hub. An agent connects to Weik.io with outbound connections on port 443 and opens no inbound port.
weikio agent enrol creates an agent and writes its one-time bundle. You copy the bundle to the agent’s host and install it with sudo sh ./setup.sh.
An agent runs the deployments that match the capabilities and projects you give it, and it can reach only the projects and environments it serves.
Commands on this page#
| Command | What it does |
|---|---|
weikio agent enrol |
Enrol an agent and write its one-time bundle. |
weikio get agents |
List the agents with their status and last sync. |
weikio describe agent |
Show an agent with the deployments it should run and what it last reported. |
weikio agent desired |
Print the deployments the agent should run. |
weikio agent status |
Print what the agent last reported. |
weikio agent diff |
Compare what the agent runs with its deployments. |
weikio agent logs |
Show the agent’s own log lines. |
weikio agent set- |
Replace an agent’s capabilities, such as its environments and gateways. |
weikio agent set- |
Replace the projects an agent may run. |
weikio agent drain |
Stop giving an agent new deployments while it keeps running what it has. |
weikio agent undrain |
Stop draining an agent. |
weikio agent credentials |
Issue a new bundle for an agent. |
weikio agent revoke |
Revoke an agent and stop everything it runs. |
weikio delete agent |
Delete a revoked agent. |
The tables below leave out the flags every command accepts, such as --env and --project, which the CLI reference lists.
weikio agent enrol#
Enrol an agent and write its one-time bundle. An agent that runs integrations needs at least one environment= capability.
The bundle has the agent’s credentials, so copy it to the agent’s host over a channel you trust.
weikio agent enrol <name> --host linux-compose|windows --capabilities k=v,... [--projects p1,p2] [--via public|hub-network] [--runs integrations|gateway|integrations,gateway] [--entrance NAME=ADDRESS:PORT ...] [--out DIR]| Argument or flag | What it does |
|---|---|
<name> |
Sets the agent’s name. |
--host <host> |
Sets the kind of host, linux- or windows. |
-- |
Sets the agent’s capabilities as k=v pairs, comma separated. The environment= pair can repeat. |
-- |
Sets the projects the agent may run, comma separated. The default is any project. |
--via <via> |
Sets how the agent connects to the hub, public or hub-, which is for an agent inside the hub’s network. The default is public when the installation has a public address for agents, and hub- otherwise. |
--runs <runs> |
Sets what the agent runs as integrations, gateway or integrations,gateway. The default is integrations. |
-- |
Adds an address that the gateway on the agent’s host listens on, as NAME=ADDRESS:PORT, such as lan=0.0.0.0:8443. Repeat it for each entrance. |
-d, --out, -- |
Writes the files into this folder. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: POST /api/v1/agents.
Also written as weikio agent enroll.
$ weikio agent enrol agent-fi-02 --host linux-compose --capabilities os=linux,region=fi,environment=devtest,environment=production --projects finance,sandbox --out ./sites/fi-02Target: https://hub.example
agent agent-fi-02 enrolled (id 01m7s6f3wy822rmd7s2w4291db; capabilities os=linux region=fi environment=devtest,production; projects finance, sandbox)
Wrote ./sites/fi-02/agent.env, agent.creds, leaf.conf, agent.nk, runtime.creds, hub-ca.crt, docker-compose.yaml, setup.sh, .env.
The bundle can't be downloaded again. If you lose it, issue a new one with:
weikio agent credentials 01m7s6f3wy822rmd7s2w4291db
Next steps:
1. Copy the folder to the site host:
scp -r ./sites/fi-02 site-host:
2. On the site host, run the setup script to install and start the agent:
cd fi-02 && sudo sh ./setup.sh
3. Check that the agent is online:
weikio get agents
4. Delete the folder on both machines once the agent is online: it contains the agent's credential.
5. To upgrade the site to a later release, run in the agent's installation folder:
sudo sh ./setup.sh --upgrade <the release's images.env>weikio get agents#
List the agents with their status and last sync.
weikio get agents [--env E] [--online|--offline] [--behind] [--draining]| Argument or flag | What it does |
|---|---|
-- |
Shows only online agents. |
-- |
Shows only offline agents. |
-- |
Shows only agents whose image or bundle is behind the hub’s release. |
-- |
Shows only draining agents. |
Who can run it: a platform administrator.
API: GET /api/v1/agents?environment=.
$ weikio get agentsNAME ID HOST RUNS STATUS CAPABILITIES PROJECTS VERSION BEHIND LAST SYNC RUNTIMES
agent-fi-01 01m7s6f0rf21dvj30rne9ra762 linux-compose integrations online os=linux environment=devtest any 2026.2.5 - 2s ago 2 running
agent-fi-02 01m7s6f3wy822rmd7s2w4291db linux-compose integrations online os=linux region=fi environment=devtest,production finance, sandbox 2026.2.5 - 2s ago 3 running
agent-hq-01 01m7s6f41hkytb0hx4mked8zyc linux-compose integrations offline os=linux environment=production finance - - - 0 running$ weikio get agents --drainingNAME ID HOST RUNS STATUS CAPABILITIES PROJECTS VERSION BEHIND LAST SYNC RUNTIMES
agent-fi-02 01m7s6f3wy822rmd7s2w4291db linux-compose integrations online, draining os=linux region=fi environment=production finance 2026.2.5 - 8s ago 1 runningweikio describe agent#
Show an agent with the deployments it should run and what it last reported.
weikio describe agent <id|name>| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
Who can run it: a platform administrator.
API:
GET /api/v1/agents/{id}GET /api/v1/agents/{id}/desiredGET /api/v1/agents/{id}/statusGET /api/v1/agents/{id}/diffGET /api/v1/apim/instances
$ weikio describe agent agent-fi-02Agent: agent-fi-02
ID: 01m7s6f3wy822rmd7s2w4291db
Host: linux-compose
Status: online
Environments: devtest, production
Capabilities: os=linux region=fi environment=devtest,production
Projects: finance, sandbox
Last sync: 2s ago
Version: 2026.2.5
Reaches the hub via: public
Hub addresses: wss://nats.hub.example:443
DEPLOYMENT DESIRED ACTUAL DIFF STOP DEADLINE
devtest/finance/erp-invoice-export 1.1.0 started 1.1.0 running (pid 213) in sync 70s (shutdownTimeout 45, extraShutdownTimeout 15 (Camel's defaults))
devtest/sandbox/hello 0.1.0 started 0.1.0 running (pid 263) in sync 70s (shutdownTimeout 45, extraShutdownTimeout 15 (Camel's defaults))
production/finance/erp-invoice-export 1.0.0 started 1.0.0 running (pid 306) in sync 70s (shutdownTimeout 45, extraShutdownTimeout 15 (Camel's defaults))
production/finance/nightly-payroll 1.0.0 stopped 1.0.0 stopped in sync -After weikio agent credentials, the output also has a Previous site bundle: line until the agent’s host runs the new bundle.
weikio agent desired#
Print the deployments the agent should run.
weikio agent desired <id|name>| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
Who can run it: a platform administrator.
API: GET /api/v1/agents/{id}/desired.
weikio agent status#
Print what the agent last reported.
weikio agent status <id|name>| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
Who can run it: a platform administrator.
API: GET /api/v1/agents/{id}/status.
weikio agent diff#
Compare what the agent runs with its deployments. The command exits 1 when what the agent runs differs from its deployments.
weikio agent diff <id|name>| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
Who can run it: a platform administrator.
API: GET /api/v1/agents/{id}/diff.
weikio agent logs#
Show the agent’s own log lines.
weikio agent logs <id|name> [-f|--follow] [--since] [--level] [--query Q] [--limit N] [--before ID | --after ID]| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
-f, -- |
Prints new lines as they arrive, until you press Ctrl-C. |
-- |
Sets how far back to read, such as 10m. |
-- |
Shows only lines at this level or above, one of trace, debug, info, warn, error or fatal. |
-- |
Searches the lines with a LogsQL filter, such as error AND "timeout". A | or # must be inside quotes. |
-- |
Sets how many lines to read, at most 5,000. |
-- |
Shows lines older than the one with this _id. |
-- |
Shows lines newer than the one with this _id. |
Who can run it: a platform administrator.
API: GET /api/v1/logs, GET /api/v1/logs/tail.
weikio agent set-capabilities#
Replace an agent’s capabilities, such as its environments and gateways. Only the kinds of capability you give pairs for change. The CLI prints the kinds that stay as they are. When the change re-issues the credential, the reply says that the agent still has its earlier credential, and that the deployments it can reach become fewer once it fetches the new credential and syncs.
weikio agent set-capabilities <id|name> k=v ...| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
<capabilities> |
Sets capabilities as k=v pairs. The environment= and gateway= pairs replace the agent’s environments and gateways. The other pairs replace its other capabilities. Give a key with no value to empty its list, as in gateway=. |
-y, --yes |
Skips the confirmation. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: PATCH /api/v1/agents/{id}.
$ weikio agent set-capabilities agent-fi-02 os=linux region=fi environment=productionTarget: https://hub.example
2 deployments leave the agent at its next sync: devtest/finance/erp-invoice-export, devtest/sandbox/hello.
Continue? [y/N] y
agent agent-fi-02 updated (capabilities os=linux region=fi environment=production, revision 125)weikio agent set-projects#
Replace the projects an agent may run. When the change re-issues the credential, the reply says that the agent still has its earlier credential, and that the deployments it can reach become fewer once it fetches the new credential and syncs.
weikio agent set-projects <id|name> p1,p2| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
<projects> |
Sets the projects the agent may run, comma separated. Give “” to allow any project. |
-y, --yes |
Skips the confirmation. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: PATCH /api/v1/agents/{id}.
$ weikio agent set-projects agent-fi-02 financeTarget: https://hub.example
agent agent-fi-02 updated (projects finance, revision 132)weikio agent drain#
Stop giving an agent new deployments while it keeps running what it has. To take its integrations off the agent, move or stop each one with the commands that weikio agent drain prints.
weikio agent drain <id|name> [-y]| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
-y, --yes |
Skips the confirmation. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: POST /api/v1/agents/{id}/drain.
$ weikio agent drain agent-fi-02Target: https://hub.example
Agent 'agent-fi-02' runs deployments in production environment 'production', which keep running while nothing new is placed on it.
Drain it? [y/N] y
agent agent-fi-02 draining (since 2026-11-19 06:07 UTC, revision 139)
New deployments aren't placed on it.
2 deployments keep running until you move or stop them:
production finance/erp-invoice-export (running 1.0.0) no other online agent can run it: a move stops it until one connects
To move it, run:
weikio deploy finance/erp-invoice-export --env production --version 1.0.0
To stop it instead, run:
weikio undeploy finance/erp-invoice-export --env production
production finance/nightly-payroll (stopped) no other online agent can run it: a move stops it until one connects
To move it, run:
weikio deploy finance/nightly-payroll --env production --version 1.0.0 --stopped
To stop it instead, run:
weikio undeploy finance/nightly-payroll --env productionweikio agent undrain#
Stop draining an agent.
weikio agent undrain <id|name>| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: POST /api/v1/agents/{id}/undrain.
$ weikio agent undrain agent-fi-02Target: https://hub.example
agent agent-fi-02 updated (draining cleared, revision 147)weikio agent credentials#
Issue a new bundle for an agent. Use it when a bundle is lost, or to change what the agent runs with --runs and --entrance. The previous bundle can’t connect to the hub any more, so the agent is offline until you install the new one with its setup.sh.
Weik.io still accepts telemetry sent with the previous bundle until the agent’s host runs the new bundle and has sent the telemetry it kept. Until then, you see a Previous site bundle: line in weikio describe agent and previous bundle still accepted on the agent’s page in the admin UI. If someone else may have the previous bundle, run weikio agent revoke. Revoking shuts the previous bundle out at once, but it also stops everything the agent runs.
weikio agent credentials <id|name> [--via public|hub-network] [--runs integrations|gateway|integrations,gateway] [--entrance NAME=ADDRESS:PORT ...] [--out DIR] [-y]| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
--via <via> |
Sets how the agent connects to the hub, public or hub-, which is for an agent inside the hub’s network. The default is how the agent connects now. |
--runs <runs> |
Sets what the agent runs as integrations, gateway or integrations,gateway. The default is what it runs now. |
-- |
Adds an address that the gateway on the agent’s host listens on, as NAME=ADDRESS:PORT, such as lan=0.0.0.0:8443. Repeat it for each entrance. |
-d, --out, -- |
Writes the files into this folder. |
-y, --yes |
Skips the confirmation. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: POST /api/v1/agents/{id}/credentials.
weikio agent revoke#
Revoke an agent and stop everything it runs. The agent can’t connect to the hub any more, and it stays listed, marked as revoked. A revoked agent can’t be brought back, so enrol a new one for the host.
weikio agent revoke <id|name> [-y]| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
-y, --yes |
Skips the confirmation. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: POST /api/v1/agents/{id}/revoke.
weikio delete agent#
Delete a revoked agent.
weikio delete agent <id|name> [-y]| Argument or flag | What it does |
|---|---|
<agent> |
Identifies the agent by its name or ID. |
-y, --yes |
Skips the confirmation. |
-- |
Stores a reason for the change with the audit record. |
Who can run it: a platform administrator.
API: DELETE /api/v1/agents/{id}.
Exit codes#
The codes match the exit code table in the CLI reference.
| Code | Meaning |
|---|---|
| 0 | The command succeeded. |
| 1 | The command stopped without making the change. |
| 2 | The command has a usage error. |
| 3 | Your key is missing, expired or revoked, or its access doesn’t cover the command. |
| 4 | What you named doesn’t exist. |
| 5 | The change conflicts with another change. |
| 6 | Weik.io couldn’t be reached or wasn’t ready, or it was rate limiting your calls or out of storage. Run the command again later. |
| 8 | A document isn’t valid. |