# rafaelob/ailine architecture

> Architecture diagram of the GitHub repository rafaelob/ailine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rafaelob/ailine
- Repository: https://github.com/rafaelob/ailine

## Overview

AiLine is an inclusive-learning platform: teachers submit classroom materials and accessibility profiles, and the API coordinates retrieval and multi-agent planning, quality review, refinement, and export. The frontend presents streamed progress and personalized results, while accessibility, tutoring, curriculum, and observability are substantial companion capabilities. Relationships shown below follow the README’s architecture and pipeline diagrams; sampled source confirms selected agent, ingestion, routing, and application responsibilities, but many runtime paths were not excerpted.

Main entry points: [`runtime/ailine_runtime/api/routers`](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/api/routers) (REST and SSE Routes), [`agents/ailine_agents/workflows`](https://github.com/rafaelob/ailine/tree/main/agents/ailine_agents/workflows) (Agent Workflows), [`runtime/ailine_runtime/workflow/plan_workflow.py`](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/workflow/plan_workflow.py) (Plan Workflow), [`frontend/src/app/[locale]/(app)/plans/page.tsx`](https://github.com/rafaelob/ailine/blob/main/frontend/src/app/%5Blocale%5D/(app)/plans/page.tsx) (Web Application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Teacher Experience"]
  node_frontend["Web Application<br/>[page.tsx]"]
  node_stream_client["Pipeline Streaming"]
  node_pipeline_view["Glass Box Viewer"]
end

subgraph group_api["API and Domain"]
  node_api_app["API Application<br/>[app.py]"]
  node_api_routes["REST and SSE Routes"]
  node_domain["Domain and Ports"]
end

subgraph group_planning["AI Planning"]
  node_plan_workflow["Plan Workflow<br/>[plan_workflow.py]"]
  node_agent_workflows["Agent Workflows"]
  node_planner["Planner Agent<br/>[planner.py]"]
  node_quality_gate["Quality Gate<br/>[quality_gate.py]"]
  node_executor["Executor Agent<br/>[executor.py]"]
end

subgraph group_learning["Learning Capabilities"]
  node_material_ingestion["Material Ingestion<br/>[ingestion.py]"]
  node_rag["RAG Service<br/>[rag.py]"]
  node_curriculum["Curriculum Adapters"]
  node_tutoring["Tutor Workflow<br/>[tutor_workflow.py]"]
  node_accessibility["Accessibility and Exports"]
end

subgraph group_platform["Platform Services"]
  node_smart_router["Smart LLM Router<br/>[smart_router.py]"]
  node_llm_providers["LLM Providers"]
  node_vector_store[("Vector Store")]
  node_persistence[("Database and Repositories")]
  node_observability["Observability<br/>[observability.py]"]
end

node_teacher(("Teacher"))

node_teacher -->|"submits request"| node_frontend
node_frontend -->|"starts streaming"| node_stream_client
node_stream_client -->|"sends SSE request"| node_api_routes
node_api_app -->|"registers routes"| node_api_routes
node_api_routes -->|"uses domain"| node_domain
node_api_routes -.->|"starts plan flow"| node_plan_workflow
node_plan_workflow -.->|"orchestrates agents"| node_agent_workflows
node_agent_workflows -.->|"invokes planning"| node_planner
node_agent_workflows -.->|"checks quality"| node_quality_gate
node_agent_workflows -.->|"runs tools"| node_executor
node_agent_workflows -->|"requests models"| node_smart_router
node_smart_router -->|"routes requests"| node_llm_providers
node_api_routes -.->|"ingests uploads"| node_material_ingestion
node_material_ingestion -->|"stores embeddings"| node_vector_store
node_agent_workflows -.->|"retrieves context"| node_rag
node_rag -.->|"searches materials"| node_vector_store
node_plan_workflow -.->|"uses standards"| node_curriculum
node_plan_workflow -->|"formats adaptations"| node_accessibility
node_frontend -->|"displays pipeline"| node_pipeline_view
node_api_routes -.->|"serves tutor chat"| node_tutoring
node_api_routes -.->|"reads and writes"| node_persistence
node_api_app -->|"configures telemetry"| node_observability

click node_frontend "https://github.com/rafaelob/ailine/blob/main/frontend/src/app/%5Blocale%5D/(app)/plans/page.tsx"
click node_stream_client "https://github.com/rafaelob/ailine/blob/main/frontend/src/hooks/use-pipeline-sse.ts"
click node_pipeline_view "https://github.com/rafaelob/ailine/blob/main/frontend/src/components/pipeline/pipeline-viewer.tsx"
click node_api_app "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/api/app.py"
click node_api_routes "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/api/routers"
click node_domain "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/domain"
click node_plan_workflow "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/workflow/plan_workflow.py"
click node_agent_workflows "https://github.com/rafaelob/ailine/tree/main/agents/ailine_agents/workflows"
click node_planner "https://github.com/rafaelob/ailine/blob/main/agents/ailine_agents/agents/planner.py"
click node_quality_gate "https://github.com/rafaelob/ailine/blob/main/agents/ailine_agents/agents/quality_gate.py"
click node_executor "https://github.com/rafaelob/ailine/blob/main/agents/ailine_agents/agents/executor.py"
click node_material_ingestion "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/app/services/ingestion.py"
click node_rag "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/app/services/rag.py"
click node_curriculum "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/curriculum"
click node_tutoring "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/workflow/tutor_workflow.py"
click node_accessibility "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/accessibility"
click node_smart_router "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/adapters/llm/smart_router.py"
click node_llm_providers "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/llm"
click node_vector_store "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/vectorstores"
click node_persistence "https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/db"
click node_observability "https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/shared/observability.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_stream_client,node_pipeline_view toneBlue
class node_api_app,node_api_routes,node_domain toneAmber
class node_plan_workflow,node_agent_workflows,node_planner,node_quality_gate,node_executor toneMint
class node_material_ingestion,node_rag,node_curriculum,node_tutoring,node_accessibility toneRose
class node_smart_router,node_llm_providers,node_vector_store,node_persistence,node_observability,node_teacher toneIndigo
```

## Components

### Teacher Experience

- [Web Application](https://github.com/rafaelob/ailine/blob/main/frontend/src/app/%5Blocale%5D/(app)/plans/page.tsx): `frontend/src/app/[locale]/(app)/plans/page.tsx`
- [Pipeline Streaming](https://github.com/rafaelob/ailine/blob/main/frontend/src/hooks/use-pipeline-sse.ts): `frontend/src/hooks/use-pipeline-sse.ts`
- [Glass Box Viewer](https://github.com/rafaelob/ailine/blob/main/frontend/src/components/pipeline/pipeline-viewer.tsx): `frontend/src/components/pipeline/pipeline-viewer.tsx`

### API and Domain

- [API Application](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/api/app.py): `runtime/ailine_runtime/api/app.py`
- [REST and SSE Routes](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/api/routers): `runtime/ailine_runtime/api/routers`
- [Domain and Ports](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/domain): `runtime/ailine_runtime/domain`

### AI Planning

- [Plan Workflow](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/workflow/plan_workflow.py): `runtime/ailine_runtime/workflow/plan_workflow.py`
- [Agent Workflows](https://github.com/rafaelob/ailine/tree/main/agents/ailine_agents/workflows): `agents/ailine_agents/workflows`
- [Planner Agent](https://github.com/rafaelob/ailine/blob/main/agents/ailine_agents/agents/planner.py): `agents/ailine_agents/agents/planner.py`
- [Quality Gate](https://github.com/rafaelob/ailine/blob/main/agents/ailine_agents/agents/quality_gate.py): `agents/ailine_agents/agents/quality_gate.py`
- [Executor Agent](https://github.com/rafaelob/ailine/blob/main/agents/ailine_agents/agents/executor.py): `agents/ailine_agents/agents/executor.py`

### Learning Capabilities

- [Material Ingestion](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/app/services/ingestion.py): `runtime/ailine_runtime/app/services/ingestion.py`
- [RAG Service](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/app/services/rag.py): `runtime/ailine_runtime/app/services/rag.py`
- [Curriculum Adapters](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/curriculum): `runtime/ailine_runtime/adapters/curriculum`
- [Tutor Workflow](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/workflow/tutor_workflow.py): `runtime/ailine_runtime/workflow/tutor_workflow.py`
- [Accessibility and Exports](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/accessibility): `runtime/ailine_runtime/accessibility`

### Platform Services

- [Smart LLM Router](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/adapters/llm/smart_router.py): `runtime/ailine_runtime/adapters/llm/smart_router.py`
- [LLM Providers](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/llm): `runtime/ailine_runtime/adapters/llm`
- [Vector Store](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/vectorstores): `runtime/ailine_runtime/adapters/vectorstores`
- [Database and Repositories](https://github.com/rafaelob/ailine/tree/main/runtime/ailine_runtime/adapters/db): `runtime/ailine_runtime/adapters/db`
- [Observability](https://github.com/rafaelob/ailine/blob/main/runtime/ailine_runtime/shared/observability.py): `runtime/ailine_runtime/shared/observability.py`

### Other components

- **Teacher**

## Connections

- Teacher → Web Application: submits request (evidence: `README.md`)
- Web Application → Pipeline Streaming: starts streaming (evidence: `README.md`)
- Pipeline Streaming → REST and SSE Routes: sends SSE request (evidence: `README.md`)
- API Application → REST and SSE Routes: registers routes (evidence: `runtime/ailine_runtime/api/app.py`)
- REST and SSE Routes → Domain and Ports: uses domain (evidence: `README.md`)
- REST and SSE Routes → Plan Workflow: starts plan flow
- Plan Workflow → Agent Workflows: orchestrates agents
- Agent Workflows → Planner Agent: invokes planning
- Agent Workflows → Quality Gate: checks quality
- Agent Workflows → Executor Agent: runs tools
- Agent Workflows → Smart LLM Router: requests models (evidence: `README.md`)
- Smart LLM Router → LLM Providers: routes requests (evidence: `README.md`)
- REST and SSE Routes → Material Ingestion: ingests uploads
- Material Ingestion → Vector Store: stores embeddings (evidence: `runtime/ailine_runtime/app/services/ingestion.py`)
- Agent Workflows → RAG Service: retrieves context
- RAG Service → Vector Store: searches materials
- Plan Workflow → Curriculum Adapters: uses standards
- Plan Workflow → Accessibility and Exports: formats adaptations (evidence: `README.md`)
- Web Application → Glass Box Viewer: displays pipeline (evidence: `README.md`)
- REST and SSE Routes → Tutor Workflow: serves tutor chat
- REST and SSE Routes → Database and Repositories: reads and writes
- API Application → Observability: configures telemetry (evidence: `runtime/ailine_runtime/api/app.py`)
