Interactive TUI
PraisonAI CLI provides a rich interactive terminal user interface (TUI) for seamless AI-assisted coding sessions. Inspired by Gemini CLI, Codex CLI, and Claude Code, it offers real token streaming, built-in tools, and a clean terminal experience.Overview
The Interactive TUI provides:- Real token streaming - Model deltas rendered as they arrive, real time-to-first-token
- Built-in tools - File operations, shell commands, web search
- Slash commands -
/help,/model,/stats,/compact,/undo,/queue, and more - @file mentions - Include file content with
@file.txtsyntax - Shell escape -
!cmdruns a shell command inline (gated byPRAISONAI_ALLOW_SHELL);!!cmdalso attaches the output as context for the next prompt. See Shell Escape. - Message queuing - Queue messages while agent is processing
- Model switching - Change models on-the-fly with
/model - Token tracking - Monitor usage and costs with
/stats - Context compression - Summarize history with
/compact - Undo/revert - roll files + conversation back with
/undo(last turn) and/revert [n](last n turns) — on by default - Queue management - View and manage queued messages with
/queue - Profiling - Measure response times with
/profile - Tool status indicators - See when tools are being used
- Clean UX - No cluttered panels, just streaming text
Streaming
The interactive CLI consumes real token streaming fromagent.iter_stream() — every chunk you see is a live model delta, rendered as it arrives, giving you real time-to-first-token instead of a finished string replayed word-by-word.
If a provider does not support streaming, the CLI transparently falls back to a single non-streamed
agent.chat() response — the answer still arrives, just as one block. No configuration required.openai, anthropic, gemini, most LiteLLM providers) — you will see real time-to-first-token. See Streaming for the SDK-level API and provider coverage.
Verbose Mode Order
In verbose mode theQ: / A: header prints on the first streamed delta, the body streams in live, and the completion line renders only after the streamed body finishes:
Quick Start
Chat Mode (Non-Interactive Testing)
For testing and scripting, use--chat (or praisonai chat) to run a single prompt with interactive-style output:
--chat is different from praisonai chat which starts a web-based Chainlit UI. The praisonai chat flag is an alias for backward compatibility.Built-in Tools
Interactive mode comes with 13 built-in tools across 3 groups:ACP Tools (Agentic Change Plan)
LSP Tools (Code Intelligence)
Basic Tools
Slash Commands
@File Mentions
Include file content directly in your prompts using@ syntax, inspired by Gemini CLI and Claude Code. @file and @dir mentions submit through the same expansion path as the legacy REPL — the file’s contents are inlined before the prompt reaches the model on every surface.
- Files larger than 50KB are automatically truncated
- Hidden files and common ignore patterns (node_modules, pycache) are filtered from directory listings
- Paths can be relative or absolute
- Use
~for home directory (e.g.,@~/Documents/file.txt)
Shell Escape
Run a shell command inline with the! prefix — no model turn is spent. !!cmd also attaches the output as context for your next prompt.
PRAISONAI_ALLOW_SHELL (default off). See Shell Escape for configuration, safety limits, and failure behaviour.
Model Switching
Change models on-the-fly without restarting:Session Statistics
Track token usage and estimated costs:/stats and /cost are the same output in the async TUI — one renderer, two names. Both are also available in the legacy REPL and praisonai chat, so the command works whichever surface you’re on.Context Compression
When conversations get long, use/compact to summarize older history:
/compact and Gemini CLI’s /compress. It:
- Keeps the last 2 conversation turns intact
- Summarizes older turns using the LLM
- Reduces token usage for long sessions
- Preserves key context and decisions
Undo Support
Made a mistake? Use/undo to remove the last conversation turn:
/undo rolls the workspace and the conversation back to the previous turn boundary. Checkpointing is on by default in the async TUI — opt out with checkpoints.auto: false or PRAISONAI_CHECKPOINTS=off. The TUI captures a session-start baseline on launch and a pre-turn checkpoint before every submission, so /undo unwinds one turn at a time:
/undo prints an enable hint; if no turns are recorded yet it prints Undo: No checkpoints yet — nothing to undo. See Checkpoints for config-precedence details.
Revert N turns
Use/revert [n] to roll files + conversation back by more than one turn at a time:
/revert refuses to run beyond the recorded turn count:
Diff
Been editing files for a while and want to see what changed? Type/diff to see workspace file changes since session start.
/diff uses the session-start baseline captured on launch, so it includes edits from earlier turns. It requires auto-checkpointing. When checkpointing is off it prints, verbatim:
Message Queue
Queue messages while the AI agent is processing. Type new prompts and they’ll be executed in order as each task completes.Queue Commands
Message Queue
See the full Message Queue documentation for programmatic usage and API reference.
Interrupting a Turn
PressCtrl-C while the agent is thinking and the current turn stops at the next step boundary — the partial output is kept, the warm agent stays loaded, and the session is intact. Type the next prompt immediately.
What happens
Each turn runs in a worker thread wired to anInterruptController — the same cooperative-cancellation primitive the core chat loop already checks at every step boundary. Ctrl-C requests the interrupt on the main thread; the worker observes it at the next check and returns.
One press vs. two
While a cancel is in flight
If you pressCtrl-C twice and try to start a new turn before the previous one has observed the cancel, the CLI refuses cleanly rather than double-booking the shared controller:
Between turns, a stale
Ctrl-C you pressed while nothing was running does not kill the next turn — the interrupt is cleared at the start of every fresh turn. You only cancel what is actually running.Profiling
Enable profiling to see timing breakdown:Output Comparison
Interactive Mode (Clean)
Regular Mode (Verbose)
Features
Streaming Responses
Responses stream token-by-token as real model deltas fromagent.iter_stream(), similar to Gemini CLI and Claude Code. When a provider cannot stream, the CLI falls back to a single agent.chat() call and prints the completed answer as one block. See the Streaming section above.
Tool Status Indicators
When tools are used, you’ll see status indicators:Security
High-risk tools require approval:write_file- HIGH risk levelexecute_command- CRITICAL risk level
Python API
Basic Usage
Configuration
Custom Completions
History Management
Status Display
Keyboard Shortcuts
Navigation
Editing
Multi-line
VI Mode
Enable VI keybindings:Esc- Enter command modei- Insert modea- Append modedd- Delete line/- Search
Customization
Custom Prompt
Dynamic Prompt
Custom Theme
Integration
With Slash Commands
With Cost Tracking
Fallback Mode
If prompt_toolkit is not available, a simple fallback is used:Best Practices
- Use @file mentions - Include relevant files directly in prompts for context
- Monitor with /stats - Check token usage regularly to avoid surprises
- Use /compact - Compress history when conversations get long
- Switch models - Use
/model gpt-4o-minifor simple tasks,/model gpt-4ofor complex ones - Enable profiling - Use
/profileto identify slow operations - Use completions - Press Tab often for faster input
- Learn shortcuts - Ctrl+R for history search is powerful
Feature Comparison
PraisonAI Interactive Mode compared to other AI CLI tools:Troubleshooting
Completions Not Working
History Not Persisting
Display Issues
@File Mentions Not Working
Testing Interactive Mode
PraisonAI provides a CSV-driven test runner for testing interactive mode functionality. This is useful for:- Validating tool execution (ACP/LSP tools)
- Testing multi-step workflows
- Automated regression testing
- CI/CD integration
Running Interactive Tests
CSV Test Format
Tests are defined in CSV format with the following columns:
Example CSV:
Test Artifacts
When running with--keep-artifacts, each test generates:
transcript.txt- Full conversationtool_trace.jsonl- Structured tool call traceresult.json- Test result with assertionsworkspace/- Snapshot of workspace filesjudge_result.json- LLM judge evaluation (if rubric provided)
CLI Options
GitHub Advanced Tests
Thegithub-advanced suite provides 5 end-to-end GitHub workflow scenarios that exercise real GitHub operations:
Prerequisites:
ghCLI installed and authenticatedPRAISON_LIVE_NETWORK=1environment variable
RUNBOOK.md- Step-by-step execution loggh_repo_view.json- Repository stategh_issue_list.json- Issues createdgh_pr_list.json- Pull requests createdtranscript.txt- Full conversationtool_trace.jsonl- Tool call traceverifications.json- Verification results
Related Features
- Message Queue - Queue messages while agent is processing
- Slash Commands - Full slash command reference
- Cost Tracking - Detailed cost monitoring
- Session - Session management
- Session Forking - Fork mid-session with
/branch - Mentions - @file mention syntax
- Git Integration - Git workflow support

