CLI Interface
Interact with PandaAGI agents from your terminal
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
Install Dependencies
Ensure you have Python 3.9+ and the PandaAGI SDK installed:
The CLI requires the rich
library for enhanced terminal output.
Set Your API Key
Set your PandaAGI API key as an environment variable:
You can add this to your shell profile for persistence.
Run the CLI
Start the CLI with default settings:
This creates a workspace in ./my_agent_workspace
and starts an interactive session.
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.
help
to see all available CLI commands.Key Features
Command Line Options
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 |
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 |
The CLI respects the same environment variables as the SDK:
These can be set in your shell profile or before running the CLI.
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 the stats
command:
Example Session Statistics
You can also view a summary of events by category using the history
command:
Event History Summary
Workspace Management
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.
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.
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