Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
4.7 KiB
4.7 KiB
AI Automation Platform
The AI automation platform provides intelligent browser automation with LLM integration. It enables AI agents to interact with web applications through a comprehensive API that includes browser control, UI state monitoring, and codebase analysis.
Architecture
AI Web Service (Next.js) AI API Service (Puppeteer)
Port 3000 Port 4000
┌─────────────────────┐ ┌──────────────────────┐
│ - Control Panel │────▶│ - Browser Sessions │
│ - LLM Integration │ │ - UI State Manager │
│ - Streaming Chat │ │ - Automation Tools │
│ - Tool Dispatch │ │ - WebSocket Hub │
└─────────────────────┘ └──────────────────────┘
The platform consists of two main services:
- AI Web Service - Next.js frontend with LLM integration
- AI API Service - Backend automation server with Puppeteer
Key Features
- Browser Session Management - Seamless headless/headed mode switching
- Real-time UI State Monitoring - WebSocket-based state updates
- LLM Tool Integration - AI agents with automation capabilities
- Codebase Analysis - File system navigation and code inspection
- Visual Feedback - Live screenshots and session monitoring
API Endpoints
Browser Control
GET /api/browser/status- Get current browser session statusPOST /api/browser/pop-out- Switch to headed mode (VNC in Kubernetes)POST /api/browser/pop-in- Switch back to headless mode
Automation
GET /api/ui-state- Get current UI state and page informationPOST /api/puppeteer- Execute Puppeteer automation scriptsPOST /api/tool- Execute specific automation toolsGET /api/observe- Get current page HTML content
LLM Integration
POST /api/ai- Stream chat completions with tool access
Available Tools
The AI has access to these automation tools:
get_ui_state- Inspect current UI stateobserve_browser- Get page contentexecute_script- Run JavaScript in browserexecute_automation_script- Run Puppeteer scriptsread_file- Read files from codebasegrep_files- Search file contentsfind_files- Find files by patternlist_directory- List directory contentssearch_automation_ids- Find automation IDs in code
Development
Prerequisites
- Node.js 18+
- Docker (for Kubernetes deployment)
Local Development
- Start AI API Service:
cd tools/ai-automation
npm install
npm run dev # Starts on port 4000
- Start AI Web Service:
cd tools/ai-automation/web
npm install
npm run dev # Starts on port 3000
Docker Build
# Build AI API service
cd tools/ai-automation
docker buildx build --platform linux/amd64 -t harbor.nineminds.com/nineminds/alga-ai-api:latest --push .
# Build AI Web service
cd tools/ai-automation/web
docker build --platform linux/amd64 -t ai-automation-web .
Environment Variables
For LLM integration, configure these in your Helm values:
config:
llm:
customOpenaiApiKey: "sk-or-v1-your-openrouter-key"
customOpenaiBaseUrl: "https://openrouter.ai/api/v1"
customOpenaiModel: "google/gemini-flash-1.5"
WebSocket Events
Connect to the WebSocket server for real-time updates:
const socket = io('ws://localhost:4000');
// UI state updates
socket.on('UI_STATE_UPDATE', (pageState) => {
console.log('UI state changed:', pageState);
});
// Browser screenshots
socket.on('screenshot', (base64Image) => {
// Display live browser feed
});
Usage Examples
AI Automation
// Chat with AI that has browser automation tools
const response = await fetch('/api/ai', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
messages: [{
role: 'user',
content: 'Navigate to the companies page and add a new company'
}]
})
});
Direct Automation
// Execute Puppeteer script
await fetch('/api/puppeteer', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
script: `(async () => {
await helper.navigate('http://server:3000/companies');
await helper.click('[data-automation-id="add-company-button"]');
})();`
})
});
Browser Session Control
// Switch to headed mode for manual intervention
await fetch('/api/browser/pop-out', { method: 'POST' });
// Switch back to headless mode
await fetch('/api/browser/pop-in', { method: 'POST' });