AIAgent Documentation

Overview

The AIAgent class provides a robust framework for creating and managing AI agents with configurable roles, capabilities, and security settings. It includes features such as rate limiting, permission management, and integration with various third-party services.

Installation

// Include the AI Employee script
<script src="js/ai-employee.js"></script>

Configuration Parameters

Parameter Type Default Description
role string "Senior Developer" Defines the role of the AI agent
capabilities array ["coding", "architecture", "planning"] List of agent capabilities
mode string "autonomous" Operating mode of the agent
maxAutonomousActions number 10 Maximum number of autonomous actions before requiring review
safeMode boolean true When true, requires permission for potentially risky operations
rateLimitPerMinute number 60 Limit of actions per minute to prevent overload
logging boolean true Enable detailed logging of all actions

Service Integration

AIAgent supports integration with various third-party services:

const agent = new AIAgent({
  services: {
    anthropic: {
      enabled: true,
      credentials: "your-api-key"
    }
  }
});

Permission Configuration

The permission system allows fine-grained control over agent actions:

Category Permissions Description
fileSystem read, write, delete Controls file system access permissions
network outbound, inbound Controls network access permissions
system execute, install Controls system-level operation permissions

Methods

executeAction(action)

Executes an action after checking rate limits and permissions.

await agent.executeAction({
  type: { category: 'fileSystem', action: 'write' },
  details: 'Writing to config file'
});

configureService(serviceName, credentials)

Configures a third-party service with the provided credentials.

agent.configureService('anthropic', 'api-key-here');

getStatus()

Returns the current status of the agent including role, mode, and action count.

const status = agent.getStatus();