Pi
An agent that runs Kaio is a gateway that lives on the host and answers from a chat. Pi is the other kind: a coding agent in your terminal, started when you need it, gone when you close it. It speaks MCP out of the box, so it reaches Kaio the same way, with a credential and a level of its own instead of yours.
It needs Kaio behind a proxy that names its callers, as in SSO for people, a credential for machines.
1. Give Pi a credential
Section titled “1. Give Pi a credential”Add a pi line to the basic_auth block of the machine name, next to ci
and agent:
openssl rand -hex 32 > pi.passwordcaddy hash-password --plaintext "$(cat pi.password)" basic_auth { ci $2a$14$8rC1sKpQ2mWdF4yT6uVbXeJ9nL0pR3hG5kD7fA1cZ8oY2vB6mN4qS agent $2a$14$Q1c9kPz7mN3vB5xR8tY2uW4eL6oA0sD3fG5hJ7kL9zX1cV3bN5mQ2 pi $2a$14$... }The proxy hands it the group machine-pi. Map that group to read:
KAIO_GROUPS_READ=kaio-viewers,machine-agent,machine-piKAIO_MCP=writeKAIO_MCP_ALLOWED_HOSTS=kaio-api.example.netCheck it before handing it over:
KAIO_ADDR="https://pi:$(cat pi.password)@kaio-api.example.net" kaio-cli whoami2. Point Pi at Kaio
Section titled “2. Point Pi at Kaio”Install Pi on your workstation, sign in to a model provider with /login or
ANTHROPIC_API_KEY, then keep the credential in an environment variable:
curl -fsSL https://pi.dev/install.sh | shexport KAIO_PI_AUTH="$(printf 'pi:%s' "$(cat pi.password)" | base64 -w0)"Pi reads its MCP servers from ~/.pi/agent/mcp.json, and expands ${NAME} in
a header from the environment, so the file itself holds no secret:
{ "mcpServers": { "kaio": { "url": "https://kaio-api.example.net/mcp", "headers": { "Authorization": "Basic ${KAIO_PI_AUTH}" }, "description": "The Docker host: stacks, logs, images, CVEs, versions", "exposure": "direct" } }}exposure: direct declares each Kaio tool to the model like a built-in one,
which suits a server with a few dozen tools at most. Check the connection
without starting a session:
pi mcp listkaio: connected, 11 tools (direct, global) https://kaio-api.example.net/mcp tools: kaio_image_vulnerabilities, kaio_images, kaio_logs, kaio_networks, kaio_nodes, kaio_overview, kaio_stack, kaio_stack_compose, kaio_stack_plan, kaio_stack_versions, kaio_volumesThe model sees them as mcp__kaio__kaio_overview and so on. Kaio does not
list a rung the credential was not granted, so nothing that writes shows up.
3. Keep it to Kaio
Section titled “3. Keep it to Kaio”Pi starts with read, bash, edit and write. With bash, the agent can
run anything your shell can, kaio-cli with your own KAIO_ADDR included,
and the level of its credential stops meaning much. When the task is the
host, start it with Kaio’s tools and nothing else:
pi --tools 'mcp__kaio__*'A --tools entry starting with mcp__ makes the list an allowlist for MCP
tools too, so this session holds Kaio’s tools alone: no shell, no file on your
disk.
4. Ask it things
Section titled “4. Ask it things”- Which stacks are not fully up, and why?
kaio_overview, thenkaio_logson the stack it names. - Which images have critical CVEs, and which stacks use them?
kaio_images, thenkaio_image_vulnerabilities. - Diff the blog stack’s last two versions.
kaio_stack_versions, thenkaio_stack_composeon each.
Pi has no plan mode and no sub-agents, and asks before nothing: it runs the
tool it picks. At read that costs nothing, since no tool it can see writes.
5. A report every morning
Section titled “5. A report every morning”pi -p runs a prompt, prints the final answer and exits, which makes the same
question a cron job. Cron’s PATH rarely holds Pi, so give its full path, as
command -v pi prints it:
KAIO_PI_AUTH=cGk6...ANTHROPIC_API_KEY=sk-ant-...PI=/home/you/.local/bin/pi0 7 * * 1-5 $PI mcp list >/dev/null && $PI -p --model anthropic/claude-sonnet-5-5 --tools 'mcp__kaio__*' "Report on the Docker host in ten lines: stacks not fully up and why, pending updates, critical CVEs and the stacks they touch. Say so in one line if everything is fine." | mail -s "kaio" ops@example.netThe pi mcp list in front is not decoration. When the server cannot be
reached, or KAIO_PI_AUTH is missing, pi -p still runs and exits 0, with
no Kaio tool at all, and the model writes a report anyway from nothing. pi mcp list exits 1 instead, so no mail goes out and cron reports the error.
--mode json writes the whole run as JSONL events instead, every tool call
and its answer, for a pipeline that wants to keep them.
6. Let it act
Section titled “6. Let it act”When its answers have been right for long enough, move machine-pi from
KAIO_GROUPS_READ to KAIO_GROUPS_WRITE. Pi then sees the write tools on
its next connection, and toolExposure decides which of them it may reach:
{ "mcpServers": { "kaio": { "url": "https://kaio-api.example.net/mcp", "headers": { "Authorization": "Basic ${KAIO_PI_AUTH}" }, "exposure": "direct", "toolExposure": { "kaio_stack_deploy": "hidden", "kaio_stack_copy": "hidden", "kaio_stack_env": "hidden", "kaio_stack_apply": "hidden" } } }}That leaves updates, rollbacks, restarts and scans, and keeps out every tool
that brings up a Compose file the agent wrote. hidden is Pi’s side of the
ladder, the way tools.include is for Hermes: Kaio decides what the
credential may call, Pi what the model is even offered.
Now check every stack for updates, show me what each would change, and apply
the patch releases is a task Pi carries out, and it fits in a pi -p too:
kaio_stack_plan lays out each update first, and kaio_stack_update with
wait: true answers only once the stack is up and healthy again, and puts back
the images it ran before when it does not get there.
7. Read what it did
Section titled “7. Read what it did”Every write call lands in the audit log
under pi, refused ones included:
kaio-cli audit --limit 50To take it back, move machine-pi back to KAIO_GROUPS_READ, or delete its
line in the proxy to cut it off. Nothing on your workstation has to change for
either to hold.
Kaio, built by Régis Gaidot