Skip to main content

🚀 binterint: Cross-Platform Headless TUI Automation

binterint (Binary Terminal Interaction) is a powerful, OS-independent utility designed to interact with and automate Terminal User Interfaces (TUIs) headlessly. It virtualizes a terminal environment, allowing you to spawn processes, interact with them programmatically, and capture high-fidelity semantic screenshots for AI-driven automation.


✨ Key Features

  • 🤖 Autonomous Navigation: New auto command that uses rule-based semantic analysis to navigate TUIs toward a goal without external APIs.
  • 🌐 OS-Independent PTY: Seamlessly handles Pseudo-Terminals on both Windows (pywinpty) and Unix/macOS (ptyprocess).
  • 🛡️ Unicode Stability: Automatic PYTHONUTF8 injection ensures TUI stability and prevents encoding crashes on Windows.
  • 📸 Headless Rendering: Custom PILLOW-based renderer that converts terminal buffer state to high-quality PNGs with Roboto Mono bundling.
  • 🧠 Hybrid Semantic Analysis: Combines fast local heuristics for hotkeys with optional Gemini/OpenAI Vision for complex spatial reasoning.
  • 🛠️ Developer First: Pydantic-powered data validation and a clean CLI/Python API.

🚀 Installation

Install directly from source:

pip install .

📖 Usage

CLI Quickstart

Run a TUI application headlessly and take a screenshot after it settles:

binterint run "python sample_tui.py" --out screenshot.png --wait 2.0

🤖 Autonomous Mode

Let binterint intelligently navigate the TUI to achieve a goal using rules and pattern matching:

binterint auto "python sample_tui.py" --goal "Click button 1 and exit"

Interactive Mode

Explore a TUI session and inspect semantic elements:

binterint interact "htop"

LLM Setup

To enable AI-based semantic analysis, add your API keys to a .env file in your project root:

GOOGLE_API_KEY=your_gemini_key
OPENAI_API_KEY=your_openai_key

Python API with AI Analysis

import asyncio
from binterint.controller import TUIController
from binterint.semantic import SemanticAnalyzer

async def main():
    ctrl = TUIController(cols=80, rows=24)
    analyzer = SemanticAnalyzer()

    # Spawn and wait
    ctrl.spawn(["python", "sample_tui.py"])
    ctrl.sync(1.0)

    # Capture screenshot
    img_path = "state.png"
    ctrl.take_screenshot(img_path)

    # Use AI to find elements
    elements = await analyzer.analyze_screenshot(img_path)
    
    for el in elements:
        # Map normalized coords to terminal grid
        grid = analyzer.map_to_grid(el.x, el.y, 80, 24)
        print(f"Found {el.type} '{el.label}' at Col {grid['col']}, Row {grid['row']}")

    ctrl.stop()

if __name__ == "__main__":
    asyncio.run(main())

🎨 Visuals

The headless renderer ensures that even in non-GUI environments, your TUI screenshots look premium and consistent:

Sample Render Success from source sample_tui.py


🛠️ Project Structure

  • binterint/: The core Python package.
    • pty_engine.py: Multi-platform PTY abstraction.
    • renderer.py: PILLOW-based terminal renderer.
    • semantic.py: AI-driven element detection and coordinate mapping.
  • tests/: Comprehensive test suite including LLM capability mocking.
  • sample_tui.py: A cross-platform ANSI-based TUI for testing.

⚖️ License

MIT License. See LICENSE for details.

Metadata

Release files for binterint 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for binterint 0.1.1
File Size Uploaded
binterint-0.1.1.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for binterint 0.1.1
File Interpreter ABI Platform
binterint-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / binterint-0.1.1.tar.gz

Download URL binterint-0.1.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c630289bd2078bcd5382023b5dfe039e2153cbf71a073ffe4de40edc634cab89
BLAKE2b-256 checksum
How to use checksums
6a438b111884d918d7ca697621034b53c3d09ce787d37e3351625e10f5252254
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 21, 2026.

Transparency log

Release files / binterint-0.1.1-py3-none-any.whl

Download URL binterint-0.1.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b05d926e1ca003233c3b9f9c675a55146864002e198cfdd508bf91b329dc721
BLAKE2b-256 checksum
How to use checksums
435baec5f66e60e388219deb6db2a962e55e85723bd35f0f2b40ae866b234afb
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 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page