Message Queue
PraisonAI CLIās Interactive Mode supports message queuing, allowing you to type new prompts while the AI agent is still processing a previous task. Messages are queued and executed sequentially as each task completes. This feature is inspired by Claude Code, Windsurf Cascade, Cursor, and Gemini CLI.Overview


- Non-blocking input - Type new messages while agent is processing
- FIFO processing - Messages are processed in order (First In, First Out)
- Visual indicators - See queue status and pending messages
- Queue management - View, clear, or remove queued messages
- Thread-safe - Safe concurrent access from multiple threads
Quick Start
How It Works
- User types a message - If agent is idle, it processes immediately
- Agent is busy - Message is added to the queue
- Agent completes - Next message in queue is automatically processed
- Queue is empty - Agent returns to idle state
Queue Commands
Viewing the Queue
Clearing the Queue
Removing a Specific Message
Live Status Display
While the agent is processing, a live status panel shows real-time updates:ā³ Thinking...- Initial processingā³ Creating agent...- Setting up the agentā³ Calling LLM...- Making the API call
Visual Indicators
The queue system provides visual feedback:Processing States
The agent can be in one of three states:Example Workflow
Programmatic Usage
You can also use the message queue programmatically:Using the Handler
Visual Display
API Reference
MessageQueue
StateManager
QueueDisplay
MessageQueueHandler
Thread Safety
The message queue is thread-safe and usesthreading.Lock for all operations. This ensures safe concurrent access when:
- User input thread adds messages
- Processing thread pops messages
- Display thread reads queue status
Performance
The message queue is designed for minimal performance impact:- Lazy loading - Module only loaded when interactive mode starts
- Simple data structure - Python list with O(1) append, O(n) pop(0)
- No external dependencies - Uses only Python standard library
- Minimal memory - Stores only message strings
Comparison with Other Tools
Async Processing Classes
The message queue includes additional classes for async processing:AsyncProcessor
Runs work functions in background threads:LiveStatusDisplay
Tracks and displays real-time status:NonBlockingInput
Manages async user input:Related Features
Interactive TUI
Full interactive terminal interface
Slash Commands
All available slash commands
Cost Tracking
Monitor token usage and costs
Session Management
Save and restore sessions

