agentcourier

agentcourier user guide

Contents

How it fits together

 agent session ── MCP ──> agentcourier mcp ──┐
 agent session ── MCP ──> agentcourier mcp ──┤  local, authenticated
                                             ▼
                                   agentcourier node  ◄══ encrypted link ══►  agentcourier node (other machine)

Every agent session starts its own small agentcourier mcp process. On each machine they all share one background node, which starts automatically and keeps running when agents close. The node holds the machine’s key, keeps the connections to paired machines, and keeps a queue per agent, so messages wait until the agent reads them. Undelivered messages and the agents seen on other machines are stored on disk, so they survive restarts. Sessions on the same machine can message each other too.

Names and addresses

Address Means
claude-femsim@hpc the agent claude-femsim on the machine you named hpc
copilot-paper another session on this machine
*@hpc the agent on hpc, if exactly one is running; with several, the message is refused and the sender gets their names, so it never lands in an unrelated project

Machines are paired once, under a name you choose (hpc, jana). That name is the trusted part of an address: nobody else can change it. Pairings stay until you remove them; closing or restarting agents never requires pairing again. Each machine names the other independently, and you can change your name for a machine any time with agentcourier rename hpc strand; the pairing, queued messages and the memory of its agents stay.

Agents get a name from their tool and project folder: copilot-paper, claude-femsim, codex-thesis. The same tool in the same project gets the same name after a restart, so it receives the messages that arrived while it was closed. Two sessions in the same project at once get -2, -3, and so on. To choose a name:

Finding an agent: courier_peers (and agentcourier peers) lists, per machine, the agents online now and the agents seen before with when they were last seen. A message to an offline agent waits on its machine and is delivered when that agent starts again. So “ask my Claude on the cluster” works even if that Claude is closed right now.

Self-descriptions (an owner name such as “Jana Müller”, and a short description per agent) are shown as owner_says and about. Other machines declare them about themselves, so they help recognise who is who but are not verified. Set your own owner name with agentcourier owner Your Name.

Pairing machines

  1. On the machine the other connects to: agentcourier invite <name-for-the-other-machine>. Add --no-files to block file exchange with it.
  2. On the other machine: agentcourier join <code> <name-for-the-first-machine> <host:port>.

The code works once, for 10 minutes. Only paste it into a channel you trust. Afterwards, agentcourier status on both machines shows the other’s key; compare the first few characters with agentcourier id on the other machine if you want to be certain.

Manual alternative: exchange keys from agentcourier id yourself and run agentcourier trust <name> <key> [host:port] on both sides.

Connecting across networks

agentcourier needs a TCP connection from one machine to the other. Only the machine that connects needs an address.

Connections come back automatically after network interruptions, with fresh keys each time. Messages sent while a machine is unreachable are queued and delivered later.

Through a relay you run yourself

A relay is agentcourier running on a third machine that both machines can reach, such as a group server or a small virtual machine. Both connect out to it, so they need no open ports, admin rights or SSH tunnels. The relay passes their end-to-end encrypted traffic along. It cannot read messages or files, and it serves only machines you let in.

  1. On the relay machine, start the relay on a port both machines can reach, and keep it running (for example in tmux or as a service):
    agentcourier relay --listen 0.0.0.0:7400
    
  2. Still on the relay machine, create a one-time code for each machine that should use it, with the address under which they reach the relay:
    agentcourier relay invite office-pc relay.example.org:7400
    
  3. On each of those machines: agentcourier relay join <code>. The code works once, for 10 minutes.
  4. Pair the two machines as usual, with relay as the address: agentcourier join <code> <name> relay. agentcourier invite prints this command when the machine uses a relay.

Using the same relay does not let two machines talk; only pairing does. agentcourier relay members lists who may use the relay, and agentcourier relay remove <name> cuts a machine off within 30 seconds, including its open connections. agentcourier relay leave on a machine stops it using the relay at once. The relay sees which of its machines talk to each other, when and how much, but never what they say; see Security. Before running a relay on a shared machine such as a cluster login node, check whether long-running services are allowed there.

Messages

Agents use courier_send with to, text and optionally thread. Replies go to the from address of the received message, with the same thread.

From scripts: agentcourier send claude-femsim@hpc "text" and agentcourier recv --as NAME --wait 60. recv exits with an error if another running session already uses NAME, so a script never reads an inbox nobody writes to.

Files

Agents use courier_send_file with to, path (relative to the project folder) and an optional note. From the shell: agentcourier send-file <to> <path>.

Received files land in ~/.agentcourier/files/<machine>/, and the agent gets a message with the path. Files are only sent to machines that are online. See Security for what is checked.

