# furudo-erika/ai-testing-agent architecture

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

- Interactive diagram: https://gitdiagram.com/furudo-erika/ai-testing-agent
- Repository: https://github.com/furudo-erika/ai-testing-agent

## Overview

This is an LLM-assisted API testing agent. The user asks the LangChain agent to plan tests, generate code, run it, or refine it with feedback; the agent’s tools invoke the CLI, which calls OpenRouter and writes or runs generated tests against a configurable API. The README documents this workflow; the excerpts additionally show a one-time reflection retry and a sample FastAPI target. The copied files are alternate snapshots, so they are not mapped separately.

Main entry points: [`api_tester.py`](https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py) (Test CLI), [`agent.py`](https://github.com/furudo-erika/ai-testing-agent/blob/main/agent.py) (Chat agent), [`agent_tools.py`](https://github.com/furudo-erika/ai-testing-agent/blob/main/agent_tools.py) (Agent tools), [`generated_tests.py`](https://github.com/furudo-erika/ai-testing-agent/blob/main/generated_tests.py) (Generated tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Agent interaction"]
  node_agent["Chat agent<br/>[agent.py]"]
  node_safe_run["Safe-run retry<br/>[agent.py]"]
  node_tools["Agent tools<br/>[agent_tools.py]"]
end

subgraph group_workflow["Test workflow"]
  node_cli["Test CLI<br/>[api_tester.py]"]
  node_plan["Plan generation<br/>[api_tester.py]"]
  node_codegen["Test generation<br/>[api_tester.py]"]
  node_feedback["Feedback refinement<br/>[api_tester.py]"]
  node_runner["Test runner<br/>[api_tester.py]"]
end

subgraph group_runtime["Generation and execution"]
  node_generated["Generated tests<br/>[generated_tests.py]"]
end

subgraph group_target["Test target"]
  node_api["Sample FastAPI<br/>[main.py]"]
end

node_user(("User"))
node_llm["OpenRouter LLM"]
node_pytest["pytest"]

node_user -->|"requests action"| node_agent
node_agent -->|"dispatches tools"| node_tools
node_agent -->|"offers retry"| node_safe_run
node_safe_run -->|"calls tools"| node_tools
node_tools -->|"runs commands"| node_cli
node_cli -->|"dispatches plan"| node_plan
node_cli -->|"dispatches generate"| node_codegen
node_cli -->|"dispatches feedback"| node_feedback
node_cli -->|"dispatches run"| node_runner
node_plan -->|"requests plan"| node_llm
node_codegen -->|"requests code"| node_llm
node_feedback -->|"requests revision"| node_llm
node_codegen -->|"writes tests"| node_generated
node_runner -->|"runs tests"| node_pytest
node_pytest -->|"executes file"| node_generated
node_generated -->|"sends API requests"| node_api

click node_agent "https://github.com/furudo-erika/ai-testing-agent/blob/main/agent.py"
click node_safe_run "https://github.com/furudo-erika/ai-testing-agent/blob/main/agent.py"
click node_tools "https://github.com/furudo-erika/ai-testing-agent/blob/main/agent_tools.py"
click node_cli "https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py"
click node_plan "https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py"
click node_codegen "https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py"
click node_feedback "https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py"
click node_runner "https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py"
click node_generated "https://github.com/furudo-erika/ai-testing-agent/blob/main/generated_tests.py"
click node_api "https://github.com/furudo-erika/ai-testing-agent/blob/main/main.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_agent,node_safe_run,node_tools,node_user toneBlue
class node_cli,node_plan,node_codegen,node_feedback,node_runner toneAmber
class node_generated,node_llm toneMint
class node_api toneRose
class node_pytest toneIndigo
```

## Components

### Agent interaction

- [Chat agent](https://github.com/furudo-erika/ai-testing-agent/blob/main/agent.py): `agent.py`
- [Safe-run retry](https://github.com/furudo-erika/ai-testing-agent/blob/main/agent.py): `agent.py`
- [Agent tools](https://github.com/furudo-erika/ai-testing-agent/blob/main/agent_tools.py): `agent_tools.py`

### Test workflow

- [Test CLI](https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py): `api_tester.py`
- [Plan generation](https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py): `api_tester.py`
- [Test generation](https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py): `api_tester.py`
- [Feedback refinement](https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py): `api_tester.py`
- [Test runner](https://github.com/furudo-erika/ai-testing-agent/blob/main/api_tester.py): `api_tester.py`

### Generation and execution

- [Generated tests](https://github.com/furudo-erika/ai-testing-agent/blob/main/generated_tests.py): `generated_tests.py`

### Test target

- [Sample FastAPI](https://github.com/furudo-erika/ai-testing-agent/blob/main/main.py): `main.py`

### Other components

- **User**
- **OpenRouter LLM**
- **pytest**

## Connections

- User → Chat agent: requests action (evidence: `README.md`)
- Chat agent → Agent tools: dispatches tools (evidence: `agent.py`)
- Chat agent → Safe-run retry: offers retry (evidence: `agent.py`)
- Safe-run retry → Agent tools: calls tools (evidence: `agent.py`)
- Agent tools → Test CLI: runs commands (evidence: `agent_tools.py`)
- Test CLI → Plan generation: dispatches plan (evidence: `api_tester.py`)
- Test CLI → Test generation: dispatches generate (evidence: `api_tester.py`)
- Test CLI → Feedback refinement: dispatches feedback (evidence: `api_tester.py`)
- Test CLI → Test runner: dispatches run (evidence: `api_tester.py`)
- Plan generation → OpenRouter LLM: requests plan (evidence: `api_tester.py`)
- Test generation → OpenRouter LLM: requests code (evidence: `api_tester.py`)
- Feedback refinement → OpenRouter LLM: requests revision (evidence: `api_tester.py`)
- Test generation → Generated tests: writes tests (evidence: `api_tester.py`)
- Test runner → pytest: runs tests (evidence: `api_tester.py`)
- pytest → Generated tests: executes file
- Generated tests → Sample FastAPI: sends API requests (evidence: `README.md`)
