agent-tty
Terminal and TUI automation CLI for AI agents. Use when the user needs to create a terminal session, run a command in a terminal, automate an interactive CLI…
от coder★ 33 звезды на GitHub
Установить agent-tty в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Terminal Automation with agent-tty
If agent-tty is not already available in the environment, fetch the current README.md from coder/agent-tty on GitHub and follow its installation instructions before continuing. Otherwise use agent-tty directly.
Examples use jq for JSON parsing; any JSON-processing tool works.
Prefer isolated homes, JSON envelopes, and renderer-backed artifacts so terminal workflows stay reviewable and reproducible.
Core Workflow
Every terminal or TUI automation task should follow this pattern:
- Create an isolated home with
--home. - Check prerequisites with
doctor --jsonbefore screenshot or recording work. - Create a session with
create --json. - Run setup commands with
runinstead of simulating long shell typing. - Wait on observable terminal state with
waitinstead of blind sleeps. - Inspect the current screen with
snapshot. - Capture proof artifacts with
screenshotorrecord export. - Destroy the session when finished.
AGENT_HOME="$(mktemp -d)"
agent-tty --home "$AGENT_HOME" doctor --json
SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId')
agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'printf "ready\n"'
agent-tty --home "$AGENT_HOME" wait "$SESSION_ID" --text 'ready' --json
agent-tty --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json
agent-tty --home "$AGENT_HOME" screenshot "$SESSION_ID" --json
agent-tty --home "$AGENT_HOME" record export "$SESSION_ID" --format webm --json
agent-tty --home "$AGENT_HOME" destroy "$SESSION_ID" --json
wait gives up after 30 s by default and exits 11 (WAIT_TIMEOUT). Pass --timeout <ms> for a slower program, or --timeout 0 to wait without a limit. A batch wait step without "timeout" uses the same 30 s default.
Essential Commands
# Environment and lifecycle
agent-tty --home <path> doctor --json
agent-tty --home <path> create --json -- /bin/bash
agent-tty --home <path> inspect <session-id> --json
agent-tty --home <path> destroy <session-id> --json
# In-session control
agent-tty --home <path> run <session-id> 'command here' --json
agent-tty --home <path> type <session-id> 'literal text' --json
agent-tty --home <path> paste <session-id> 'multiline payload' --json
agent-tty --home <path> send-keys <session-id> Enter Ctrl+C --json
agent-tty --home <path> mouse <session-id> press --button left --row 8 --col 20 --json
agent-tty --home <path> batch <session-id> '[{"run":"htop","noWait":true},{"wait":{"screenStableMs":1000}}]' --json
# Observation and proof
agent-tty --home <path> wait <session-id> --text 'ready' --json
agent-tty --home <path> wait <session-id> --regex 'READY>$' --scope cursor-line --json
agent-tty --home <path> wait <session-id> --screen-stable-ms 1000 --json
agent-tty --home <path> snapshot <session-id> --format text --json
agent-tty --home <path> screenshot <session-id> --json
agent-tty --home <path> screenshot <session-id> --out ./proof.png --json
agent-tty --home <path> record export <session-id> --format webm --json
Common Patterns
Bootstrap a shell session
AGENT_HOME="$(mktemp -d)"
SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId')
agent-tty --home "$AGENT_HOME" run "$SESSION_ID" 'pwd && ls -la' --json
agent-tty --home "$AGENT_HOME" snapshot "$SESSION_ID" --format text --json
snapshot and a matched wait carry an optional screenHash (a hash of the visible screen text). Compare it across calls to tell whether the visible screen actually changed instead of diffing full text; equal hashes mean identical visible content even when the event sequence advanced.
Drive an interactive CLI or TUI
Use batch to run an ordered sequence of input-and-wait steps in one call instead of separate run/wait/send-keys invocations. Each wait step is anchored to a Wait Baseline — it only observes screen state produced after the preceding input step, so the sequence cannot race ahead and match a stale screen. A batch stops at the first failed step by default (--keep-going attempts every step).
Use mouse for TUI hit-testing, scrolling, and drag behavior. Coordinates are
zero-based cells. A drag is three actions: press --button left, one or more
button-free move actions, then release --button left. The child must enable
mouse tracking; a suppressed event returns reported: false. Mouse input
requires the mouse-input capability that agent-tty doctor --json reports,
and must never be replaced with a hard-coded SGR sequence.
AGENT_HOME="$(mktemp -d)"
SESSION_ID=$(agent-tty --home "$AGENT_HOME" create --json -- /bin/bash | jq -r '.result.sessionId')
agent-tty --home "$AGENT_HOME" batch "$SESSION_ID" '[
{ "run": "<interactive-command>", "noWait": true },
{ "wait": { "screenStableMs": 1000 } },
{ "sendKeys": ["Down", "Down", "Enter"] },
{ "wait": { "text": "<exp
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл agent-tty?
Terminal and TUI automation CLI for AI agents. Use when the user needs to create a terminal session, run a command in a terminal, automate an interactive CLI or TUI, wait for terminal output, capture a TUI screenshot, export a terminal recording, or test a CLI workflow with reviewable artifacts.
Как установить скилл agent-tty?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agent-tty запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…