# dushyanth25/auto_prompting_cot architecture

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

- Interactive diagram: https://gitdiagram.com/dushyanth25/auto_prompting_cot
- Repository: https://github.com/dushyanth25/auto_prompting_cot

## Overview

AutoPrompt is a dataset-driven prompt optimizer. A user starts a run through the CLI; the run loads and partitions examples, then coordinates an iterative LangGraph workflow: solve training examples, diagnose failures, store and retrieve lessons, refine a prompt, and gate candidates on validation accuracy while preserving locked instructions. The best prompt receives a held-out test evaluation, with run metrics and reports as outputs. Separate CLI capabilities include dataset validation, post-run reporting, and memory ablation. Edges are grounded in the README and SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/autoprompt/graph/nodes.py`](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/graph/nodes.py) (Workflow stages), [`src/autoprompt/run.py`](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/run.py) (Run coordinator), [`src/autoprompt/cli.py`](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/cli.py) (CLI), [`src/autoprompt/evals/runner.py`](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/evals/runner.py) (Batch evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Run orchestration"]
  node_cli["CLI<br/>[cli.py]"]
  node_run["Run coordinator<br/>[run.py]"]
  node_config["Settings<br/>[config.py]"]
  node_loader["Dataset loader<br/>[loader.py]"]
  node_schemas["Domain schemas<br/>[schemas.py]"]
end

subgraph group_optimization["Optimization workflow"]
  node_graph["Workflow builder<br/>[builder.py]"]
  node_nodes["Workflow stages<br/>[nodes.py]"]
  node_solver["Solver agent<br/>[solver.py]"]
  node_judge["Failure judge<br/>[judge.py]"]
  node_comparator["Answer comparator<br/>[comparator.py]"]
  node_refiner["Prompt refiner<br/>[refiner.py]"]
end

subgraph group_learning["Memory and prompts"]
  node_retriever["Episode retriever<br/>[retriever.py]"]
  node_memory[("Episodic memory<br/>[store.py]")]
  node_promptstore["Versioned prompts<br/>[store.py]"]
  node_templates["Prompt templates<br/>[templates.py]"]
end

subgraph group_services["Models and configuration"]
  node_llm["LLM interface<br/>[base.py]"]
  node_groq["Groq client<br/>[groq_client.py]"]
end

subgraph group_outputs["Evaluation and reporting"]
  node_evalrunner["Batch evaluator<br/>[runner.py]"]
  node_report["Run reports<br/>[report.py]"]
  node_ablation["Memory ablation<br/>[ablation.py]"]
end

node_user(("User"))
node_groqservice{{"Groq API"}}

node_user -->|"starts run"| node_cli
node_cli -->|"invokes"| node_run
node_cli -->|"validates dataset"| node_loader
node_cli -->|"generates"| node_report
node_cli -->|"runs study"| node_ablation
node_run -->|"uses settings"| node_config
node_run -->|"loads splits"| node_loader
node_run -->|"builds workflow"| node_graph
node_graph -->|"registers stages"| node_nodes
node_nodes -->|"evaluates examples"| node_evalrunner
node_nodes -->|"diagnoses failures"| node_judge
node_nodes -->|"proposes prompts"| node_refiner
node_nodes -->|"retrieves lessons"| node_retriever
node_nodes -->|"stores episodes"| node_memory
node_nodes -->|"loads and saves"| node_promptstore
node_evalrunner -->|"solves examples"| node_solver
node_evalrunner -->|"checks answers"| node_comparator
node_evalrunner -->|"requests lessons"| node_retriever
node_retriever -->|"reads episodes"| node_memory
node_refiner -->|"validates candidates"| node_promptstore
node_solver -->|"uses templates"| node_templates
node_solver -->|"requests completion"| node_llm
node_judge -->|"requests diagnosis"| node_llm
node_refiner -->|"requests mutation"| node_llm
node_groq -->|"implements"| node_llm
node_groq -->|"calls"| node_groqservice
node_run -->|"tests held-out split"| node_evalrunner
node_run -->|"persists run results"| node_report
node_ablation -->|"compares runs"| node_run
node_config -->|"validates settings"| node_schemas
node_loader -->|"creates examples"| node_schemas
node_nodes -->|"uses state models"| node_schemas

click node_cli "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/cli.py"
click node_run "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/run.py"
click node_config "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/config.py"
click node_loader "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/data/loader.py"
click node_graph "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/graph/builder.py"
click node_nodes "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/graph/nodes.py"
click node_solver "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/solver.py"
click node_judge "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/judge.py"
click node_comparator "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/comparator.py"
click node_refiner "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/refiner.py"
click node_retriever "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/memory/retriever.py"
click node_memory "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/memory/store.py"
click node_promptstore "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/prompts/store.py"
click node_templates "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/prompts/templates.py"
click node_llm "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/llm/base.py"
click node_groq "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/llm/groq_client.py"
click node_evalrunner "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/evals/runner.py"
click node_report "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/reporting/report.py"
click node_ablation "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/reporting/ablation.py"
click node_schemas "https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/schemas.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_run,node_config,node_loader,node_schemas,node_user toneBlue
class node_graph,node_nodes,node_solver,node_judge,node_comparator,node_refiner toneAmber
class node_retriever,node_memory,node_promptstore,node_templates,node_groqservice toneMint
class node_llm,node_groq toneRose
class node_evalrunner,node_report,node_ablation toneIndigo
```

