Skip to main content

TUI

The @tui decorator wraps a @llm_chat agent into a full Textual terminal UI with streaming output, tool visualization, and input handling.

Basic Usage

Run it and you get a full chat interface in the terminal.

Features

  • Streaming display — Model responses appear character-by-character
  • Tool call cards — Each tool call gets a visual card showing name, arguments, and result
  • Specialized cardsexecute_code, read_file, grep, sed, echo_into have custom rendering
  • AbortCtrl+C cancels the current response
  • CopyCtrl+Y copies the full transcript to clipboard
  • Multi-column forks — When using SelfRef forks, child agents get their own columns

Slash Commands

Custom Event Hooks

Handle custom events (e.g., PyRepl streaming output) with hooks:

Decorator Parameters

ToolRenderSnapshot

Passed to event hooks with context about the current tool card:

Keyboard Shortcuts

When to Use @tui vs Custom UI

Use @tui when:
  • You want a working chat interface quickly
  • The built-in tool cards are sufficient
  • You don’t need custom widgets or layouts
Build custom when:
  • You need confirmation modals for dangerous actions
  • You want a status bar with custom metrics
  • You need non-chat UI elements (file trees, progress bars)
  • You’re building a product, not a tool
For custom UIs, consume the ReactOutput stream directly and render with Textual or any other framework.