Skip to main content

ttypal

Serial port debug tool designed for both humans and AI agents.

Features

  • Interactive terminal (like minicom, but better)
  • Auto-logging with timestamps and rotation
  • Terminal-safe control-byte escaping (SO/SI and other C0 bytes shown as ^N/^O; --raw disables it)
  • External command injection via Unix socket (for AI/scripts)
  • ZMODEM file transfer over serial
  • Record/replay serial sessions
  • Macro recording and playback (F1-F12 hotkeys)
  • Board config management
  • AI agent skill for serial debugging

Install

pip install ttypal-ai

Platform-specific setup:

  • Linux - Native support; serial port permissions required
  • macOS - Native plug-and-play support (untested)
  • Windows - Run through WSL2 + usbipd-win (untested)

Quick Start

# Interactive mode
ttypal

# Headless daemon (for AI automation)
ttypal-daemon start -b myboard

# Send commands from another process
ttypal-send --wait "# " "uname -a"

# Read recent serial output
ttypal-tail -n 50

Terminal-safe output

Board output and log display are rendered through a control-byte filter. A stray SO (0x0E) would otherwise leave the terminal stuck in DEC Special Graphics; other unsafe C0 bytes and DEL are shown in caret notation (^N, ^O, ^?, ...). CR, LF, TAB, BS, BEL and ESC (ANSI sequences) pass through unchanged.

Log files themselves are not caret-escaped, so SO/SI remain available for debugging. Note that the logger decodes UTF-8 with replacement; use --record when you need lossless binary capture. ESC is passed through by default, including DEC charset designations, so this is not a full sandbox for arbitrary binary output.

Use --raw on ttypal, ttypal-send or ttypal-tail to disable caret escaping. --raw is not a lossless capture path: ttypal-send output may still have ANSI sequences/timestamps normalized by the daemon, and ttypal-tail --raw can feed control bytes to the terminal again. The interactive terminal can enable raw mode permanently in the board config (--no-raw overrides it):

[terminal]
raw = true

Python API

Use TtypalClient from Python tests and automation code to talk to a running ttypal-daemon without spawning ttypal-send for every operation.

from ttypal.client import TtypalClient, TtypalTimeoutError

serial = TtypalClient(session="myboard")

try:
    output = serial.send_wait("uname -a", prompt="# ", timeout=30)
except TtypalTimeoutError as exc:
    print(f"timed out via {exc.socket_path}: {exc.output}")
else:
    print(output)

Stable first-version methods:

Method Purpose
send(command) Send a command without waiting for output
send_wait(command, prompt="# ", timeout=None) Send a command and return output collected until prompt
expect_send(expect, command, timeout=None) Wait for text, then send a command
expect_send_wait(expect, command, prompt="# ", timeout=None) Wait for text, send a command, then wait for prompt
probe(timeout=2.0) Send Enter and return the current console response
request(payload, operation_timeout=None, io_timeout=None) Send a raw daemon protocol request

Macros

Bind command sequences to F1-F12 keys in your board config:

[macro]
F1 = ["echo hello", "sleep 0.5", "ls -la"]
F2 = ["reboot"]

Or record interactively: Ctrl-T r to start, Ctrl-T s to stop and save.

AI Agent Integration

Clone this repo and point your agent runtime at the reusable skill in .agents/skills/ttypal/.

cd /path/to/ttypal-ai
# Then ask your AI agent to operate the serial port with ttypal

License

MIT

Metadata

Release files for ttypal-ai 0.9.4

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

Source distribution (sdist)

Source distribution for ttypal-ai 0.9.4
File Size Uploaded Provenance Actions
ttypal_ai-0.9.4.tar.gz 53.7 kB Without provenance Details for ttypal_ai-0.9.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ttypal-ai 0.9.4
File Interpreter ABI Platform Actions
ttypal_ai-0.9.4-py3-none-any.whl Python 3 none any Details for ttypal_ai-0.9.4-py3-none-any.whl

Total release size: 92.4 kB

Release files / ttypal_ai-0.9.4.tar.gz

Download URL ttypal_ai-0.9.4.tar.gz
Size 53.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6461e53ad8b1cd9442b41addff7fad433bfaf4c1758510eeaecb91d89fa82c68
BLAKE2b-256 checksum
How to use checksums
134e955f2ba132a21a599d2c418c757f75a2f4a5ded37c80ad8c0b48d3d52bdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / ttypal_ai-0.9.4-py3-none-any.whl

Download URL ttypal_ai-0.9.4-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
302fa5206a2592d5904edc9db860d966bbed3c4c9316f05987005efe1551e45b
BLAKE2b-256 checksum
How to use checksums
7742e42f9be7ca101332da6175864ef33860a2bdbd379589e8f9b2dd04bbf2d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for ttypal-ai 0.9.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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