What are General AI Agents?
General AI Agents are the core building blocks of the PandaAGI SDK. They are autonomous AI entities that can understand natural language, make decisions, use tools, and interact with their environment to accomplish tasks. PandaAGI general AI agents consist of four key components:- WebSocket Communication: Real-time bidirectional connection with the AGI backend server
- Tool Handlers: Pluggable modules that provide different capabilities and tool access
- Environment Integration: Isolated workspace for secure file and system operations
- Event Streaming: Real-time transmission of agent thoughts, actions, and results
Creating General AI Agents
Basic General AI Agent
The simplest way to create an agent:General AI Agent with Custom Configuration
For more control over agent behavior:Models
PandaAGI offers two powerful agentic models to suit your needs. You can specify the model using themodel parameter in the Agent constructor.
| Model | Description |
|---|---|
annie-pro | Our most powerful and advanced generalist agentic technology. It excels at complex reasoning, multi-step task planning, and sophisticated skill integration. This is the recommended model for production applications that require high accuracy and robust performance. |
annie-lite | A super powerful, yet lightweight, generalist agentic model optimized for speed and efficiency, at a fraction of the cost. It’s ideal for rapid prototyping, simple automation tasks, and applications where response time is critical. |
annie-pro. You can select annie-lite like this:
Using Environment Variables
Set your API key in environment variables:How do general AI agents work?
Understanding how agents work internally:1
Initialization
General AI agent initializes WebSocket client, event manager, and tool handlers
2
Connection
General AI agent establishes WebSocket connection and waits for initialization
3
Request Processing
General AI agent sends query and begins streaming events in real-time
4
Event Streaming
General AI agent streams thoughts, tool usage, and results as they happen
5
Completion
General AI agent signals task completion and can handle new requests
How to configure general AI agents?
Environment Setup
Configure the agent’s workspace:Tool Handlers
Customize tool handling behavior:Conversation Context
Enable follow-up questions and maintain context across multiple requests:- Context Retention: Agent remembers previous questions and answers
- Natural Conversations: Ask follow-up questions without repeating context
- Session Persistence: Maintain conversations across multiple script runs
conversation_id must be a valid UUID4 string generated with str(uuid.uuid4()). This ensures proper conversation tracking and prevents conflicts.
Multi-Turn Conversations
Build complex interactions with follow-up questions:Available Event Types
General AI agents emit various types of events during execution. For complete details on all events, see the Events documentation.- File Operations: FILE_READ, FILE_WRITE, FILE_REPLACE, FILE_FIND, FILE_EXPLORE
- Web Operations: WEB_SEARCH, WEB_NAVIGATION, WEB_SEARCH_RESULT, WEB_NAVIGATION_RESULT
- Shell Operations: SHELL_EXEC, SHELL_VIEW, SHELL_WRITE
- Communication: AGENT_CONNECTION_SUCCESS, USER_NOTIFICATION, USER_QUESTION, COMPLETED_TASK
- Media Generation: IMAGE_GENERATION
- Skill Execution: USE_SKILL, USE_SKILL_RESULT