Skip to main content

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.txt syntax
  • 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 support - Revert last turn with /undo
  • 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 from agent.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.
For interactive coding, prefer a provider whose OpenAI-compatible endpoint streams (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 the Q: / A: header prints on the first streamed delta, the body streams in live, and the completion line renders only after the streamed body finishes:
The completion line never appears before the answer, and no leading word-replay precedes the streamed body.

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

Model Switching

Change models on-the-fly without restarting:

Session Statistics

Track token usage and estimated costs:
Use /stats regularly to monitor your token usage and avoid unexpected costs.

Context Compression

When conversations get long, use /compact to summarize older history:
This feature is inspired by Claude Code’s /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:

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

Messages are processed in FIFO order (First In, First Out). The agent automatically processes the next queued message when the current task completes.

Message Queue

See the full Message Queue documentation for programmatic usage and API reference.

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 from agent.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 level
  • execute_command - CRITICAL risk level
Rejecting a tool call takes an optional one-line reason that flows back to the agent as the tool’s result. See Reject with a Reason.

Python API

Basic Usage

Configuration

Custom Completions

History Management

Status Display

Keyboard Shortcuts

Editing

Multi-line

VI Mode

Enable VI keybindings:
VI mode shortcuts:
  • Esc - Enter command mode
  • i - Insert mode
  • a - Append mode
  • dd - 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

  1. Use @file mentions - Include relevant files directly in prompts for context
  2. Monitor with /stats - Check token usage regularly to avoid surprises
  3. Use /compact - Compress history when conversations get long
  4. Switch models - Use /model gpt-4o-mini for simple tasks, /model gpt-4o for complex ones
  5. Enable profiling - Use /profile to identify slow operations
  6. Use completions - Press Tab often for faster input
  7. 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 conversation
  • tool_trace.jsonl - Structured tool call trace
  • result.json - Test result with assertions
  • workspace/ - Snapshot of workspace files
  • judge_result.json - LLM judge evaluation (if rubric provided)

CLI Options

GitHub Advanced Tests

The github-advanced suite provides 5 end-to-end GitHub workflow scenarios that exercise real GitHub operations: Prerequisites:
  • gh CLI installed and authenticated
  • PRAISON_LIVE_NETWORK=1 environment variable
Artifacts Generated:
  • RUNBOOK.md - Step-by-step execution log
  • gh_repo_view.json - Repository state
  • gh_issue_list.json - Issues created
  • gh_pr_list.json - Pull requests created
  • transcript.txt - Full conversation
  • tool_trace.jsonl - Tool call trace
  • verifications.json - Verification results