Skip to main content

AI Log Inspector Agent Documentation

Welcome to the complete documentation for the AI Log Inspector Agent - a production-ready PHP package for intelligent log analysis powered by AI.

๐Ÿ“š Documentation Sectionsโ€‹

Introductionโ€‹

Get familiar with the package and its capabilities.

Getting Startedโ€‹

Install and configure your first log inspector.

Core Conceptsโ€‹

Understand the architecture and design principles.

Toolsโ€‹

Deep dive into available tools and how to use them.

Usage & Featuresโ€‹

Learn how to use the package effectively.

Advanced Topicsโ€‹

Production deployment and optimization.

API Referenceโ€‹

Complete API documentation.

Examplesโ€‹

Real-world code examples and patterns.

๐ŸŽฏ Common Tasksโ€‹

How do I...โ€‹

...install the package?
โ†’ See Installation

...create my first agent?
โ†’ Follow the Quick Start guide

...search logs semantically?
โ†’ Use LogSearchTool

...trace a request across services?
โ†’ Use RequestContextTool

...use conversations instead of single questions?
โ†’ Check out the Chat Interface

...switch AI providers (OpenAI/Anthropic/Ollama)?
โ†’ Read Multi-Platform Usage

...deploy to production?
โ†’ Follow Best Practices

...create custom tools?
โ†’ See Custom Tools Guide

๐Ÿ’ก Key Featuresโ€‹

๐Ÿง  Intelligent Analysisโ€‹

Ask natural language questions and get AI-powered answers with evidence citations.

$agent->ask('Why did the payment fail for order #12345?');
// โ†’ AI explains root cause with supporting log entries

๐Ÿ’ฌ Conversational Debuggingโ€‹

Multi-turn conversations that remember context.

$chat->ask('What errors occurred?');
$chat->followUp('Were there database issues?');
$chat->ask('What was the root cause?');

Understands meaning, not just keywords.

// Finds "transaction timeout", "payment gateway error", etc.
$agent->ask('payment problems');

๐Ÿ› ๏ธ Extensible Toolsโ€‹

Build your own tools for custom analysis.

$agent = new LogInspectorAgent($platform, [
$logSearchTool,
$requestContextTool,
$customSecurityTool // Your custom tool
]);

๐ŸŽฏ Multi-Platformโ€‹

Works with OpenAI, Anthropic, Ollama, and custom platforms.

// Switch providers without changing your code
$agent = LogInspectorAgentFactory::createWithOpenAI($apiKey);
// OR
$agent = LogInspectorAgentFactory::createWithAnthropic($apiKey);
// OR
$agent = LogInspectorAgentFactory::createWithOllama('llama3.2:1b');

๐Ÿงช Production Readyโ€‹

โœ… 13/13 tests passing with real AI integrations
โœ… 104+ assertions across unit, functional, and integration tests
โœ… Real log examples from Laravel, Kubernetes, microservices
โœ… PHP 8.4+ compatible with modern type system
โœ… Symfony AI powered using battle-tested components

๐Ÿ“– Learn by Exampleโ€‹

Simple Queryโ€‹

require 'vendor/autoload.php';

$agent = LogInspectorAgentFactory::createWithOpenAI($_ENV['OPENAI_API_KEY']);

// Load logs
foreach ($logs as $log) {
$agent->indexLog(TextDocumentFactory::createFromString($log));
}

// Ask questions
$result = $agent->ask('Show me all payment errors');
echo $result->getContent();

Conversational Investigationโ€‹

$chat = LogInspectorChatFactory::createWithOpenAI($_ENV['OPENAI_API_KEY']);
$chat->startInvestigation('Payment incident - Jan 29');

echo $chat->ask('What payment errors occurred?')->getContent();
echo $chat->followUp('What was the root cause?')->getContent();
echo $chat->summarize()->getContent();

Request Tracingโ€‹

$agent = new LogInspectorAgent($platform, [
new LogSearchTool($store, $retriever, $platform),
new RequestContextTool($store, $retriever, $platform)
]);

// Trace complete request lifecycle
$result = $agent->ask('Debug request req_12345');
// โ†’ Shows all logs across all services for that request

๐Ÿค Contributingโ€‹

This is an open-source project. Contributions are welcome!

๐Ÿ“ Licenseโ€‹

MIT License - see LICENSE file for details.

๐Ÿ†˜ Need Help?โ€‹


Ready to get started? โ†’ Begin with the Quick Start Guide

Want to understand the architecture? โ†’ Read the Architecture Overview

Looking for examples? โ†’ Browse the Examples section