The PandaAGI CLI provides a powerful terminal-based interface for interacting with agents, perfect for developers who prefer command-line tools or need to integrate agents into scripts and automation workflows.

PandaAGI CLI Interface
Why Use the CLI?
Developer-Friendly
Perfect for developers who prefer working in the terminal or need to integrate with scripts and automation workflows.
Lightweight
Minimal resource usage with the same powerful agent capabilities as the web interface.
Real-Time Feedback
Watch the agent’s thinking process, actions, and results in real-time with rich visual feedback.
Session Persistence
Resume conversations and keep context across multiple sessions with conversation IDs.
Quick Start
1
Install Dependencies
Ensure you have Python 3.9+ and the PandaAGI SDK installed:The CLI requires the
rich library for enhanced terminal output.2
Set Your API Key
Set your PandaAGI API key as an environment variable:You can add this to your shell profile for persistence.
3
Run the CLI
Start the CLI with default settings:This creates a workspace in
./my_agent_workspace and starts an interactive session.4
Start Interacting
Type your message and press Enter to send it to the agent. You’ll see the agent’s thinking process, actions, and responses in real-time.
Type
help to see all available CLI commands.Key Features
Real-Time Event Streaming
Real-Time Event Streaming
Watch the agent’s thinking process, actions, and responses as they happen with color-coded event types and timestamps.
Conversation History
Conversation History
The CLI maintains conversation history within a session and allows you to resume conversations using conversation IDs.This is particularly useful for long-running tasks or when you need to continue work across different sessions.
Interactive Commands
Interactive Commands
The CLI supports special commands to control the session:
help- Show available commandsclear- Clear the screenexit,quit, orq- Exit the CLIstats- Show detailed session statisticsstatus- Show current status and statisticshistory- Show event history summaryreset- Reset session statistics
Rich Visual Feedback
Rich Visual Feedback
The CLI uses the
rich library to provide enhanced visual feedback:- Color-coded event categories (system, user, web, file, shell, image)
- Custom icons for different event types (🔗, 💬, 🔍, 📖, 💻, 🎨)
- Progress bars for long-running operations
- Syntax highlighting for code snippets
- Panels with rounded or heavy borders for visual organization
- Comprehensive session statistics and event history tracking
Command Line Options
- Options Reference
- Environment Setup
| Option | Short | Description | Default |
|---|---|---|---|
--workspace | -w | Path to agent workspace directory | ./my_agent_workspace |
--conversation-id | Resume an existing conversation by ID | None | |
--no-timestamps | Disable timestamp display in events | False | |
--width | Panel width in characters | 120 | |
--compact | -c | Use compact display mode for better performance | False |
--verbose | -v | Show additional debug information and full tracebacks | False |
Visual Event Categories
System Events
- 🔗 Connection Established
- 🎯 Task Completed
- ⚙️ System Operations
User Interaction
- 💬 User Notification
- ❓ User Question
- 👤 User Input
Web Operations
- 🔍 Web Search
- 📊 Web Search Results
- 🌐 Web Navigation
- 📄 Web Page Content
File Operations
- 📖 File Read
- ✏️ File Write
- 🔄 File Replace
- 🔎 File Find
- 📁 File Explore
Shell Operations
- 💻 Shell Execute
- 👁️ Shell View
- ⌨️ Shell Write
AI Operations
- 🤖 Agent Actions
- 🎨 Image Generation
- 🧠 Thinking Process
Advanced Usage
Session Statistics
The CLI automatically tracks and can display comprehensive session statistics using thestats command:
Example Session Statistics
history command:
Event History Summary
Workspace Management
1
Default Workspace
The CLI automatically creates and manages a workspace directory at
./my_agent_workspace unless specified otherwise. This workspace is where the agent stores files and other artifacts it creates during operation.2
Custom Workspace
You can specify a custom workspace directory:This is useful when working on different projects or when you want to isolate agent workspaces.
3
Persistent Conversations
The CLI supports resuming conversations across sessions using the conversation ID:This allows for long-running tasks to be continued even after closing the terminal.
Workspace Contents
The workspace directory contains all artifacts created during agent operations:- Files created or modified by the agent
- Downloaded web content and search results
- Generated images and other media
- Temporary files and execution artifacts
- Conversation history and context data