vessel is a PTY-based runtime for spawning, controlling, and observing interactive terminal agents over a Unix socket.
It is designed for AI orchestrators, test harnesses, and automation systems that need real terminal semantics (not just stdout pipes).
- Is: local control plane for interactive worker processes (
spawn,send,wait,snapshot,events,attach,view). - Is: good for multi-agent workflows, TUI testing, and reproducible terminal automation.
- Is not: container runtime, distributed scheduler, or durable job queue.
- Linux with Unix sockets + PTY support
- Rust 1.85+ (for building from source)
tmux(optional, only forvessel view)
cargo install vessel-pty# 1) Spawn a worker shell
vessel spawn --name demo -- bash
# 2) Send a command (+ Enter)
vessel send demo "echo hello from vessel" -n
# 3) Wait for expected output, then inspect the virtual screen
vessel wait demo --contains "hello from vessel" --timeout 5
vessel snapshot demo
# 4) Clean up (SIGTERM by default; use --force for hard kill)
vessel kill demo --force
# 5) Stop server when done
vessel shutdownAgent = PTY process + transcript ring + virtual screen
Server = owns all agent state, listens on Unix socket
Client = stateless CLI sending JSON requests
View = tmux dashboard; panes run read-only attach streams
Key implications:
snapshotreflects current terminal state (best for assertions).tail/dumpreflect transcript bytes (useful for logs/streaming).- State is in-memory in the server process (no persistence across server restart).
vessel spawn --name worker --label batch --timeout 60 -- bash
vessel list
vessel list --all --format json
vessel kill worker
vessel kill --label batch --force
vessel kill --all --force
vessel signal worker --signal USR1vessel send worker "make test" -n
vessel send worker "run the tests" -e # -e/--enter submits (CR)
vessel send worker "ls" -n --submit-delay-ms 0 # skip the pre-key pause
vessel send agent "$PROMPT" -p -e # -p/--paste: multi-line prompt, then submit
vessel send agent - -p -e < prompt.md # "-" reads the payload from stdin
vessel send-bytes worker 1b5b41 # up arrow
vessel send-keys worker ctrl-c enter
vessel send --label batch "status?" -e # fan out to every agent with a label
vessel send-keys --label batch ctrl-c # selectors work on the whole send family
vessel tail worker -f
vessel tail worker --raw
vessel snapshot worker
vessel snapshot worker --raw
vessel dump worker --format jsonl--newline/--enter write the submit key in a separate PTY write, 50ms after
the text. Full-screen TUIs classify input by arrival timing: a CR/LF that lands
in the same burst as the text is treated as pasted content and gets inserted
into the composer instead of submitting it, so the prompt sits there looking
delivered. The pause puts the key outside that burst. Use
--submit-delay-ms 0 to write it immediately (fine for shells and other
line-oriented programs), or raise it for a TUI that still swallows the key.
Use --paste (-p) for any prompt that spans more than one line. It wraps the
text in bracketed-paste markers (ESC[200~ … ESC[201~), which a TUI reads as
a single paste: the newlines become lines in the composer. Without it the first
newline submits a truncated prompt and every remaining line lands as its own
turn — three separate agent turns for one prompt, each billed, none of them
what was asked.
--paste --enter is the usual orchestrator pairing: paste the whole prompt,
then submit it as one turn. Pass - as the text to read the payload from
stdin, which avoids quoting a long prompt onto the command line:
vessel send agent - --paste --enter <<'PROMPT'
Refactor the parser to use the new token stream.
Keep the existing public API.
PROMPTAny ESC[201~ inside the text is dropped rather than forwarded — it would
otherwise close the bracket early and deliver the remainder as live keystrokes.
send, send-bytes, and send-keys all take the same selectors kill and
signal use: --label (repeatable, agents must carry all of them), --proc
(command substring), and --all. They match running agents only.
With a selector, omit the agent ID — every positional is payload:
vessel send --label batch "run the tests" --paste --enter
vessel send-keys --label batch ctrl-c
vessel send --proc codex "status?" --enterPassing both an ID and a selector is rejected rather than guessed at. Note that
--proc has no -p short form on these three commands, because -p is
--paste on send; kill and signal keep -p for --proc.
A fan-out reports one line per agent and exits non-zero if any of them missed the input — a group send can partially fail, and staying silent would report that as success:
$ vessel send --label batch "hi" --enter
tidy-otter ok
brave-heron error: write failed: Input/output error
Deliveries run concurrently, so the per-agent submit delays overlap instead of stacking. A request naming a single agent ID is unchanged: silent on success, non-zero on failure.
vessel wait worker --contains "READY" --timeout 30
vessel wait worker --stable 200 --contains "$ "
vessel wait worker --exited
vessel assert worker --contains "PASS"
vessel assert worker --not-contains "ERROR"vessel events --output
vessel subscribe --id worker --prefix
vessel subscribe --label batch --format jsonl
vessel attach worker
vessel attach worker --readonly
vessel view
vessel view --mode windows
vessel view --label batchvessel exec -- git status --short
vessel exec --timeout 120 -- cargo testvessel spawn --name rec --record -- bash
vessel send rec "echo hi" -n
vessel recording rec --format pretty
vessel gen-test rec > replay.sh
chmod +x replay.shSpawn dependencies:
# Wait for setup to exit before starting app
vessel spawn --name setup -- ./setup.sh
vessel spawn --name app --after setup -- ./run-app.sh
# Wait for output from another agent before spawning
vessel spawn --name db -- ./start-db.sh
vessel spawn --name api --wait-for db:READY -- ./start-api.shRecommended cleanup for automation:
vessel kill --label batch --forceMany commands support --format text|json|pretty.
text: compact, pipe-friendlyjson: structured envelope ({"<key>": ..., "advice": [...]})pretty: human-oriented terminal output
Example:
vessel list --format json | jq '.agents[] | {id, state, labels}'When spawn --cwd DIR is present, each list JSON record includes cwd. The
server resolves DIR when it spawns the process. Relative paths use the server
working directory. The reported value is the canonical absolute path, with
symbolic links and . or .. components resolved. Records omit cwd when the
spawn request did not specify it.
- Server auto-starts for most regular commands.
eventsandsubscribedo not auto-start (they expect an existing server/session).- Default socket path:
$XDG_RUNTIME_DIR/vessel.sockwhenXDG_RUNTIME_DIRis absolute, including a directory that does not yet exist. Empty or relative values fall back to/run/user/$UID/vessel.sock(then/tmp/vessel-$UID.sock). - The standard per-user socket uses
vessel-server.scopefor daemon survival. Servers using custom sockets, including an isolatedXDG_RUNTIME_DIR, retain the caller's cgroup and do not compete for that shared scope. - Per-agent scopes keep the
vessel-agent-prefix and use a fresh identity for every spawn, including reused agent names and server restarts. Spawn logs correlate the agent ID with its unit name. - Override with
VESSEL_SOCKETor--socket.
Logs go to stderr, at vessel=warn by default and vessel=debug with
--verbose. RUST_LOG overrides the filter in every mode.
| Variable | Effect |
|---|---|
VESSEL_LOG=<path> |
Also append logs to a file, at vessel=info or better so server lifecycle events are captured without --verbose. |
VESSEL_LOG_FORMAT=json |
Emit JSON spans and events to stderr instead of the human formatter, for callers that parse vessel's logs. |
vessel doctorIf you hit stale socket/session issues:
vessel shutdown
tmux kill-session -t vessel 2>/dev/null || trueNotes:
killsends SIGTERM by default; some interactive shells ignore it. Use--forcefor deterministic teardown.- For TUI inspection, prefer
snapshotorattach --readonlyover plaintail.
just build
just testRelevant docs:
AGENTS.md- contributor + agent workflowdocs/testing.md- testing approach and scenarios
