🏗️ Technical Architecture

Enterprise-grade multi-cloud, model-agnostic architecture design

System Architecture Overview

AiScripto is a layered microservices architecture that supports multiple AI model vendors, multiple cloud platform deployments, and flexible scalability.

graph TB subgraph "User Interface Layer" A["📱 Web UI
React/Vue"] B["🖥️ CLI
Python/Node"] C["📊 TUI
Terminal App"] end subgraph "API Layer" D["🔌 REST API
Node.js/Express"] E["🌐 GraphQL API
WebSocket Support"] end subgraph "Application Layer" F["🤖 Orchestration Engine
Multi-Agent Coordination"] G["🔍 UI Explorer
Browser Automation"] H["⚙️ Code Generator
Playwright Synthesis"] I["🔧 Test Healer
Auto-Repair"] end subgraph "AI Layer" J["🧠 Claude API
AWS/Anthropic"] K["🤖 Bedrock
AWS Models"] L["💙 Azure AI
GPT-4/Vision"] M["🔵 Vertex AI
Google Gemini"] end subgraph "Storage Layer" N["📂 File Storage
GCS/S3/Blob"] O["🗄️ Database
PostgreSQL/DynamoDB"] P["💾 Cache
Redis"] end subgraph "Execution Layer" Q["🌐 Playwright
Browser Control"] R["⚙️ Node.js Runtime
Test Execution"] S["📊 Logging
CloudWatch/Stackdriver"] end A --> D B --> D C --> D D --> E E --> F F --> G F --> H F --> I F --> J F --> K F --> L F --> M G --> Q H --> R I --> Q F --> N F --> O F --> P Q --> S R --> S style A fill:#ff9900,stroke:#333,stroke-width:2px,color:#000 style B fill:#ff9900,stroke:#333,stroke-width:2px,color:#000 style C fill:#ff9900,stroke:#333,stroke-width:2px,color:#000 style F fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style G fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style H fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style I fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style J fill:#9C27B0,stroke:#333,stroke-width:2px,color:#fff style K fill:#FF5722,stroke:#333,stroke-width:2px,color:#fff style L fill:#00BCD4,stroke:#333,stroke-width:2px,color:#fff style M fill:#4CAF50,stroke:#333,stroke-width:2px,color:#fff style Q fill:#f44336,stroke:#333,stroke-width:2px,color:#fff

Layer 1: User Interface

AiScripto provides three user interface options to suit different team preferences.

🌐 Web Management Console

Intuitive web interface for project management, test monitoring, and report analysis. Support real-time collaboration and historical tracking.

React/Vue Responsive SSO Integration

🖥️ CLI Command-Line Tool

Powerful command-line interface integrated into CI/CD pipelines. Support local development, batch operations, and script automation.

Node.js Docker Container Batch Processing

📊 TUI Terminal Application

Interactive terminal user interface suitable for local development and real-time feedback. Support keyboard navigation and real-time log streaming.

Textual Python Real-time Updates

Layer 2: API Gateway

🔌 REST API

RESTful API provides programmatic access to all AiScripto functionality, supporting complete CRUD operations and complex queries.

核心端點:

  • POST /api/v1/test-cases/import
    導入新的測試用例
  • POST /api/v1/tests/generate
    觸發代碼生成
  • POST /api/v1/tests/execute
    執行測試
  • GET /api/v1/reports/{testId}
    獲取測試結果報告
  • POST /api/v1/tests/heal
    觸發自動修復

🌐 GraphQL API

GraphQL API provides more flexible data queries with WebSocket real-time subscriptions, suitable for real-time monitoring and dashboard applications.

API Authentication

Support multiple authentication methods: JWT Token, OAuth 2.0, API Keys. All API calls are encrypted via TLS, support RBAC and fine-grained permission control.

Layer 3: Application Layer

The application layer contains all core business logic and AI integration.

🤖 Orchestration Engine

The multi-agent orchestration engine is the core of AiScripto, responsible for coordinating various AI agents to complete complex tasks.

graph LR A["Main Agent
Coordinator"] B["📝 Parser
Parser Agent"] C["🔍 Explorer
Explorer Agent"] D["⚙️ Generator
Generator Agent"] E["▶️ Executor
Executor Agent"] F["🔧 Healer
Healing Agent"] G["📊 Analyzer
Analyzer Agent"] A -.->|協調| B A -.->|協調| C A -.->|協調| D A -.->|協調| E A -.->|協調| F A -.->|協調| G B -->|結果| A C -->|結果| A D -->|結果| A E -->|結果| A F -->|結果| A G -->|結果| A style A fill:#ff9900,stroke:#333,stroke-width:2px,color:#000 style B fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style C fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style D fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style E fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style F fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff style G fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff

各代理的職責

代理 職責 使用的AI模型 輸入 輸出
Parser 解析和驗證測試用例 Claude、GPT-4 原始文本 結構化測試JSON
Explorer 啟動瀏覽器並探索UI Playwright + Vision API 應用URL、測試步驟 元素定位器、截圖
Generator 生成Playwright測試代碼 Claude、GPT-4 測試結構、定位器 TypeScript測試文件
Executor 執行Playwright測試 Playwright框架 測試文件、環境配置 執行日誌、trace文件
Healer 分析失敗並自動修復 Claude、Vision API 失敗日誌、截圖 修復的代碼、報告
Analyzer 生成洞察和報告 數據分析、Claude 執行結果、歷史數據 報告、建議

第4层:AI模型层

AiScripto支持多個AI模型供應商,允許企業選擇最適合的配置。 所有供應商通過統一的Model Context Protocol (MCP)接口訪問。

🧠 支持的AI模型供應商

🔗 Anthropic Claude

  • Claude 3.5 Sonnet
    推薦用於代碼生成和複雜推理
  • Claude 3.5 Haiku
    快速且成本有效的解析
  • 特點:
    Native vision、長上下文、tool use

☁️ AWS Bedrock

  • Claude via Bedrock
    託管版本,無需API密鑰管理
  • Mistral models
    成本優化選項
  • 特點:
    完全託管、企業SLA、合規性

🔵 Microsoft Azure AI

  • GPT-4 Turbo
    最新的OpenAI模型
  • GPT-4 Vision
    圖像識別和分析
  • 特點:
    Azure集成、SOC 2認證

🟡 Google Vertex AI

  • Gemini 2.0
    Google最新的多模態模型
  • PaLM 2
    文本生成和分析
  • 特點:
    GCP集成、Duet AI支持

🔄 Model Context Protocol (MCP)

所有AI模型通過統一的MCP接口訪問,提供一致的API。 這允許你輕鬆在不同的模型和供應商之間切換,而無需修改應用代碼。

第5层:存儲層

存儲層支持多種雲存儲後端和數據庫選項。

📂 文件存儲

AWS S3 - 對象存儲
Google Cloud Storage - 高可用存儲
Azure Blob Storage - 企業存儲
本地文件系統 - 開發環境

🗄️ 關係數據庫

PostgreSQL - 開源選項
AWS RDS - 託管PostgreSQL
Azure SQL - 企業SQL
Google Cloud SQL - GCP選項

📊 NoSQL數據庫

AWS DynamoDB - 高性能
MongoDB Atlas - 文檔數據庫
Azure Cosmos DB - 全球分佈
Firebase - 實時數據庫

💾 快取層

Redis - 記憶體快取
ElastiCache - AWS託管
Memcached - 分佈式快取
定位器快取 - 本地優化

第6層:執行層

執行層負責實際的測試運行、瀏覽器控制和結果記錄。

🌐 Playwright執行環境

支持的瀏覽器:

  • Chrome / Chromium - 最廣泛的web應用支持
  • Firefox - 跨瀏覽器兼容性測試
  • Safari - iOS和macOS測試
  • Edge - Chromium生態系統

📊 日誌和可觀測性

日誌類型 存儲位置 用途 保留期
執行日誌 CloudWatch / Stackdriver 測試步驟和結果追蹤 30天
Trace文件 S3 / GCS / Blob Storage 詳細的瀏覽器互動記錄 60天
螢幕截圖 對象存儲 視覺驗證和調試 90天
性能指標 時間序列數據庫 性能監控和趨勢分析 1年

☁️ 部署選項

AiScripto支持多種部署方式,從開發環境到企業級生產部署。

📱 本地開發

在本地機器上運行,適合開發和測試。 無需雲資源。

Docker 快速啟動

🌥️ AWS

Lambda無服務器、EC2實例或ECS容器部署。 與Bedrock和其他AWS服務集成。

Lambda ECS 自動擴展

☁️ Microsoft Azure

App Service、Container Instances或Kubernetes。 與Azure DevOps集成。

App Service AKS 管理身份

🔵 Google Cloud

Cloud Run無服務器或GKE容器編排。 與Vertex AI集成。

Cloud Run GKE 全托管

🏢 自管理Kubernetes

在你自己的Kubernetes集群上運行。 完全控制和自定義。

K8s Helm 自定義

🔐 混合雲

在多個雲平台間分佈應用。 符合多區域合規性要求。

多雲 聯邦 合規

🔐 安全性和合規性

企業級安全是AiScripto的核心設計原則。

🔐 數據加密

傳輸層(TLS 1.3)和存儲層加密(AES-256)

👤 身份認證

支持SSO、OAuth 2.0、SAML和MFA

🔑 密鑰管理

AWS KMS、Azure Key Vault、Google Secret Manager

📋 審計日誌

所有操作記錄,支持長期存檔

合規性認證

SOC 2 Type II AWS認證 Azure認證 GDPR就緒 HIPAA可選 ISO 27001

⚡ 性能與可擴展性

性能指標

指標 性能 說明
API響應時間 < 200ms (p95) 大多數API調用在200毫秒內完成
生成測試時間 1-3 分鐘 從測試用例到可執行代碼
測試執行速度 與Playwright相同 無額外的性能開銷
自動修復時間 < 2 分鐘 重新測試和驗證修復
併發測試數 可配置 支持100+並行執行

可擴展性

水平擴展

根據負載自動添加更多執行器實例

垂直擴展

支持高內存配置用於複雜測試

無狀態設計

應用層無狀態,便於快速擴展

快取優化

多層快取減少數據庫負載