Interactive TUI for Sage AI agent
Project description
sage-tui
Interactive terminal user interface for the Sage AI agent framework.
Features
- Split-screen layout with chat, status, and log panels
- Streaming and batch response modes with animated thinking indicator
- Collapsible tool call display with color-coded status (running, success, error)
- Markdown rendering for agent responses
- Permission modal for tool approval
- Parallel subagent orchestration
- Context window usage bar with color gradient
- Token breakdown and session cost tracking
- Auto-generated session titles via LLM
- Input history navigation
- Smart auto-scroll that respects manual scroll position
- Log forwarding to TUI panel
Installation
uv add sage-tui
Or with pip:
pip install sage-tui
Requires Python 3.10 or later.
Quick Start
# Point directly at an agent definition
sage-tui -c /path/to/AGENTS.md
# Or use a config.toml
sage-tui --config /path/to/config.toml
# Or set the env var and just run
export SAGE_CONFIG_PATH=/path/to/config.toml
sage-tui
CLI Options
| Option | Description |
|---|---|
--agent-config, -c PATH |
Path to AGENTS.md or directory containing one. Inferred from config.toml if omitted. |
--config PATH |
Path to main config.toml. Also reads the SAGE_CONFIG_PATH env var. |
--verbose, -v |
Enable debug logging. |
Keyboard Shortcuts
| Key | Action |
|---|---|
| Enter | Submit message |
| Shift+Enter / Ctrl+J | Insert newline |
| Up / Down | Navigate input history (single-line mode) |
| Ctrl+B | Toggle status panel |
| Ctrl+L | Toggle log panel |
| Ctrl+N | New session (clear chat, reset agent) |
| Ctrl+S | Toggle streaming / batch mode |
| Ctrl+O | Orchestrate subagents (if available) |
| Ctrl+Q | Quit |
| Y / N | Approve or deny in permission modal |
Layout
The TUI is divided into four areas:
- Chat panel (left, flexible width) -- Conversation history with inline collapsible tool calls and a message input box at the bottom.
- Status panel (right, 40 columns, hidden by default) -- Session info, context window usage bar, token breakdown, agent info, skills, and active agents. Toggle with Ctrl+B.
- Log panel (bottom, hidden by default) -- Scrollable log viewer for the
sage.*logging namespace. Toggle with Ctrl+L. - Status bar (bottom, 1 line) -- Agent state, model name, stream mode indicator, token usage, cost, and keyboard hints.
Configuration
There are three ways to configure which agent the TUI loads:
1. Direct agent path
sage-tui -c /path/to/AGENTS.md
Point at an AGENTS.md file or a directory that contains one.
2. Via config.toml
sage-tui --config /path/to/config.toml
The TUI reads the agents_dir and primary fields from config.toml to resolve the primary agent definition.
3. Auto-discovery
export SAGE_CONFIG_PATH=/path/to/config.toml
sage-tui
When no flags are given, the TUI reads the SAGE_CONFIG_PATH environment variable, locates config.toml, and resolves the primary agent from there.
A .env file in the working directory is loaded automatically via python-dotenv.
Streaming vs Batch
The TUI supports two response modes, toggled at runtime with Ctrl+S. In streaming mode, tokens appear incrementally as the model generates them, with an animated thinking indicator while waiting. In batch mode, the full response is displayed only after generation completes. Streaming is the default.
Development
See CONTRIBUTING.md for development setup and guidelines.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sage_tui-0.1.0.tar.gz.
File metadata
- Download URL: sage_tui-0.1.0.tar.gz
- Upload date:
- Size: 228.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc931604c7ce5240a692522ae06853c50cf8dc8dc9a6a9988e1a492dbe4676b1
|
|
| MD5 |
ce25dd3c3fee0af9b9ae2eb59e008c26
|
|
| BLAKE2b-256 |
2e7df974a7d75cd5a0e7827395acf5887baf7f34b0e1c9576e27755de63394bf
|
Provenance
The following attestation bundles were made for sage_tui-0.1.0.tar.gz:
Publisher:
release.yml on sagebynature/sage-tui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sage_tui-0.1.0.tar.gz -
Subject digest:
fc931604c7ce5240a692522ae06853c50cf8dc8dc9a6a9988e1a492dbe4676b1 - Sigstore transparency entry: 1013261084
- Sigstore integration time:
-
Permalink:
sagebynature/sage-tui@e7dd6621c69bfa80113331640912c1a88acb7f91 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sagebynature
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e7dd6621c69bfa80113331640912c1a88acb7f91 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sage_tui-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sage_tui-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bb0c3f98c3afaa04bf4e8535db82fdb570280fe629d68e29aa60486066f0b0e
|
|
| MD5 |
aa4c111cab0d60b47e2b564c360f3ef8
|
|
| BLAKE2b-256 |
00d39f55a7d2c1b781850ddf07f4828becf175cc0e0c10c32ad86123c1cd7ff5
|
Provenance
The following attestation bundles were made for sage_tui-0.1.0-py3-none-any.whl:
Publisher:
release.yml on sagebynature/sage-tui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sage_tui-0.1.0-py3-none-any.whl -
Subject digest:
0bb0c3f98c3afaa04bf4e8535db82fdb570280fe629d68e29aa60486066f0b0e - Sigstore transparency entry: 1013261104
- Sigstore integration time:
-
Permalink:
sagebynature/sage-tui@e7dd6621c69bfa80113331640912c1a88acb7f91 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sagebynature
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e7dd6621c69bfa80113331640912c1a88acb7f91 -
Trigger Event:
push
-
Statement type: