VirtuAI CLI
The VirtuAI CLI (virtuai) connects a terminal to your workspace. With it you can:
- chat with an agent in an interactive terminal app built for programming (
virtuai chat). See Terminal chat. - send one-off prompts from scripts and pipes (
virtuai ask) - run a local runner, so deep agents run their shell commands and file edits on your machine instead of a cloud sandbox (
virtuai run) - run an agent’s model on your machine with Ollama or oMLX, on every channel. See Local models.
The agent itself runs on VirtuAI. Only its command and file tools, and a local model if you use one, run on your machine.
Before you start
Section titled “Before you start”- Python 3.11 or newer. The current CLI version is 1.0.30. To let agents work on your computer without installing Python, use VirtuAI Desktop instead: it has the CLI inside.
- A VirtuAI account in the workspace, with a role that can create agents (
agents.create). People with a chat-only role can’t pair or log in the CLI. - An agent with CLI turned on in its Channels tab. It’s on by default, and the card reads Reachable from the terminal (virtuai).
Install
Section titled “Install”pipx install virtuai-clipip install virtuai-cli works too. pipx keeps the CLI in its own environment and puts virtuai on your PATH.
To run models on your machine, install it with local support instead: pipx install 'virtuai-cli[local]'.
For agents that drive a browser on your machine, install it with the browser extra: pipx install 'virtuai-cli[browser]'. On macOS it uses your installed Google Chrome. You can combine extras: pipx install 'virtuai-cli[local,browser]'.
Upgrade
Section titled “Upgrade”pipx upgrade virtuai-cliWith pip, run pip install -U virtuai-cli. Restart virtuai run after you upgrade. It prints the CLI version when it starts.
What changed in recent versions:
- 1.0.30 sends its token in a header instead of the address when it connects, and renews its tokens on its own before they expire. See Pair this machine.
- 1.0.29 keeps a busy runner online: a command waiting for your answer in VirtuAI Desktop no longer takes one of the runner’s places, so a runner with many commands in flight keeps taking work, and the files and searches you open in web chat’s dev mode never wait behind the agent’s commands.
- 1.0.28 honors the command check’s off switch under
virtuai runand in VirtuAI Desktop. With the check turned off at setup, or with--no-guard, your computer no longer asks about every command: VirtuAI’s own prompt asks in the chat instead.virtuai guard statussays which applies, and when the check can’t reach Tev1 the reason says so and what to do. - 1.0.27 names each terminal in web chat’s dev mode after its shell (
zsh 1,zsh 2), and ends a shell that ignores being closed, so a closed terminal tab doesn’t leave one running. - 1.0.26 runs chains of commands that only read without asking, such as
grep … | cut …,sed -n, aforloop or a$(…)that only reads. Text anechoprints is no longer taken for a place outside the folder. - 1.0.25 runs the command check under
virtuai runon your own computer. What it doesn’t clear is asked in web chat, and VirtuAI doesn’t ask again. - 1.0.24 runs what you do in the git panel of web chat’s dev mode, such as a commit, a push or a branch switch, on the runner as your own action, without the command check.
- 1.0.23 opens the files you read in web chat’s dev mode at once, even while the agent’s command runs or waits for your approval.
- 1.0.22 opens the terminal of dev mode on this machine.
- 1.0.21 adds standing permissions to the command check: allow a command for this conversation, for 1 hour, or always in this folder.
- 1.0.20 runs inside VirtuAI Desktop, adds
/compacttovirtuai chat, and fixes a fresh install of the browser extra, which failed on the first browser action withNo module named 'pydantic_settings'. - 1.0.19 starts the agent’s browser inside
virtuai chat. Before, it only started undervirtuai run. - 1.0.6 to 1.0.18 turned
virtuai chatinto a terminal chat built for programming, with side panels, light and dark themes, and the command check, which decides which of the agent’s commands run on your machine and which ones you’re asked about. Your agents’ skills are also copied to your machine. - 1.0.5 writes OpenCode 2’s native configuration. See OpenCode.
- 1.0.4 keeps the runner’s heartbeat steady while the machine is busy, and reports a local model’s reduced context window with each answer.
- 1.0.3 added local models on every channel and the
--serve-modelsoption.
Pair this machine
Section titled “Pair this machine”Pairing links the CLI to one workspace.
-
In VirtuAI, open Settings, select SSO, A2A and CLI, and find Local CLI. Select Pair local CLI.
-
Copy the command it shows. The code expires in 10 minutes and works once.
-
Run it in your terminal, adding your VirtuAI address:
Terminal window virtuai pair <CODE> --server https://<your-virtuai-host>The CLI prints the workspace it paired with and remembers the server.
-
The CLI then offers to set up the command check, which needs Ollama and a small local model. You can decline it. See Set up the command check.
The CLI keeps its token in your system keychain.
In VirtuAI Desktop you don’t need a code: select Connect this computer and the app pairs itself.
Your CLI token works only while you’re an active member of the workspace and your role can create agents. If you’re removed from the workspace, your account is deactivated, or your role changes to one that can’t create agents, the token stops working on your runner, in OpenCode and over A2A. Being added back doesn’t revive it: pair again.
A pairing token expires 180 days after it was issued. From CLI 1.0.30, the CLI renews it on its own once it’s past half its life, when a command starts and twice a day while virtuai run keeps running, so a machine in use never reaches the expiry. A machine left unused for longer, or with an older CLI, has to pair again.
To chat as yourself, so conversations are tied to your own user, also run virtuai login. It opens a browser page that gives you a token to paste. The token lasts 90 days, and CLI 1.0.30 renews it the same way.
virtuai chatvirtuai chat --agent <agent-id-or-name>Pick an agent, type, and watch the answer stream in, with the agent’s steps as they run. The agent works in the folder you opened the chat in. You can run shell commands yourself with !, attach files with Ctrl+V, browse the folder in a side panel, review and undo the agent’s changes with /review, and switch between a light and a dark theme. Type /help for the commands.
Before the agent runs a command on your machine, the command check decides whether it runs or asks you first.
Everything about it, including every slash command and key, is in Terminal chat.
Use it in scripts
Section titled “Use it in scripts”virtuai ask sends one message, prints the answer and exits. It reads standard input when you pipe into it.
virtuai ask "summarize the changes in this branch"git diff | virtuai ask "what does this change?"ANSWER=$(virtuai ask -q "give me a one-line summary of README.md")virtuai ask --json "find any bugs" > events.jsonl| Option | What it does |
|---|---|
--agent <id-or-name> |
Picks the agent |
--model <id> |
Overrides the agent’s default model |
--session <id> |
Continues an earlier conversation |
--print-session |
Prints the conversation ID when done, for use with --session |
-q, --quiet |
Prints only the final answer |
--json |
Prints every event as one JSON line |
--no-tools |
Starts faster without local tools. Fails if the agent tries to use one. |
--workdir <path> |
The folder the agent may work in. Default: the current folder. |
By default, the answer goes to standard output and tool progress to standard error, so > out.txt captures only the answer. Exit codes: 0 success, 1 error during the reply, 2 bad arguments or agent not found.
Run the local runner
Section titled “Run the local runner”virtuai runWhile it runs, deep agents in the workspace run their commands and file edits on this machine, in ~/virtuai unless you pass --workdir. This applies to every channel, not only the terminal. Settings > SSO, A2A and CLI > Local CLI shows the runner as Connected, with its host and folder.
The agent works in the folder of the runner its work goes to, and is told so. That folder is its environment: it’s told that reading anything outside needs your permission. On your own computer, virtuai run checks the agent’s commands before they run. See The command check under virtuai run.
While a runner is connected:
- Your agents’ skills are on the machine. The skills of the agents you can talk to are kept in
.virtuai/skills/inside the runner’s folder, so the agent can run a skill’s scripts there. The runner checks for changes when it connects and every 15 minutes, and removes a skill that’s no longer assigned. /is the working folder. When the agent lists, searches or looks for files in/, it gets the runner’s folder, not your whole disk.- Large tool results stay on the machine. A tool result too large for the conversation is saved in
.virtuai/large_tool_results/inside the runner’s folder, and the agent is told where, so it can search it with the shell. When the machine can’t take it, VirtuAI stores it instead.
A deep agent that an admin associated with a Workstation runs its commands there, not on your runner. See Workstations.
If a message arrives while the runner is reconnecting, VirtuAI waits briefly for it. If it doesn’t come back, the person is told the environment isn’t responding.
A runner that is busy with a long command keeps reporting to VirtuAI, so the command isn’t cancelled. If the runner does stop reporting while a command runs, the agent is told the command was still running when the runner stopped reporting, not that the environment is offline.
Use --isolate-sessions when one runner serves several people. Each conversation then gets its own folder.
A runner serves either everyone in the workspace or only the person whose token it runs with. A runner can’t say it serves someone else: VirtuAI refuses the connection, so one person’s browser actions, such as page contents and sign-ins, never reach a runner started with another person’s token.
If the machine runs local models, --serve-models sets whose turns it answers: own (yours, the default), workspace (anyone’s in the workspace) or none. See Local models.
The command check under virtuai run
Section titled “The command check under virtuai run”From CLI 1.0.25, virtuai run on your own computer checks each command an agent sends before it runs, the way virtuai chat does. When it starts, it prints Guard on: commands it does not clear are asked in the web chat.
- Commands that only read inside the working folder run at once, and so do the ones Tev1 clears. Without Tev1, anything but a read is asked.
- A command you already allowed for this conversation, for 1 hour or always in this folder runs. See Standing permissions.
- Anything else is asked in web chat, in the conversation the command came from, while you have it open. The card reads Your computer asks before running, and only you can answer it. See Command approvals.
- When there is no web chat to ask in, for example when the message came from Slack, the command doesn’t run. Neither does a command that is always asked on the computer: one that deletes, reads secrets, changes the system, runs inline code or reaches outside the folder. The agent is told why, and that you can run it yourself.
Because your computer asks, VirtuAI doesn’t ask again with its own approval prompt.
The check stays off where nobody sits at the keyboard: in a container, in a Workstation, and on a runner started with --isolate-sessions. There, and on a runner started with virtuai run --no-guard or on a computer where the check was turned off (virtuai config set command_guard off, CLI 1.0.28 or newer), VirtuAI asks in the chat instead when the agent’s Ask before running commands is on.
To keep the runner going without a terminal, and to be asked on the computer when the chat isn’t open, use VirtuAI Desktop.
Other commands
Section titled “Other commands”| Command | What it does |
|---|---|
virtuai status |
Shows the server, workspace, pairing and connection |
virtuai logs |
Shows recent commands the agent ran on this machine |
virtuai unpair |
Removes this machine’s pairing |
virtuai config get / set |
Reads or changes local options, such as server_url |
virtuai guard status, test, setup |
Shows, tries or sets up the command check. See Terminal chat. |
virtuai guard grants |
Lists the commands you allowed always in a folder. --revoke <id> removes one and --all removes them all. |
virtuai opencode |
Connects the OpenCode editor. See OpenCode. |
Security
Section titled “Security”What the CLI does to limit mistakes:
- File tools can’t write outside the working folder.
- In
virtuai chat, undervirtuai runon your own computer and in VirtuAI Desktop, the command check runs commands that only read, or that Tev1 says only read or run the project’s tests, and asks you about the rest. Reading outside the working folder is also asked. cdcan’t leave the working folder in bash.- Commands such as
sudo,rm -rf /and disk formatting are blocked. - Every command and its exit code is logged to
~/.virtuai/audit.log. - The agent only has access while
virtuai chat,virtuai askorvirtuai runis running.
What it doesn’t stop:
- A command you authorize or a standing permission covers, and every command under
virtuai askorvirtuai run --no-guard, runs without the command check. Shell commands can use absolute paths, so they can read, change or delete anything your account can. - Other interpreters, such as
pythonornode, can leave the working folder. - The block list is a pattern match and can be worked around. The command check is a small model and can be wrong.
- Network access isn’t restricted.
For real isolation, run the CLI in a container with only your project folder mounted:
docker run --rm -it -v "$PWD:/work" -w /work python:3.12 \ bash -c "pip install virtuai-cli && virtuai pair <CODE> --server https://<your-virtuai-host> && virtuai chat"Run models on your machine
Section titled “Run models on your machine”An agent can run its model on your machine through Ollama, or oMLX on a Mac with Apple Silicon. The rest of the agent, including its tools, knowledge bases and history, stays on VirtuAI, and the agent answers on every channel, not only the terminal.
In short: install the CLI with pipx install 'virtuai-cli[local]', pull a model such as qwen3:8b, set the agent’s Provider to Local (Ollama) or Local (oMLX), and keep virtuai run running. The full setup, the validated models and how each turn is routed are in Local models.
Troubleshooting
Section titled “Troubleshooting”“Invalid or expired pairing code” : The code is older than 10 minutes or was already used. Generate a new one.
401 errors after it worked before : You paired another machine, or selected New pairing code, which replaces your token. Pair this one again. The token also stops working if you’re removed from the workspace, your account is deactivated, your role can no longer create agents, or the token expired: a CLI older than 1.0.30 doesn’t renew it, so upgrade and pair again.
The agent isn’t in the list
: Check that CLI is on in the agent’s Channels tab, and published if the agent uses versioning, and that virtuai status shows the right server and workspace.
The agent says the environment isn’t responding
: The runner stopped. Start virtuai run again.
The agent says a command needs your approval and there’s no chat open to ask in
: Under virtuai run, the command check asks in web chat. Open the conversation in web chat and ask again, run the command yourself, or use VirtuAI Desktop, which asks on the computer.
The agent looks for files in the wrong folder
: The agent works in the folder of the runner its work goes to. Settings > SSO, A2A and CLI > Local CLI shows its folder. Start the runner, or virtuai chat, in the folder you want.
For the terminal chat and the command check, see Terminal chat.
