Skip to main content

Base Agent

The BaseAgent class is the foundation for all PilottAI agents. It provides the core functionality for job execution, tool management, and memory integration.

Overview

The BaseAgent is responsible for:
  • Executing jobs using LLMs
  • Managing specialized tools
  • Maintaining job context
  • Tracking execution status
  • Storing and retrieving memory

Class Definition

Configuration

The BaseAgent is configured using the AgentConfig class:

Key Methods

Job Execution

The job execution process involves:
  1. Planning execution steps using LLM
  2. Executing each step with proper error handling
  3. Monitoring execution status and timeout
  4. Recording execution in memory
  5. Returning structured results

Job Suitability Evaluation

This method determines how well an agent can handle a specific job by:
  • Checking required capabilities
  • Matching job type with agent specializations
  • Considering current agent load
  • Analyzing job complexity

Lifecycle Management

These methods handle the agent’s lifecycle, including:
  • Initializing components
  • Setting up connections
  • Updating status
  • Cleaning up resources

Job Execution Pipeline

The BaseAgent follows a structured approach to job execution:
  1. Job Formatting: Prepare job with context
  2. Execution Planning: Generate a plan using LLM
  3. Step Execution: Execute each step in the plan
  4. Tool Invocation: Use tools as required
  5. Result Summarization: Summarize and format results

System Prompts

The BaseAgent uses system prompts to guide LLM behavior. The base system prompt follows this template:

Error Handling

The BaseAgent 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 the BaseAgent class:

Examples

Creating a Basic Agent

Executing a Job

API Reference

For a complete reference of all BaseAgent methods and attributes, see the Agent API documentation.