## Components

### Run orchestration

- [CLI](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/cli.py): `src/autoprompt/cli.py`
- [Run coordinator](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/run.py): `src/autoprompt/run.py`
- [Settings](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/config.py): `src/autoprompt/config.py`
- [Dataset loader](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/data/loader.py): `src/autoprompt/data/loader.py`
- [Domain schemas](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/schemas.py): `src/autoprompt/schemas.py`

### Optimization workflow

- [Workflow builder](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/graph/builder.py): `src/autoprompt/graph/builder.py`
- [Workflow stages](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/graph/nodes.py): `src/autoprompt/graph/nodes.py`
- [Solver agent](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/solver.py): `src/autoprompt/agents/solver.py`
- [Failure judge](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/judge.py): `src/autoprompt/agents/judge.py`
- [Answer comparator](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/comparator.py): `src/autoprompt/agents/comparator.py`
- [Prompt refiner](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/agents/refiner.py): `src/autoprompt/agents/refiner.py`

### Memory and prompts

- [Episode retriever](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/memory/retriever.py): `src/autoprompt/memory/retriever.py`
- [Episodic memory](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/memory/store.py): `src/autoprompt/memory/store.py`
- [Versioned prompts](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/prompts/store.py): `src/autoprompt/prompts/store.py`
- [Prompt templates](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/prompts/templates.py): `src/autoprompt/prompts/templates.py`

### Models and configuration

- [LLM interface](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/llm/base.py): `src/autoprompt/llm/base.py`
- [Groq client](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/llm/groq_client.py): `src/autoprompt/llm/groq_client.py`

### Evaluation and reporting

- [Batch evaluator](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/evals/runner.py): `src/autoprompt/evals/runner.py`
- [Run reports](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/reporting/report.py): `src/autoprompt/reporting/report.py`
- [Memory ablation](https://github.com/dushyanth25/auto_prompting_cot/blob/main/src/autoprompt/reporting/ablation.py): `src/autoprompt/reporting/ablation.py`

### Other components

- **User**
- **Groq API**

## Connections

- User → CLI: starts run (evidence: `README.md`)
- CLI → Run coordinator: invokes (evidence: `src/autoprompt/cli.py`)
- CLI → Dataset loader: validates dataset (evidence: `src/autoprompt/cli.py`)
- CLI → Run reports: generates (evidence: `src/autoprompt/cli.py`)
- CLI → Memory ablation: runs study (evidence: `src/autoprompt/cli.py`)
- Run coordinator → Settings: uses settings (evidence: `src/autoprompt/run.py`)
- Run coordinator → Dataset loader: loads splits (evidence: `src/autoprompt/run.py`)
- Run coordinator → Workflow builder: builds workflow (evidence: `src/autoprompt/run.py`)
- Workflow builder → Workflow stages: registers stages (evidence: `src/autoprompt/graph/builder.py`)
- Workflow stages → Batch evaluator: evaluates examples (evidence: `src/autoprompt/graph/nodes.py`)
- Workflow stages → Failure judge: diagnoses failures (evidence: `src/autoprompt/graph/nodes.py`)
- Workflow stages → Prompt refiner: proposes prompts (evidence: `src/autoprompt/graph/nodes.py`)
- Workflow stages → Episode retriever: retrieves lessons (evidence: `src/autoprompt/graph/nodes.py`)
- Workflow stages → Episodic memory: stores episodes (evidence: `README.md`)
- Workflow stages → Versioned prompts: loads and saves (evidence: `src/autoprompt/graph/nodes.py`)
- Batch evaluator → Solver agent: solves examples (evidence: `src/autoprompt/evals/runner.py`)
- Batch evaluator → Answer comparator: checks answers (evidence: `src/autoprompt/evals/runner.py`)
- Batch evaluator → Episode retriever: requests lessons (evidence: `src/autoprompt/evals/runner.py`)
- Episode retriever → Episodic memory: reads episodes (evidence: `src/autoprompt/memory/retriever.py`)
- Prompt refiner → Versioned prompts: validates candidates (evidence: `src/autoprompt/agents/refiner.py`)
- Solver agent → Prompt templates: uses templates (evidence: `src/autoprompt/agents/solver.py`)
- Solver agent → LLM interface: requests completion (evidence: `src/autoprompt/agents/solver.py`)
- Failure judge → LLM interface: requests diagnosis (evidence: `src/autoprompt/agents/judge.py`)
- Prompt refiner → LLM interface: requests mutation (evidence: `src/autoprompt/agents/refiner.py`)
- Groq client → LLM interface: implements (evidence: `src/autoprompt/llm/groq_client.py`)
- Groq client → Groq API: calls (evidence: `src/autoprompt/llm/groq_client.py`)
- Run coordinator → Batch evaluator: tests held-out split (evidence: `src/autoprompt/run.py`)
- Run coordinator → Run reports: persists run results (evidence: `src/autoprompt/run.py`)
- Memory ablation → Run coordinator: compares runs (evidence: `src/autoprompt/reporting/ablation.py`)
- Settings → Domain schemas: validates settings (evidence: `src/autoprompt/config.py`)
- Dataset loader → Domain schemas: creates examples (evidence: `src/autoprompt/data/loader.py`)
- Workflow stages → Domain schemas: uses state models (evidence: `src/autoprompt/graph/nodes.py`)
