Agent Terminal

Agent Terminal is an open-source terminal automation harness created by Jason Kneen designed to let AI agents interact directly with command-line interfaces. Built on Microsoft's node-pty—the same pseudo-terminal library that powers the VS Code integrated terminal—it provides a headless execution environment for terminal applications. The tool operates either as an importable Node.js library, a standalone CLI utility, or a Model Context Protocol (MCP) server. Rather than executing standard stateless child processes, Agent Terminal maintains stateful terminal sessions, capturing raw screen buffer state as clean ASCII text and allowing agents to dispatch simulated keyboard inputs, control sequences, and interactive commands. What differentiates Agent Terminal is its focus on handling interactive CLI software such as text editors (vim, nano), REPLs (Python, Node), package managers, and setup wizards that normally break standard sub-process wrappers due to missing TTYs or complex cursor control codes. By exposing a full PTY layer via MCP or programmatic APIs, LLMs can inspect interactive terminal state and send keystrokes just like a human developer. Agent Terminal is distributed as open-source software under the MIT license and is available as an npm package. Because it acts as an execution harness, it is model-agnostic and can be integrated with any LLM client or orchestration framework that connects via JavaScript or the Model Context Protocol.

Tags: agent harness, ai agent, cli, OpenSource, terminal

Visit Agent Terminal

Key features

  • node-pty Virtual Terminal Engine — Emulates standard pseudo-terminal capabilities using the same core library powering VS Code's integrated terminal. - Headless ASCII Screen Capture — Captures terminal buffer output as clean text, enabling language models to read screen states without requiring an active graphical display. - Interactive Keystroke Simulation — Sends granular keyboard inputs, navigation keys, and escape sequences to handle interactive CLI prompts and full-screen terminal programs. - Full CLI Compatibility — Works across diverse interactive environments including Git commands, REPLs (Python, Node), package managers, and text editors like Vim. - Model Context Protocol (MCP) Integration — Functions as an MCP server to provide standardized terminal tool-calling interfaces to MCP-compatible AI agents. - Library and CLI Interfaces — Can be imported directly into Node.js agent projects via ES modules or executed directly through its command-line interface.

Use cases

Use Case: Automating Interactive CLI Wizards Developers can attach Agent Terminal to AI agents executing multi-step scaffolding tools (such as npm init or framework generators). The agent reads the interactive prompts from the pseudo-terminal output and sends precise input responses and confirmations to complete setup tasks.

Use Case: Headless REPL Debugging An AI coding agent can spin up interactive language REPLs like python3 or node to evaluate code snippets dynamically. Agent Terminal maintains the session, feeds expressions line-by-line, and captures standard output and error streams in real time.

Use Case: MCP-Driven Terminal Tool Calling Engineers building agents with MCP-compliant orchestrators can mount Agent Terminal as a tool provider. This gives the agent a managed terminal execution context capable of running long-lived terminal sessions without failing on missing TTY requirements.

Who it is for

This tool is intended for AI agent builders, tool developers, and engineers who need robust, headless terminal execution that goes beyond basic child-process spawning. It is especially suited for those implementing MCP servers or building autonomous workflows that interact with interactive CLI programs. It is not intended as a standalone chat assistant or an out-of-the-box coding agent for non-programmers.

Install guide

Installation Install Agent Terminal globally via npm or as a dependency in your Node.js project: bash npm install agent-terminal Or install globally for CLI and MCP usage: bash npm install -g agent-terminal

First Run Agent Terminal requires no API keys or configuration files to run locally. To use it as a programmatic module in an ES module project, import it into your script: javascript import { TerminalSession } from 'agent-terminal'; If using it as an MCP server, configure your MCP client configuration file (such as claude_desktop_config.json) to invoke the package binary: json { "mcpServers": { "agent-terminal": { "command": "npx", "args": ["agent-terminal"] } } }

Example Session Spawn a headless terminal session, send input, and capture output programmatically: javascript import { TerminalSession } from 'agent-terminal'; const session = new TerminalSession(); await session.start(); // Send a shell command await session.write('node -v\n'); // Read the ASCII output from the terminal state const output = await session.read(); console.log('Terminal Output:', output); await session.close();

Part of CLI Coding Agents

Categories: AI Coding Agents, Code Assistants, Developer Tools

Related CLI agents

  • amux — amux is an open-source agent harness and session multiplexer developed by Mixpeek. Built in Rust, it is designed to manage,…
  • Pi Boss — Pi Boss is an open-source multi-agent orchestration extension developed by skyfallsin for the pi terminal coding agent ecosystem. It provides…
  • ORCH — ORCH is an open-source multi-agent orchestration harness created by oxgeneral. It acts as a supervisory control layer for running, coordinating,…
  • SWE-agent — SWE-agent is an open-source autonomous software engineering agent harness built and maintained by researchers from Princeton University and Stanford University.…
  • Claude Squad — Claude Squad is an open-source terminal user interface (TUI) orchestrator and multi-instance session harness for Claude coding agents, developed by…
  • Crush — Crush is an open-source terminal coding agent created by Charm (Charmbracelet), the team behind popular Go terminal UI libraries like…
  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories