Base Agent
TheBaseAgent
class is the foundation for all PilottAI agents. It provides the core functionality for job execution, tool management, and memory integration.
Overview
TheBaseAgent
is responsible for:
- Executing jobs using LLMs
- Managing specialized tools
- Maintaining job context
- Tracking execution status
- Storing and retrieving memory
Class Definition
Configuration
TheBaseAgent
is configured using the AgentConfig
class:
Key Methods
Job Execution
- Planning execution steps using LLM
- Executing each step with proper error handling
- Monitoring execution status and timeout
- Recording execution in memory
- Returning structured results
Job Suitability Evaluation
- Checking required capabilities
- Matching job type with agent specializations
- Considering current agent load
- Analyzing job complexity
Lifecycle Management
- Initializing components
- Setting up connections
- Updating status
- Cleaning up resources
Job Execution Pipeline
TheBaseAgent
follows a structured approach to job execution:
- Job Formatting: Prepare job with context
- Execution Planning: Generate a plan using LLM
- Step Execution: Execute each step in the plan
- Tool Invocation: Use tools as required
- Result Summarization: Summarize and format results
System Prompts
TheBaseAgent
uses system prompts to guide LLM behavior. The base system prompt follows this template:
Error Handling
TheBaseAgent
implements robust error handling:
- Job timeouts
- LLM errors
- Tool execution failures
- Context validation
Memory Integration
Agents maintain their own memory instance for:- Job history tracking
- Context preservation
- Knowledge storage
- Pattern recognition
Extending BaseAgent
To create a specialized agent, extend theBaseAgent
class:
Examples
Creating a Basic Agent
Executing a Job
API Reference
For a complete reference of allBaseAgent
methods and attributes, see the Agent API documentation.