Skip to content

Command line

functual is the command you run on your own computer to reach your agents’ machines. It can list your agents, open a shell, start Remote Desktop or VNC, and forward any port. It needs no VPN and no open inbound ports on the machine. It uses the API, signed in as you or with an organization API key.

On machines that run Agent Functual, functual is already installed: it is the same program. The download below is for laptops and workstations. It installs no service and changes nothing else.

Terminal window
curl -fsSLO https://pkgs.functual.com/cli/latest/functual-linux-amd64.tar.gz # or functual-linux-arm64.tar.gz
tar -xzf functual-linux-amd64.tar.gz
sudo install functual /usr/local/bin/ # or any folder on your PATH, e.g. ~/.local/bin
functual version

In PowerShell:

Terminal window
Invoke-WebRequest https://pkgs.functual.com/cli/latest/functual-windows-x64.zip -OutFile functual.zip
Expand-Archive functual.zip -DestinationPath "$env:LOCALAPPDATA\Functual"
& "$env:LOCALAPPDATA\Functual\functual.exe" version

Add %LOCALAPPDATA%\Functual to your PATH to run it as functual. functual.exe is signed by Functual, LLC.

A download for macOS is coming. On a Mac that runs Agent Functual, functual is already in /usr/local/bin.

Every release has a SHA256SUMS file, signed with the same key as Functual’s Linux package repositories:

Terminal window
curl -fsSLO https://pkgs.functual.com/cli/latest/SHA256SUMS
curl -fsSLO https://pkgs.functual.com/cli/latest/SHA256SUMS.asc
curl -fsSL https://pkgs.functual.com/functual.asc | gpg --import
gpg --verify SHA256SUMS.asc SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS

On Windows, compare (Get-FileHash functual.zip).Hash with the functual-windows-x64.zip line in SHA256SUMS.

cli/latest/ always holds the newest release. A specific version stays at cli/<version>/, for example https://pkgs.functual.com/cli/0.1.14/functual-linux-amd64.tar.gz. Use that form to pin a version in scripts.

Terminal window
functual login

It prints a link and a short code, and opens your browser if this computer has one. Open the link on any device, sign in to my.functual.com as usual, check that the code matches, pick the organization and approve. This also works in an SSH session or on a machine without a browser. Only approve a sign-in you started yourself: if someone sends you a code, deny it.

The CLI then acts as you, with your access in that organization. Everything it does appears in the Activity log under your name, “via CLI on <computer>”. If you leave the organization, the CLI stops working at once. The sign-in ends after 30 days without use. Profile → Signed-in computers at my.functual.com lists your computers and signs them out. Only owners and admins can use Agent Functual today.

The sign-in is saved for your user only, in ~/.config/functual/ on Linux, ~/Library/Application Support/functual/ on macOS and %APPDATA%\functual\ on Windows.

Command What it does
functual whoami Shows who is signed in, the computer, the organization and the rate limit
functual logout Signs this computer out

For CI, scheduled jobs and other automation that no person runs, use an organization API key instead. Create one in Agents → Settings → API keys. To connect to machines, the key needs connect access; listing agents only needs read. Then:

Terminal window
functual login --api-key

It asks for the key without showing it, checks it, and saves it the same way. Keys are never passed as an argument, which other users could see in the process list. In a script, pipe the key in instead:

Terminal window
printf '%s\n' "$KEY" | functual login --api-key

functual logout only deletes a saved key; revoke it in the console to stop it working.

Terminal window
functual agents # all agents except removed ones
functual agents web # search by label, hostname or ID
functual agents --status online # online, offline, active or revoked
functual agents --json # the API's rows as JSON, for scripts
NAME HOSTNAME STATUS SYSTEM VERSION LAST SEEN ID
Web 1 web1 online ubuntu 24.04 amd64 0.1.14 now ccf033bc-6be9-4ab7-9918-6b2ffb3bfffd
NAS nas offline debian 12 arm64 0.1.14 2 h ago 1f0e4c2a-…

Wherever a command takes <agent>, give its ID, label or hostname. Case doesn’t matter. A name must match exactly one agent. If it matches several, or only partly, functual lists the candidates and stops, so it never guesses which machine to open:

functual: no agent is called "web". Did you mean:
ccf033bc-6be9-4ab7-9918-6b2ffb3bfffd Web 1 (web1, online)

Each command opens a remote access session on the agent. The agent picks it up at its next check-in (every 30 seconds), so connecting takes up to 30 seconds. The session closes when you disconnect. It also ends after its idle time with no traffic, at its maximum length, or when someone closes it in the console.

Terminal window
functual ssh admin@web1 # a shell
functual ssh -l admin "Web 1" # the same, with -l
functual ssh admin@web1 -- df -h / # run a command; its exit code is functual's
functual ssh -o ForwardAgent=yes admin@web1 # pass options to ssh (repeatable)

functual ssh runs your own OpenSSH client (ssh, which macOS, Linux and Windows 10 and later include). You log in to the machine’s own sshd with your usual account and key or password. The machine’s host key is checked end to end, under the name functual-<first 8 characters of the agent ID> in your known_hosts. The connection to Functual’s proxy uses a throwaway key that functual makes for each session and never saves.

Terminal window
functual rdp "Windows VM"

It forwards port 3389 to 127.0.0.1:3389 on your computer and opens your Remote Desktop app. That’s mstsc on Windows, Windows App or Microsoft Remote Desktop on macOS, and FreeRDP or Remmina on Linux. Use --no-open to only print the address, and --local <port> to pick the local port.

Terminal window
functual vnc Macbook

It forwards port 5900 to 127.0.0.1:5901 and opens Screen Sharing on macOS, or vncviewer on Linux. Windows has no built-in VNC viewer, so functual prints the address for yours (TigerVNC or RealVNC, for example). Port 5901 is used because a Mac sharing its own screen already listens on 5900.

Terminal window
functual forward web1 5432 # PostgreSQL on 127.0.0.1:5432
functual forward --local 8443 web1 443 # the machine's web console on https://127.0.0.1:8443

The port stays reachable on 127.0.0.1 until you press Ctrl-C. Several connections can share it, for example a database client and a migration script. Ports below 1024 are moved up by 10000 locally (22 becomes 10022), so no admin rights are needed. If the usual local port is taken, functual uses a free one and prints it.

The ports you can reach depend on your plan. Traffic to ports that aren’t usually encrypted (plain HTTP, VNC) is readable on the proxy; use them for what you would send over the internet anyway.

  • As you: a script you run yourself uses your functual login, so its actions are recorded under your name.
  • API key: set FUNCTUAL_API_KEY instead of signing in, for example from your CI’s secret store. It takes precedence over a saved sign-in.
  • Output: progress messages go to stderr. stdout carries only the result: the table, the --json rows, or the remote command’s output.
  • Exit codes:
    • functual ssh exits with the remote command’s code.
    • Every other command exits 0 on success, 1 on an error, with the reason on stderr, and 2 for wrong arguments.
  • Rate limits: every command makes a few API calls. Free plans allow 60 a minute per key; see Rate limits.

A Python example that runs a command on every online agent:

import json, subprocess
agents = json.loads(subprocess.run(["functual", "agents", "--status", "online", "--json"],
capture_output=True, text=True, check=True).stdout)
for agent in agents:
run = subprocess.run(["functual", "ssh", f"admin@{agent['id']}", "--", "uptime"], capture_output=True, text=True)
print(agent["label"] or agent["hostname"], run.returncode, run.stdout.strip())

Sessions run one after another here, because each counts as a connection toward your plan. On Free, that’s one at a time.

For anything the command line doesn’t do, call the API directly.