Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 2.04 KB

File metadata and controls

62 lines (50 loc) · 2.04 KB

Architecture

System Overview

ai-agent-engine is a lightweight orchestration engine for AI agents. Workflows are defined declaratively in YAML and executed through a multi-LLM router that selects the optimal model for each step.

Component Diagram

graph TB
    Client[Client / API]
    API[FastAPI Gateway]
    Config[YAML Config Loader]
    Router[LLM Router]
    Orchestrator[Workflow Orchestrator]

    Planner[Planner Agent]
    Executor[Executor Agent]
    Validator[Validator Agent]

    OpenAI[OpenAI API]
    Anthropic[Anthropic API]
    Local[Local LLM]

    Safety[Safety Layer]
    Observe[Observability]

    Client --> API
    API --> Config
    Config --> Orchestrator
    Orchestrator --> Router
    Router --> OpenAI
    Router --> Anthropic
    Router --> Local
    Orchestrator --> Planner
    Orchestrator --> Executor
    Orchestrator --> Validator
    Safety --> Orchestrator
    Observe --> Orchestrator
Loading

Key Components

  • FastAPI Gateway — HTTP entry point, request validation, routing to orchestrator
  • YAML Config Loader — Parses and validates workflow definitions
  • Workflow Orchestrator — Resolves step dependencies (DAG), executes steps sequentially or in parallel
  • LLM Router — Selects optimal model per task (cost-aware, fallback chains)
  • Agent Patterns — Built-in patterns: Router, Planner, Executor, Validator
  • Safety Layer — Rate limiting, cost controls, content filtering
  • Observability — Structured logging, metrics, trace ID propagation

Directory Structure

  • src/agent_engine/api/ — FastAPI routes
  • src/agent_engine/core/ — Orchestrator, Router, Agent patterns
  • src/agent_engine/config/ — YAML loader, validation
  • src/agent_engine/llm/ — LLM providers (OpenAI, Anthropic, Local)
  • src/agent_engine/safety/ — Rate limiting, cost controls
  • src/agent_engine/observe/ — Logging, metrics, tracing
  • src/agent_engine/models/ — Pydantic models
  • src/agent_engine/services/ — Business logic services
  • workflows/ — Example YAML workflow configs