A deterministic, event-driven alternative to PTYs for building intelligent, multi-agent CLIs.
The Universal Agent I/O Bus (UAIOB) is a new execution model designed to replace the brittle, legacy PTY (pseudo-terminal) abstraction with a structured, event-driven communication system.
Instead of streaming raw bytes through a terminal emulator, UAIOB treats every interaction as a typed event flowing through a shared bus. This enables:
- deterministic process execution
- clean separation between agents and renderers
- structured stdout/stderr streaming
- multi-agent orchestration
- AI-friendly output
- zero reliance on ANSI escape codes or terminal state
UAIOB is implemented in Delphi as a single self-contained unit.
It runs on Windows and uses standard pipes (not PTYs) to execute commands.
Traditional CLIs rely on PTYs, which introduce:
- hidden terminal state
- ANSI escape code hacks
- inconsistent behavior across OSes
- difficulty parsing output
- no structured semantics
- no multi-agent support
UAIOB replaces all of this with:
- structured events
- typed payloads
- clean process boundaries
- deterministic behavior
- AI-ready output
- extensible agent architecture
This is the foundation for next-generation CLIs, including AI-augmented tools such as a future Gemini CLI.
UAIOB consists of three core components:
A thread-safe, in-memory publish/subscribe system.
Agents publish events such as:
- CommandRequest
- CommandStarted
- CommandOutput
- CommandError
- CommandFinished
Renderers and other agents subscribe to events using simple filters.
A process executor that:
- receives CommandRequest events
- launches commands using "cmd.exe /C ..."
- streams stdout and stderr as structured events
- supports infinite timeouts
- decodes console output using the correct OEM codepage
- never uses a PTY
This agent is stateless by design, making it deterministic and safe.
A simple renderer that:
- sends command requests
- prints output events
- decodes OEM bytes correctly
- supports large outputs (tree, git, npm, etc.)
It demonstrates how any UI (CLI, GUI, web, AI agent) can subscribe to the bus.
Every interaction is a typed event with:
- ID
- correlation ID
- timestamp
- source
- target
- payload type
- payload bytes
Each command runs in a fresh process.
No hidden shell state.
No PTY.
No ANSI.
No terminal modes.
Long-running commands such as:
- tree c:\
- npm install
- git clone
run to completion without interruption.
Windows console tools output OEM codepage bytes.
UAIOB decodes them correctly, avoiding Unicode errors.
You can add:
- GitAgent
- FSAgent
- PromptAgent
- AIHelperAgent
- BuildAgent
- TestAgent
All communicating over the same bus.
Because output is structured, AI systems can:
- summarize
- detect errors
- extract paths
- understand progress
- orchestrate workflows
No scraping terminal text.
Start the demo:
Universal Agent I/O Bus Demo
Type a command to run (or blank line to exit).
dir
Run anything:
ipconfig
git status
tree /A
python script.py
node --version
All output streams through the bus as structured events.
UAIOB is not just a shell wrapper.
It is the foundation for a new class of CLIs:
- multi-agent
- event-driven
- AI-augmented
- deterministic
- cross-platform
- extensible
It enables a future where:
- CLIs are orchestrated by agents
- output is structured, not scraped
- workflows are intelligent
- terminals are optional
- AI can reason about command execution in real time
This is the architecture a modern Gemini CLI deserves.
You can extend UAIOB with:
- virtual working directory ("cd" support)
- environment variable agent
- GitAgent with structured JSON output
- AIHelperAgent for suggestions and automation
- remote execution over TCP or WebSockets
- GUI renderer
- session manager
Each extension is just another agent on the bus.
UAIOB is built on three principles:
-
Everything is an event
No streams. No terminals. No hidden state. -
Agents, not shells
Each domain has its own agent. The shell is just one of them. -
Structure over text
Machines should not parse ANSI.
Humans should not fight terminals.
AI should not guess semantics.