# mosami00/agentic-test-system architecture

> Architecture diagram of the GitHub repository mosami00/agentic-test-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mosami00/agentic-test-system
- Repository: https://github.com/mosami00/agentic-test-system

## Overview

Agentic Test Generation is a Python system for generating and maintaining unit tests. Its main workflow accepts a repository run through the CLI, analyzes Git changes and source symbols, plans targets, generates candidates, validates them, runs sandboxed tests, diagnoses failures, and reports results. Workflow state and events are persisted in SQLite. The graph shows the documented coordinator and major domain stages; some subsystem implementations were not excerpted, so their internal links are omitted or marked unverified.

Main entry points: [`src/agentic_test/cli/service_factory.py`](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/cli/service_factory.py) (Service Factory), [`src/agentic_test/workflow/nodes.py`](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/nodes.py) (Workflow Nodes), [`src/agentic_test/workflow/engine.py`](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/engine.py) (Workflow Engine), [`src/agentic_test/analysis/service.py`](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/service.py) (Repository Analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Entry"]
  node_cli["CLI App<br/>[app.py]"]
  node_factory["Service Factory<br/>[service_factory.py]"]
end

subgraph group_orchestration["Workflow Control"]
  node_engine["Workflow Engine<br/>[engine.py]"]
  node_nodes["Workflow Nodes<br/>[nodes.py]"]
  node_recovery["Workflow Recovery<br/>[recovery.py]"]
  node_state["Workflow State<br/>[state.py]"]
end

subgraph group_analysis_plan["Analysis Planning"]
  node_analysis["Repository Analysis<br/>[service.py]"]
  node_git["Git Inspection<br/>[git_service.py]"]
  node_ast["AST Analyzer<br/>[ast_analyzer.py]"]
  node_discovery["Test Discovery<br/>[discovery.py]"]
  node_planner["Execution Planner<br/>[planner.py]"]
  node_planning_rules["Planning Rules<br/>[rules.py]"]
end

subgraph group_test_lifecycle["Test Lifecycle"]
  node_generation["Test Generation<br/>[service.py]"]
  node_context["Prompt Context<br/>[context.py]"]
  node_llm["LLM Adapter<br/>[litellm_service.py]"]
  node_validation["Candidate Validation<br/>[pipeline.py]"]
  node_execution["Sandbox Execution<br/>[service.py]"]
  node_coverage["Coverage Metrics<br/>[coverage.py]"]
  node_diagnosis["Failure Diagnosis<br/>[service.py]"]
  node_diagnosis_rules["Triage Rules<br/>[rules.py]"]
  node_llm_classifier["LLM Triage<br/>[llm_classifier.py]"]
end

subgraph group_persistence["State Persistence"]
  node_database[("SQLite Database<br/>[database.py]")]
  node_repository["Run Repository<br/>[repository.py]"]
  node_events["Event Store<br/>[events.py]"]
end

node_user(("Engineer"))

node_user -->|"invokes"| node_cli
node_cli -->|"configures services"| node_factory
node_cli -->|"recovers runs"| node_recovery
node_cli -->|"inspects repository"| node_git
node_factory -->|"constructs"| node_analysis
node_factory -->|"constructs"| node_planner
node_factory -->|"constructs"| node_generation
node_factory -->|"constructs"| node_validation
node_factory -->|"constructs"| node_execution
node_factory -->|"constructs"| node_diagnosis
node_factory -->|"constructs"| node_engine
node_engine -->|"dispatches"| node_nodes
node_engine -->|"persists checkpoints"| node_repository
node_engine -->|"emits events"| node_events
node_engine -->|"coordinates state"| node_state
node_nodes -->|"runs analysis"| node_analysis
node_nodes -->|"creates plan"| node_planner
node_nodes -->|"generates candidates"| node_generation
node_nodes -->|"validates candidates"| node_validation
node_nodes -->|"runs sandbox"| node_execution
node_nodes -->|"diagnoses failures"| node_diagnosis
node_analysis -->|"reads Git data"| node_git
node_analysis -->|"analyzes source"| node_ast
node_analysis -->|"discovers tests"| node_discovery
node_planner -->|"uses test inventory"| node_discovery
node_planner -->|"applies rules"| node_planning_rules
node_generation -->|"assembles prompts"| node_context
node_context -->|"requests completion"| node_llm
node_validation -->|"checks collection"| node_execution
node_execution -->|"collects metrics"| node_coverage
node_diagnosis -->|"classifies first"| node_diagnosis_rules
node_diagnosis -->|"falls back"| node_llm_classifier
node_llm_classifier -->|"requests reasoning"| node_llm
node_repository -->|"reads and writes"| node_database
node_events -->|"stores events"| node_database
node_recovery -->|"loads checkpoints"| node_repository
node_recovery -->|"reads run events"| node_events

click node_cli "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/cli/app.py"
click node_factory "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/cli/service_factory.py"
click node_engine "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/engine.py"
click node_nodes "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/nodes.py"
click node_recovery "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/recovery.py"
click node_state "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/core/state.py"
click node_analysis "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/service.py"
click node_git "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/git_service.py"
click node_ast "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/ast_analyzer.py"
click node_discovery "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/discovery.py"
click node_planner "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/planning/planner.py"
click node_planning_rules "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/planning/rules.py"
click node_generation "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/generation/service.py"
click node_context "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/generation/context.py"
click node_llm "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/generation/litellm_service.py"
click node_validation "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/validation/pipeline.py"
click node_execution "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/execution/service.py"
click node_coverage "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/execution/coverage.py"
click node_diagnosis "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/diagnosis/service.py"
click node_diagnosis_rules "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/diagnosis/rules.py"
click node_llm_classifier "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/diagnosis/llm_classifier.py"
click node_database "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/storage/database.py"
click node_repository "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/storage/repository.py"
click node_events "https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/storage/events.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_cli,node_factory toneBlue
class node_engine,node_nodes,node_recovery,node_state toneAmber
class node_analysis,node_git,node_ast,node_discovery,node_planner,node_planning_rules toneMint
class node_generation,node_context,node_llm,node_validation,node_execution,node_coverage,node_diagnosis,node_diagnosis_rules,node_llm_classifier toneRose
class node_database,node_repository,node_events,node_user toneIndigo
```

## Components

### User Entry

- [CLI App](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/cli/app.py): `src/agentic_test/cli/app.py`
- [Service Factory](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/cli/service_factory.py): `src/agentic_test/cli/service_factory.py`

### Workflow Control

- [Workflow Engine](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/engine.py): `src/agentic_test/workflow/engine.py`
- [Workflow Nodes](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/nodes.py): `src/agentic_test/workflow/nodes.py`
- [Workflow Recovery](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/workflow/recovery.py): `src/agentic_test/workflow/recovery.py`
- [Workflow State](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/core/state.py): `src/agentic_test/core/state.py`

### Analysis Planning

- [Repository Analysis](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/service.py): `src/agentic_test/analysis/service.py`
- [Git Inspection](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/git_service.py): `src/agentic_test/analysis/git_service.py`
- [AST Analyzer](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/ast_analyzer.py): `src/agentic_test/analysis/ast_analyzer.py`
- [Test Discovery](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/analysis/discovery.py): `src/agentic_test/analysis/discovery.py`
- [Execution Planner](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/planning/planner.py): `src/agentic_test/planning/planner.py`
- [Planning Rules](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/planning/rules.py): `src/agentic_test/planning/rules.py`

### Test Lifecycle

- [Test Generation](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/generation/service.py): `src/agentic_test/generation/service.py`
- [Prompt Context](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/generation/context.py): `src/agentic_test/generation/context.py`
- [LLM Adapter](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/generation/litellm_service.py): `src/agentic_test/generation/litellm_service.py`
- [Candidate Validation](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/validation/pipeline.py): `src/agentic_test/validation/pipeline.py`
- [Sandbox Execution](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/execution/service.py): `src/agentic_test/execution/service.py`
- [Coverage Metrics](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/execution/coverage.py): `src/agentic_test/execution/coverage.py`
- [Failure Diagnosis](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/diagnosis/service.py): `src/agentic_test/diagnosis/service.py`
- [Triage Rules](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/diagnosis/rules.py): `src/agentic_test/diagnosis/rules.py`
- [LLM Triage](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/diagnosis/llm_classifier.py): `src/agentic_test/diagnosis/llm_classifier.py`

### State Persistence

- [SQLite Database](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/storage/database.py): `src/agentic_test/storage/database.py`
- [Run Repository](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/storage/repository.py): `src/agentic_test/storage/repository.py`
- [Event Store](https://github.com/mosami00/agentic-test-system/blob/main/src/agentic_test/storage/events.py): `src/agentic_test/storage/events.py`

### Other components

- **Engineer**

## Connections

- Engineer → CLI App: invokes
- CLI App → Service Factory: configures services (evidence: `src/agentic_test/cli/app.py`)
- CLI App → Workflow Recovery: recovers runs (evidence: `src/agentic_test/cli/app.py`)
- CLI App → Git Inspection: inspects repository (evidence: `src/agentic_test/cli/app.py`)
- Service Factory → Repository Analysis: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Service Factory → Execution Planner: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Service Factory → Test Generation: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Service Factory → Candidate Validation: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Service Factory → Sandbox Execution: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Service Factory → Failure Diagnosis: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Service Factory → Workflow Engine: constructs (evidence: `src/agentic_test/cli/service_factory.py`)
- Workflow Engine → Workflow Nodes: dispatches (evidence: `src/agentic_test/workflow/engine.py`)
- Workflow Engine → Run Repository: persists checkpoints (evidence: `src/agentic_test/workflow/engine.py`)
- Workflow Engine → Event Store: emits events (evidence: `src/agentic_test/workflow/engine.py`)
- Workflow Engine → Workflow State: coordinates state (evidence: `src/agentic_test/workflow/engine.py`)
- Workflow Nodes → Repository Analysis: runs analysis (evidence: `src/agentic_test/workflow/nodes.py`)
- Workflow Nodes → Execution Planner: creates plan (evidence: `src/agentic_test/workflow/nodes.py`)
- Workflow Nodes → Test Generation: generates candidates (evidence: `src/agentic_test/workflow/nodes.py`)
- Workflow Nodes → Candidate Validation: validates candidates (evidence: `src/agentic_test/workflow/nodes.py`)
- Workflow Nodes → Sandbox Execution: runs sandbox (evidence: `src/agentic_test/workflow/nodes.py`)
- Workflow Nodes → Failure Diagnosis: diagnoses failures (evidence: `src/agentic_test/workflow/nodes.py`)
- Repository Analysis → Git Inspection: reads Git data (evidence: `src/agentic_test/analysis/service.py`)
- Repository Analysis → AST Analyzer: analyzes source (evidence: `src/agentic_test/analysis/service.py`)
- Repository Analysis → Test Discovery: discovers tests (evidence: `src/agentic_test/analysis/service.py`)
- Execution Planner → Test Discovery: uses test inventory (evidence: `src/agentic_test/planning/planner.py`)
- Execution Planner → Planning Rules: applies rules (evidence: `src/agentic_test/planning/planner.py`)
- Test Generation → Prompt Context: assembles prompts (evidence: `src/agentic_test/generation/service.py`)
- Prompt Context → LLM Adapter: requests completion (evidence: `src/agentic_test/generation/context.py`)
- Candidate Validation → Sandbox Execution: checks collection (evidence: `src/agentic_test/validation/pipeline.py`)
- Sandbox Execution → Coverage Metrics: collects metrics (evidence: `src/agentic_test/execution/service.py`)
- Failure Diagnosis → Triage Rules: classifies first (evidence: `src/agentic_test/diagnosis/service.py`)
- Failure Diagnosis → LLM Triage: falls back (evidence: `src/agentic_test/diagnosis/service.py`)
- LLM Triage → LLM Adapter: requests reasoning (evidence: `src/agentic_test/diagnosis/llm_classifier.py`)
- Run Repository → SQLite Database: reads and writes (evidence: `src/agentic_test/storage/repository.py`)
- Event Store → SQLite Database: stores events (evidence: `src/agentic_test/storage/events.py`)
- Workflow Recovery → Run Repository: loads checkpoints (evidence: `src/agentic_test/workflow/recovery.py`)
- Workflow Recovery → Event Store: reads run events (evidence: `src/agentic_test/workflow/recovery.py`)
