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
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.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.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.
bash npm install agent-terminal Or install globally for CLI and MCP usage: bash npm install -g agent-terminaljavascript 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"] } } }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