Skip to content
Weik.ioDocs
2026.2
Try Weik.io

Agents

Weik.io 2026.2

Enrol 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.

On this page

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-capabilities Replace an agent’s capabilities, such as its environments and gateways.
weikio agent set-projects 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.

Terminal
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-compose or windows.
--capabilities <capabilities> Sets the agent’s capabilities as k=v pairs, comma separated. The environment= pair can repeat.
--projects <projects> 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-network, 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-network otherwise.
--runs <runs> Sets what the agent runs as integrations, gateway or integrations,gateway. The default is integrations.
--entrance <entrance> 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, --out-dir <out-dir> Writes the files into this folder.
--reason <reason> 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.

Terminal
$ weikio agent enrol agent-fi-02 --host linux-compose --capabilities os=linux,region=fi,environment=devtest,environment=production --projects finance,sandbox --out ./sites/fi-02
You see
Target: 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.

Terminal
weikio get agents [--env E] [--online|--offline] [--behind] [--draining]
Argument or flag What it does
--online Shows only online agents.
--offline Shows only offline agents.
--behind Shows only agents whose image or bundle is behind the hub’s release.
--draining Shows only draining agents.

Who can run it: a platform administrator.

API: GET /api/v1/agents?environment=.

Terminal
$ weikio get agents
You see
NAME          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
Terminal
$ weikio get agents --draining
You see
NAME          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 running

weikio describe agent#

Show an agent with the deployments it should run and what it last reported.

Terminal
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}/desired
  • GET /api/v1/agents/{id}/status
  • GET /api/v1/agents/{id}/diff
  • GET /api/v1/apim/instances
Terminal
$ weikio describe agent agent-fi-02
You see
Agent:                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.

Terminal
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.

Terminal
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.

Terminal
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.

Terminal
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, --follow Prints new lines as they arrive, until you press Ctrl-C.
--since <since> Sets how far back to read, such as 10m.
--level <level> Shows only lines at this level or above, one of trace, debug, info, warn, error or fatal.
--query <query> Searches the lines with a LogsQL filter, such as error AND "timeout". A | or # must be inside quotes.
--limit <limit> Sets how many lines to read, at most 5,000.
--before <before> Shows lines older than the one with this _id.
--after <after> 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.

Terminal
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.
--reason <reason> Stores a reason for the change with the audit record.

Who can run it: a platform administrator.

API: PATCH /api/v1/agents/{id}.

Terminal
$ weikio agent set-capabilities agent-fi-02 os=linux region=fi environment=production
You see
Target: 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.

Terminal
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.
--reason <reason> Stores a reason for the change with the audit record.

Who can run it: a platform administrator.

API: PATCH /api/v1/agents/{id}.

Terminal
$ weikio agent set-projects agent-fi-02 finance
You see
Target: 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.

Terminal
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.
--reason <reason> Stores a reason for the change with the audit record.

Who can run it: a platform administrator.

API: POST /api/v1/agents/{id}/drain.

Terminal
$ weikio agent drain agent-fi-02
You see
Target: 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 production

weikio agent undrain#

Stop draining an agent.

Terminal
weikio agent undrain <id|name>
Argument or flag What it does
<agent> Identifies the agent by its name or ID.
--reason <reason> Stores a reason for the change with the audit record.

Who can run it: a platform administrator.

API: POST /api/v1/agents/{id}/undrain.

Terminal
$ weikio agent undrain agent-fi-02
You see
Target: 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.

Terminal
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-network, 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.
--entrance <entrance> 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, --out-dir <out-dir> Writes the files into this folder.
-y, --yes Skips the confirmation.
--reason <reason> 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.

Terminal
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.
--reason <reason> 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.

Terminal
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.
--reason <reason> 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.

See also#

Sign in to the live demo

Sign in with the shared viewer account. It can open every screen of the example projects but can't change anything.

E-mail
viewer@demo.weik.io
Password
try-weikio-live-demo
Open the live demo