vterm-rs
The High-Performance Rust PTY Orchestrator for AI Agents.
vterm-rs is a state-aware terminal host built specifically for AI agents (and the humans who build them). It transforms the terminal from a "blind black box" into a State Machine that agents can inspect, reason about, and control fluently.
Why vterm-rs?
- Safety (Guardrails): Prevent "Infinite Log Floods" with
max_linesandmax_durationlimits. - Truth (State Machine): Don't guess if a command finished. Use
wait_untilandscreen_readto inspect the visual grid. - Fluent Fleet: Orchestrate multiple terminals atomically with the high-performance
batch()API. - Headless-First: Designed for CI/CD and AI backends, with optional
--visiblemode for debugging.
Quick Start (Python SDK)
import vterm_python
client = vterm_python.VTermClient()
# The "Fluent Fleet" way: Atomically set up your session
ops = [
client.spawn_op("Build", visible=True),
client.write_op(1, "cargo build<Enter>"),
client.wait_until_op(1, "Finished", timeout_ms=30000)
]
result = client.batch(ops)
print(f"Build status: {result['sub_results'][2]['status']}")
graph LR
Agent["AI agent<br/>(Claude/IDE/MCP)"]
Term["vterm.exe<br/>(PTY pool, vt100, reaper)"]
Shell["powershell.exe<br/>(your real shell)"]
Agent -- "NDJSON over named pipe" --> Term
Term -- "CommandResult" --> Agent
Term -- "ConPTY" --> Shell
Shell -- "bytes" --> Term
Why
Existing tools either capture command output (no interactivity, no signals, no TUI) or
embed a shell as a library (no real PTY semantics, no parity with what a user sees).
vterm-rs is neither — it's the actual terminal, scriptable.
What you can do that you couldn't before:
- Tell an agent "the build is hung, send Ctrl-C and try again" and have it work.
- Have an agent exit
vimfor you.:wq, problem solved. - Boot a microservice fleet — Redis, Postgres, three services, one log-tailer — in one command. Reap the whole tree with one disconnect.
- Run the same playbook headlessly in CI that you ran with visible windows locally.
Quickstart
# 1. Build
cargo build --release
# 2. Start the orchestrator (visible windows by default)
.\target\release\vterm.exe
# 2. Or start it headless, no windows ever appear
.\target\release\vterm.exe --headless
# 3. From another shell, drive it
.\tests\playbook_tests.ps1 -Headless
The protocol in 30 seconds
Every line on the pipe is one JSON command. Every command produces exactly one response.
Both sides may include a req_id for correlation.
// → request
{"req_id": 7, "type": "Spawn", "payload": {"title": "build", "visible": false}}
// ← response
{"req_id": 7, "status": "success", "duration_ms": 11, "id": 1}
Composite work uses Batch, which returns one aggregate response, not N+1 lines:
// → request
{"req_id": 8, "type": "Batch", "payload": {"commands": [
{"type": "ScreenWrite", "payload": {"id": 1, "text": "cargo build<Enter>"}},
{"type": "WaitUntil", "payload": {"id": 1, "pattern": "Compiling", "timeout_ms": 30000}},
{"type": "ScreenRead", "payload": {"id": 1}}
]}}
// ← response
{"req_id": 8, "status": "success", "duration_ms": 1247, "sub_results": [ … ]}
Full spec: docs/protocol.md.
Three ways to consume it
-
Python SDK & FastMCP Bridge (New!) Build custom MCP servers or automate terminal operations using the blazing fast Python PyO3 bindings.
pip install vterm-rs-python-mcp
import vterm_python from fastmcp import FastMCP mcp = FastMCP("vterm") client = vterm_python.VTermClient() @mcp.tool() def run_build() -> str: # Using the new atomic batch API ops = [ client.spawn_op("build", max_lines=500), client.write_op(1, "cargo build<Enter>"), client.wait_until_op(1, "Finished", timeout_ms=30000) ] res = client.batch(ops) return "Build triggered" if res["status"] == "success" else "Error"
-
Direct MCP Server (Plug-and-Play) Use it directly in your AI client (like Claude Desktop) without writing code.
{ "mcpServers": { "vterm": { "command": "vterm-mcp" } } }
-
Rust Native MCP Server For maximum performance, use the native Rust MCP binary.
cargo run --bin vterm-mcp
Examples: Explore the examples/python_sdk directory for typical DevOps and CI use cases.
Tests: To run the Python tests locally, navigate to vterm-python and run uv run maturin develop, followed by uv run ../tests/python_sdk/test_mcp.py.
-
Raw pipe. Connect, write JSON, read JSON. The PowerShell harness in
tests/playbook_tests.ps1is the canonical example. -
Skill manifest.
skill.tomldeclares each command as an AI skill — useful for non-MCP agents.
Project structure
See AGENTS.md for the layout, code style, and invariants you must respect
when editing.
Status
| Area | State |
|---|---|
| Windows + ConPTY | works |
| Python Bridge | works (v0.7.20, available via PyPI vterm-rs-python-mcp) |
| Linux / macOS | planned (v0.8.0) |
| Wire protocol | unstable, will be pinned at v1.0 |
| Test coverage | smoke (PowerShell) + Rust integration + Python FastMCP |
License
MIT
Metadata
Release files for vterm-rs-python-mcp 0.7.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vterm_rs_python_mcp-0.7.22.tar.gz | 156.7 kB | With provenance | Details for vterm_rs_python_mcp-0.7.22.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vterm_rs_python_mcp-0.7.22-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for vterm_rs_python_mcp-0.7.22-cp310-abi3-win_amd64.whl |
| vterm_rs_python_mcp-0.7.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for vterm_rs_python_mcp-0.7.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| vterm_rs_python_mcp-0.7.22-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for vterm_rs_python_mcp-0.7.22-cp310-abi3-macosx_11_0_arm64.whl |
Total release size: 1.8 MB
Release files / vterm_rs_python_mcp-0.7.22.tar.gz
| Download URL | vterm_rs_python_mcp-0.7.22.tar.gz |
|---|---|
| Size | 156.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7fc1c52cb842dd34c5254d68909432fa00e9fd7b4ccbd69dfae3f1f556adc72
|
|
BLAKE2b-256 checksum How to use checksums |
9b5b82db2e731ae67d1debe7c338a0038ff997a1fcd7f930138b6a736a499fcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / vterm_rs_python_mcp-0.7.22-cp310-abi3-win_amd64.whl
| Download URL | vterm_rs_python_mcp-0.7.22-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 629.4 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
017dd5cea85f3ee7bfcc9aa6e8bce3a44159dd0a7492554d0a938dc6436b0f6c
|
|
BLAKE2b-256 checksum How to use checksums |
fc54d609c725dcae278897e89c0bfa42eda617f23f6001e18652c17d92ec0e4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / vterm_rs_python_mcp-0.7.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | vterm_rs_python_mcp-0.7.22-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 536.0 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
218185629889d2224d69da93c6a985b03eafa153dd6d4df82d0581610acae908
|
|
BLAKE2b-256 checksum How to use checksums |
cbc3e98b6dbd12ce220f637640b79c1fcb3756bb5bde4665fa18269a4535f782
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / vterm_rs_python_mcp-0.7.22-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | vterm_rs_python_mcp-0.7.22-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 483.1 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3b865d92bcdb8d23651fb233d9c1c6ca9fe65a01af5454241d2a086966d48749
|
|
BLAKE2b-256 checksum How to use checksums |
c665deb60d094b88d48d9e6749d04f89941777a561e1650bf775674ad7162229
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logSecurity for vterm-rs-python-mcp 0.7.22
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for vterm_rs_python_mcp-0.7.22.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.