# Agents

An agent is a program such as Claude Code or Codex that works on your servers through Valakes, using the same tools you would use, under rules you set.

Source: https://docs.valakes.com/agents/

Last updated: 2026-11-28

An agent is a program such as Claude Code or Codex that works on your servers through Valakes, using the same tools you would use, under rules you set. This page is about what an agent can do and how you stay in control. To connect one, see [Connecting an agent](https://docs.valakes.com/agents/claude-code/).

## What an agent is in Valakes

Each agent has its own name, an eight-character handle and its own token. You can pause, revoke or rotate each one separately. An agent talks to Valakes through the local API, which is off until you turn it on in Settings, **Agent API**, and listens on `127.0.0.1` only.

An agent reaches a server only through ten tools. Nothing it sends can change a policy, approve a request, read the audit log or reveal a credential, because there is no tool for any of that. Agents receive their own guide from Valakes automatically, so you do not paste instructions into a prompt.

The built-in assistant is also listed in the Agents panel, as "Built-in assistant" with a "Built in" badge. It is not an external agent and has no token. See [Built-in assistant](https://docs.valakes.com/assistant/).

Open the Agents panel with `Ctrl+Shift+J` (`Cmd+Shift+J` on macOS). The assistant is the other tab of the same dock, on `Ctrl+Shift+G` (`Cmd+Shift+G`).

## The ten tools

| Tool | What it does |
|---|---|
| `list_hosts` | Lists the hosts you opened to agents, with environment, tags and the agent's access level. Never returns credentials. |
| `open_session` | Opens an SSH session as a tab marked with the agent's name. An agent can never accept a host key: on a key that is not trusted yet, the call fails and Valakes closes that session. Open the host yourself once and trust its key, and then the agent can connect. |
| `close_session` | Closes a session the agent opened. It cannot close yours. |
| `run_command` | Runs one command line in a session and returns the exit code, directory, duration and output. |
| `read_output` | Reads the output of a command that same agent started, in pages. |
| `get_screen` | Returns the terminal screen as text, for full-screen programs. |
| `send_keys` | Sends keystrokes, such as `Ctrl+C`, arrow keys, or text to a program that is already running. |
| `list_credentials` | Lists the names of credentials bound to a host, and the placeholder to write. Never a value. |
| `upload_file` | Copies a file from your computer to a host. Needs a workspace folder and your approval. |
| `download_file` | Copies a file from a host into the agent's workspace folder. Needs a workspace folder and your approval. |

To use a credential, the agent writes `{{cred:name}}` and Valakes answers the prompt itself. The agent never sees the value, and output it reads has known values replaced by `***`. A credential can be used by an agent only if its binding has **Auto-fill** on and its value is at least 6 bytes long.

## Host policies

Every host starts with agent access **Off**. In the host editor, under **Agent access**, choose one of four levels. Choosing Approve writes or Full asks a native confirmation.

| Level | Runs without asking | Asks you | Refused |
|---|---|---|---|
| Off | Nothing. The host does not exist for the agent. | | |
| Read-only | Opening a session, commands from a fixed list of read commands, and `Ctrl+C` to its own running command | Downloads | Every other command and key, and uploads |
| Approve writes | Opening a session, read commands and `Ctrl+C` to its own running command | Every other command, other keys and file transfers | Keys sent at a shell prompt (the agent must use `run_command`) |
| Full | Commands of Low and Medium risk, and navigation keys | High-risk commands, keys that carry text, file transfers | Keys sent at a shell prompt (the agent must use `run_command`) |

Three rules hold on every level that lets the agent in:

- A command that changes how later commands run, such as `alias`, `source`, `export PATH=...` or a function definition, always asks (on Read-only it is refused). All commands of an agent share one interactive shell, and each is judged on its own text.
- A command that uses a credential on a production host, or a production credential on any host, always asks, even under Full, and on a production host a Medium command counts as High. See [Hosts and production marking](https://docs.valakes.com/hosts-and-production/).
- An agent never gets the **Run anyway** button of the risk card. High risk is approve or deny, and it is yours to decide.

Text sent with `send_keys` always asks under Approve writes and Full, because the program that receives it could be a nested shell or an editor with a shell escape, and the bytes would then be a command that never passed the check.

## Read-only is an allow-list, not a sandbox

Read-only runs only commands whose whole text matches a short list of read commands and flags (`ls`, `cat`, `head`, `tail`, `grep`, `find` without `-exec`, `ps`, `systemctl status` and a few more) with nothing that writes, redirects, expands or chains. It judges the text of one command. It does not know what a program does on the server.

So `cat ~/.ssh/id_ed25519`, `grep -r password /etc` and `journalctl` are all "read-only", and each hands whatever your SSH account can read to the agent, and through it to the agent's model provider. Aliases, functions and startup files on the server are outside the check.

For real protection, point the host at a restricted server user: an account that has no write access to anything that matters, no `sudo` and no keys or secrets in its home folder. The allow-list then limits what the agent asks for, and the account limits what it can do. Valakes shows this advice in the host editor, with a warning for anything above Read-only on a production host.

## Approvals

When a call needs you, it appears in the approval queue of the Agents panel, with the exact command, the host, the directory it will run in, the risk Valakes found and an estimate of the effect. The text on the card is Valakes' own record of the command, never text the agent wrote about it. You choose:

- **Approve** runs it once.
- **Deny** refuses it.
- **Take over** moves the command into your composer so you run it yourself. It never fills in credentials on its own, and an inline credential still needs a fresh confirmation.

An approval covers one command, in one session, in one directory, and works once. It no longer runs if anything changes while it waits: you change directory, enter a nested shell, close the session, lower the policy, pause or revoke the agent, use the kill switch or quit. Valakes also checks the state again right before it writes. If you do not answer, the request expires after the approval timeout in Settings, **Agent API** (300 seconds by default, between 30 and 1800). An agent can have 20 requests waiting at most.

## File transfer and the workspace folder

Both file tools work only inside the agent's **workspace folder**. Until you set one, they fail. In the Agents panel press **Choose folder** next to Workspace on the agent's card and confirm. Valakes refuses `/`, your home folder, the Valakes data folder and places where tokens and keys live, such as `~/.ssh` and `~/.aws`.

Both tools always wait for your approval. The card shows the local path, the remote path and, for an upload, the size and the SHA-256 of the file. An upload sends a private copy made when the request was created, so a file that changes after you looked at it changes nothing. A transfer is at most 100 MiB. A download lands in `downloads/` inside the workspace folder, never replaces a file and carries the download mark of your system. Files that an agent moves never appear in your own Files transfer list. They are in the approval queue, Recent calls and the audit log.

The built-in assistant has no file transfer at all.

## Pause, Pause all, Revoke and Rotate

- **Pause** on an agent's card makes its next call fail with "paused". Pause does not stop a command the agent already started, and its sessions stay open. The kill switch closes them. **Resume** undoes the pause. **Pause all agents** pauses every agent.
- **Revoke** ends an agent's access for good, after a confirmation. It cannot be undone.
- **Rotate access** makes a new token and stops the old one at once. The agent must be restarted to read the new token file.

## The kill switch

The **Kill switch** at the bottom of the Agents panel is one step that does all of this:

- turns the agent API off and stops the server, and keeps it off after a restart;
- cancels every pending approval;
- ends every share of a tab;
- closes the sessions that agents opened (your own tabs stay);
- pauses every agent, including the built-in assistant, and stops the assistant's current run;
- clears the list of values Valakes uses to hide secrets in agent output.

Tokens stay valid, but nothing listens. Turning the API on again asks for your confirmation, and you resume each agent by hand. **Pause all agents** is the milder version: it only pauses.

The kill switch does not undo what a command already did. A command started under `nohup` or in `tmux` on the server keeps running after its session closes. A process that runs as you on this computer can still read the token files, though it now has nothing to call. For that, revoke the agent. See [What does the kill switch stop, and what does it not?](https://docs.valakes.com/security-faq/#what-does-the-kill-switch-stop-and-what-does-it-not)

## Sharing a tab with an agent

An agent sees only the sessions it opened. To let it work in one of yours, press **Share with agent** on the tab (or right-click the tab and choose **Share with agent...**). A native dialog names the agent and warns that a shared session brings your shell state with it: the directory, a cached `sudo`, nested shells. The agent sees only text produced after the share. The share ends when you unshare, when the session closes or when you use the kill switch. The agent can use a shared tab but not close it.

## Recent calls and the audit log

The Agents panel lists **Recent calls**: the tool, the outcome, the host and the time. Click one for details.

Settings, **Audit log** lists everything agents did: every call, approval, command and transfer, with the agent, the host and the time, and never a secret. You can filter by agent or event. **Verify** checks the whole chain and says "Verified N entries" or "Chain broken". A broken chain shows a banner at every start until you press **Export and start a new segment**. The log is tamper-evident, not tamper-proof. See [What does the audit log prove?](https://docs.valakes.com/security-faq/#what-does-the-audit-log-prove)

## Limits

- One command at a time per session, at most 4 at a time per agent.
- At most 5 open sessions per agent, and about 20 requests per second per agent.
- A command waits up to 25 seconds for its result. After that, the agent reads the rest with `read_output`.
- Output pages are 32 KiB, and a key send is at most 4096 bytes.