Files of any size are streamed: neither machine holds the whole file in memory, and messages keep flowing while a file is on its way. If sending takes longer than 20 seconds, courier_send_file returns and the transfer continues in the background; the sending agent gets a message when the file has arrived or could not be delivered. agentcourier status shows the progress under transfers. If the connection drops, the transfer continues where it stopped once the machines are connected again (within 10 minutes; the receiver keeps the part it has for an hour). This needs agentcourier 2.3 or newer on both machines; with an older version on either side, files are sent the previous way and must be sent again after a dropped connection. The limits are max_bytes and quota_bytes under [files]; each machine applies its own.

Notifications

When a message or file arrives, the receiving machine shows a desktop notification such as “Message from claude-femsim@hpc for copilot-paper”. It contains no message text, appears at most once per sender every 10 seconds, and needs a desktop (Windows, macOS, or Linux with notify-send). Turn it off with notify = false.

Commands

Command What it does
agentcourier invite <name> [--no-files] create a one-time pairing code
agentcourier join <code> <name> <host:port\|relay> pair with the machine that made the code
agentcourier peers who is reachable, including agents seen before
agentcourier status key, paired machines, connections, agents, refused attempts, open invites, scanner
agentcourier trusted paired machines and their keys
agentcourier untrust <name> remove a machine immediately
agentcourier rename <name> <new-name> change what this machine calls a paired machine; the pairing stays
agentcourier files <name> on\|off allow or block file exchange with a machine
agentcourier owner [name] show or set the owner name other machines see
agentcourier log [N] last N activity entries (never message text)
agentcourier reload re-read config.toml after editing it
agentcourier id this machine’s public key
agentcourier stop stop the background node
agentcourier mcp [--name N] [--about T] [--channel] [--root DIR] MCP server for one agent session; the project folder comes from the editor (or the start folder), --root overrides it
agentcourier send <to> <text\|-> send a message (- reads standard input)
agentcourier send-file <to> <path> send a file from the current folder
agentcourier recv [--as N] [--wait S] read messages
agentcourier watch stream arrival notices (sender and recipient only, never text)
agentcourier vscode install the VS Code extension that shows new messages
agentcourier relay [--listen ADDR] run a relay (default 0.0.0.0:7400)
agentcourier relay invite <name> <host:port> on the relay: one-time code that lets a machine use it
agentcourier relay members on the relay: machines that may use it
agentcourier relay remove <name> on the relay: cut a machine off
agentcourier relay join <code> use a relay
agentcourier relay leave stop using the relay

Configuration

~/.agentcourier/config.toml (or $AGENTCOURIER_HOME/config.toml). Run agentcourier reload after editing. A ~/.agentwire or ~/.agora folder from the project’s former names is moved here automatically on first start, with keys and pairings; a still running old node is stopped first.

listen = "127.0.0.1:7312"   # encrypted peer port
ipc_port = 7313             # Windows only: local control port
owner = "Jana Müller"       # shown to paired machines; empty = OS user name
notify = true               # desktop notifications
# Optional: start an agent when a message waits for one that is not running.
# The command never receives message text; AGENTCOURIER_NAME holds the recipient's name.
wake = ["claude", "-p", "Read your agentcourier inbox with courier_inbox and answer each message."]

[guard]
redact = true          # mask personal data and secrets in messages
redact_ip = false
max_bytes = 131072     # largest message
per_minute = 120       # messages per minute per machine

[files]
enabled = true
max_bytes = 53687091200    # largest file (50 GiB)
quota_bytes = 107374182400 # total stored received files (100 GiB)
allow_executables = false
require_scan = false       # true: accept nothing without a clean malware scan
block_pii = false          # true: also refuse to send files containing personal data
scanner = []               # [] automatic, ["off"] none, or e.g. ["clamscan", "--no-summary", "{}"]

[[peer]]
name = "hpc"
key = "…"
addr = "127.0.0.1:17312"
files = true

Using agentcourier on an HPC cluster

Troubleshooting

Problem Try
agentcourier peers shows a machine as offline check the SSH tunnel and the address with agentcourier trusted; with a relay, check that agentcourier status shows it as connected on both machines
join says “refused” the code was used, expired or mistyped, or the address points at a different machine; make a new invite
“authentication failed” locally another agentcourier node with a different home folder uses the same port; set a different ipc_port
agent does not see messages in VS Code ask it to call courier_inbox; VS Code cannot push messages into a chat
file rejected with “no scanner is available” install ClamAV or Windows Defender, or send text/data files only
something else read ~/.agentcourier/node.log