Skip to main content

Serial port debug tool for humans and AI agents

Project description

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
  • 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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttypal_ai-0.9.1.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttypal_ai-0.9.1-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file ttypal_ai-0.9.1.tar.gz.

File metadata

  • Download URL: ttypal_ai-0.9.1.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for ttypal_ai-0.9.1.tar.gz
Algorithm Hash digest
SHA256 3702e435c5d82ef89b23241ab90a1ef6f0ffec620e5a86d31a55a756bc9f380c
MD5 68229cdc95c232c1b365f5223e3be55b
BLAKE2b-256 7da6c7ff9ad6f08f898e715e77769c9a4b466aedfb88a199a8d6ceac0319597a

See more details on using hashes here.

File details

Details for the file ttypal_ai-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: ttypal_ai-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for ttypal_ai-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4de3643a0da4998622c2b591ca2bfd3ebb001f9a936fe8c8215c9ab02a90b4f
MD5 ef27e6a8798f7211f9e2d2b878fa4c4d
BLAKE2b-256 0b6633dc418afe0d8873d123300e43b0844b77d95fb70aed0cd713e25659fa0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page