# dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis architecture

> Architecture diagram of the GitHub repository dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis
- Repository: https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis

## Overview

This repository is an autonomous REST API testing agent, with a controlled vulnerable shopping API as its demonstration target. The main workflow reads an OpenAPI spec, plans and generates tests, executes requests against a target, evaluates responses for defects, then verifies/minimizes findings and reports them. README-documented capabilities include Schemathesis comparisons and benchmark reporting. Several agent modules were only partially sampled; unsampled components and links are included only where documented, and the benchmark link reflects README evidence.

Main entry points: [`sample_api/main.py`](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/main.py) (Shopping API), [`agent/executor.py`](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/executor.py) (HTTP executor), [`agent/oracles.py`](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/oracles.py) (Bug oracles), [`agent/verifier.py`](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/verifier.py) (Bug verifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Specification &amp; Planning"]
  node_spec["Spec reader<br/>[spec_reader.py]"]
  node_dependencies["Dependency planner"]
  node_generator["Test generator &amp; runner<br/>[test_generator.py]"]
end

subgraph group_testing["Test Execution &amp; Detection"]
  node_executor["HTTP executor<br/>[executor.py]"]
  node_oracles["Bug oracles<br/>[oracles.py]"]
end

subgraph group_findings["Finding Analysis"]
  node_verifier["Bug verifier<br/>[verifier.py]"]
  node_minimizer["Test minimizer<br/>[minimizer.py]"]
  node_reporter["Diagnosis &amp; reports<br/>[reporter.py]"]
  node_benchmark["Benchmark evaluator<br/>[evaluator.py]"]
end

subgraph group_target["Sample API"]
  node_target_api["Shopping API<br/>[main.py]"]
  node_schemas["API models<br/>[schemas.py]"]
  node_config["API settings<br/>[config.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_database[("In-memory state<br/>[database.py]")]
end

node_operator(("Test operator"))
node_openapi["OpenAPI input"]
node_schemathesis["Schemathesis"]
node_report_artifacts["Benchmark results"]

node_operator -->|"provides spec"| node_openapi
node_openapi -->|"loads"| node_spec
node_spec -->|"supplies operations"| node_dependencies
node_dependencies -->|"plans sequences"| node_generator
node_generator -->|"runs requests"| node_executor
node_executor -->|"sends HTTP"| node_target_api
node_target_api -->|"uses models"| node_schemas
node_target_api -->|"reads settings"| node_config
node_target_api -->|"authenticates requests"| node_auth
node_target_api -->|"reads and writes"| node_database
node_executor -->|"provides results"| node_oracles
node_spec -->|"provides contracts"| node_oracles
node_oracles -->|"supplies findings"| node_verifier
node_verifier -->|"replays scenarios"| node_target_api
node_verifier -->|"runs clean replays"| node_executor
node_minimizer -->|"executes sequences"| node_executor
node_minimizer -->|"evaluates findings"| node_oracles
node_reporter -->|"uses verification"| node_verifier
node_reporter -->|"uses minimization"| node_minimizer
node_reporter -->|"formats findings"| node_oracles
node_operator -->|"runs evaluation"| node_benchmark
node_benchmark -->|"compares against"| node_schemathesis
node_benchmark -.->|"writes results"| node_report_artifacts

click node_spec "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/spec_reader.py"
click node_dependencies "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/dependency_graph.py"
click node_generator "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/test_generator.py"
click node_executor "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/executor.py"
click node_target_api "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/main.py"
click node_schemas "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/schemas.py"
click node_config "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/config.py"
click node_auth "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/auth.py"
click node_database "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/database.py"
click node_oracles "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/oracles.py"
click node_verifier "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/verifier.py"
click node_minimizer "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/minimizer.py"
click node_reporter "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/reporter.py"
click node_benchmark "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/benchmarks/evaluator.py"
click node_report_artifacts "https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/benchmarks/benchmark_results.json"

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_spec,node_dependencies,node_generator toneBlue
class node_executor,node_oracles toneAmber
class node_verifier,node_minimizer,node_reporter,node_benchmark,node_openapi toneMint
class node_target_api,node_schemas,node_config,node_auth,node_database toneRose
class node_operator,node_schemathesis toneIndigo
class node_report_artifacts toneTeal
```

## Components

### Specification & Planning

- [Spec reader](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/spec_reader.py): `agent/spec_reader.py`
- [Dependency planner](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/dependency_graph.py): `agent/dependency_graph.py`
- [Test generator & runner](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/test_generator.py): `agent/test_generator.py`

### Test Execution & Detection

- [HTTP executor](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/executor.py): `agent/executor.py`
- [Bug oracles](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/oracles.py): `agent/oracles.py`

### Finding Analysis

- [Bug verifier](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/verifier.py): `agent/verifier.py`
- [Test minimizer](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/minimizer.py): `agent/minimizer.py`
- [Diagnosis & reports](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/agent/reporter.py): `agent/reporter.py`
- [Benchmark evaluator](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/benchmarks/evaluator.py): `benchmarks/evaluator.py`

### Sample API

- [Shopping API](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/main.py): `sample_api/main.py`
- [API models](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/schemas.py): `sample_api/schemas.py`
- [API settings](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/config.py): `sample_api/config.py`
- [Authentication](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/auth.py): `sample_api/auth.py`
- [In-memory state](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/sample_api/database.py): `sample_api/database.py`

### Other components

- **Test operator**
- **OpenAPI input**
- **Schemathesis**
- [Benchmark results](https://github.com/dheekshanaveen/autonomous-ai-testing-agent-for-rest-apis/blob/main/benchmarks/benchmark_results.json): `benchmarks/benchmark_results.json`

## Connections

- Test operator → OpenAPI input: provides spec (evidence: `README.md`)
- OpenAPI input → Spec reader: loads (evidence: `README.md`)
- Spec reader → Dependency planner: supplies operations (evidence: `README.md`)
- Dependency planner → Test generator & runner: plans sequences (evidence: `README.md`)
- Test generator & runner → HTTP executor: runs requests (evidence: `README.md`)
- HTTP executor → Shopping API: sends HTTP (evidence: `README.md`)
- Shopping API → API models: uses models (evidence: `sample_api/main.py`)
- Shopping API → API settings: reads settings (evidence: `sample_api/main.py`)
- Shopping API → Authentication: authenticates requests (evidence: `sample_api/main.py`)
- Shopping API → In-memory state: reads and writes (evidence: `sample_api/main.py`)
- HTTP executor → Bug oracles: provides results (evidence: `README.md`)
- Spec reader → Bug oracles: provides contracts (evidence: `README.md`)
- Bug oracles → Bug verifier: supplies findings (evidence: `agent/verifier.py`)
- Bug verifier → Shopping API: replays scenarios (evidence: `agent/verifier.py`)
- Bug verifier → HTTP executor: runs clean replays (evidence: `agent/verifier.py`)
- Test minimizer → HTTP executor: executes sequences (evidence: `agent/minimizer.py`)
- Test minimizer → Bug oracles: evaluates findings (evidence: `agent/minimizer.py`)
- Diagnosis & reports → Bug verifier: uses verification (evidence: `agent/reporter.py`)
- Diagnosis & reports → Test minimizer: uses minimization (evidence: `agent/reporter.py`)
- Diagnosis & reports → Bug oracles: formats findings (evidence: `agent/reporter.py`)
- Test operator → Benchmark evaluator: runs evaluation (evidence: `README.md`)
- Benchmark evaluator → Schemathesis: compares against (evidence: `README.md`)
- Benchmark evaluator → Benchmark results: writes results
