# agent4ops/ambig-iac architecture

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

- Interactive diagram: https://gitdiagram.com/agent4ops/ambig-iac
- Repository: https://github.com/agent4ops/ambig-iac

## Overview

Ambig-IaC is a research framework for clarifying ambiguous infrastructure requests, generating structured Terraform infrastructure specs, and evaluating those specs against dataset ground truth. The primary workflow loads a task, runs a selected clarification strategy using a reference-configuration proxy, generates or reuses a spec, and saves results; evaluation is a separate run. The README documents several strategies and structural/attribute evaluation. Edges reflect documented workflow or source-index references; some method internals and evaluator details were not excerpted, so uncertain links are omitted.

Main entry points: [`main.py`](https://github.com/agent4ops/ambig-iac/blob/main/main.py) (Pipeline entry), [`src/methods/dimension_aware_refinement.py`](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/dimension_aware_refinement.py) (Dimension refinement), [`evaluate.py`](https://github.com/agent4ops/ambig-iac/blob/main/evaluate.py) (Spec evaluation), [`src/user_proxy.py`](https://github.com/agent4ops/ambig-iac/blob/main/src/user_proxy.py) (Reference proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Task Workflow"]
  node_main["Pipeline entry<br/>[main.py]"]
  node_dataset["Task loader<br/>[datasets.py]"]
  node_taskdata[("IaC task data")]
  node_results["Saved outputs<br/>[main.py]"]
end

subgraph group_clarification["Clarification Methods"]
  node_direct["Direct method<br/>[direct.py]"]
  node_randomq["Random questions<br/>[direct_random_q.py]"]
  node_bestn["Best-of-N<br/>[best_of_n.py]"]
  node_consistency["Self consistency"]
  node_refinement["Dimension refinement"]
  node_annotated["Annotated questions"]
  node_weighted["Candidate weighting<br/>[weighted_utils.py]"]
  node_proxy["Reference proxy<br/>[user_proxy.py]"]
end

subgraph group_specs["Spec Modeling"]
  node_specgen["Spec generation<br/>[spec_generator.py]"]
  node_editactions["Spec edits<br/>[edit_actions.py]"]
  node_spectypes["Spec model<br/>[spec_types.py]"]
  node_converter["Plan conversion<br/>[spec_converter.py]"]
  node_deps["Dependency graph<br/>[build_deps.py]"]
end

subgraph group_services["LLM Services"]
  node_config["LLM configuration<br/>[config.py]"]
  node_llm["Azure OpenAI client<br/>[llm.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluator["Spec evaluation<br/>[evaluate.py]"]
end

node_operator(("Experiment runner"))
node_azure{{"Azure OpenAI"}}

node_operator -->|"runs"| node_main
node_main -->|"loads tasks"| node_dataset
node_dataset -->|"reads tasks"| node_taskdata
node_main -->|"selects method"| node_direct
node_main -->|"selects method"| node_randomq
node_main -->|"selects method"| node_bestn
node_main -->|"selects method"| node_consistency
node_main -->|"selects method"| node_refinement
node_randomq -->|"asks questions"| node_proxy
node_bestn -->|"asks questions"| node_proxy
node_refinement -->|"weights candidates"| node_weighted
node_refinement -->|"uses edits"| node_editactions
node_refinement -->|"asks questions"| node_proxy
node_proxy -->|"queries"| node_llm
node_config -->|"creates client"| node_llm
node_llm -->|"sends requests"| node_azure
node_main -->|"generates spec"| node_specgen
node_specgen -->|"uses client"| node_llm
node_specgen -->|"produces spec"| node_spectypes
node_editactions -->|"edits model"| node_spectypes
node_converter -->|"builds dependencies"| node_deps
node_main -->|"saves outputs"| node_results
node_operator -->|"runs evaluation"| node_evaluator
node_evaluator -->|"loads tasks"| node_dataset
node_evaluator -->|"converts ground truth"| node_converter
node_evaluator -->|"compares specs"| node_results

click node_main "https://github.com/agent4ops/ambig-iac/blob/main/main.py"
click node_dataset "https://github.com/agent4ops/ambig-iac/blob/main/src/datasets.py"
click node_taskdata "https://github.com/agent4ops/ambig-iac/tree/main/datasets/ambig-iac"
click node_direct "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/direct.py"
click node_randomq "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/direct_random_q.py"
click node_bestn "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/best_of_n.py"
click node_consistency "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/self_consistency.py"
click node_refinement "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/dimension_aware_refinement.py"
click node_annotated "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/direct_random_q_anno.py"
click node_weighted "https://github.com/agent4ops/ambig-iac/blob/main/src/methods/weighted_utils.py"
click node_proxy "https://github.com/agent4ops/ambig-iac/blob/main/src/user_proxy.py"
click node_specgen "https://github.com/agent4ops/ambig-iac/blob/main/src/spec_generator.py"
click node_editactions "https://github.com/agent4ops/ambig-iac/blob/main/src/edit_actions.py"
click node_spectypes "https://github.com/agent4ops/ambig-iac/blob/main/src/spec_types.py"
click node_converter "https://github.com/agent4ops/ambig-iac/blob/main/src/spec_converter.py"
click node_deps "https://github.com/agent4ops/ambig-iac/blob/main/src/utils/build_deps.py"
click node_config "https://github.com/agent4ops/ambig-iac/blob/main/src/config.py"
click node_llm "https://github.com/agent4ops/ambig-iac/blob/main/src/utils/llm.py"
click node_evaluator "https://github.com/agent4ops/ambig-iac/blob/main/evaluate.py"
click node_results "https://github.com/agent4ops/ambig-iac/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_main,node_dataset,node_taskdata,node_results toneBlue
class node_direct,node_randomq,node_bestn,node_consistency,node_refinement,node_annotated,node_weighted,node_proxy toneAmber
class node_specgen,node_editactions,node_spectypes,node_converter,node_deps toneMint
class node_config,node_llm toneRose
class node_evaluator,node_operator,node_azure toneIndigo
```

## Components

### Task Workflow

- [Pipeline entry](https://github.com/agent4ops/ambig-iac/blob/main/main.py): `main.py`
- [Task loader](https://github.com/agent4ops/ambig-iac/blob/main/src/datasets.py): `src/datasets.py`
- [IaC task data](https://github.com/agent4ops/ambig-iac/tree/main/datasets/ambig-iac): `datasets/ambig-iac`
- [Saved outputs](https://github.com/agent4ops/ambig-iac/blob/main/main.py): `main.py`

### Clarification Methods

- [Direct method](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/direct.py): `src/methods/direct.py`
- [Random questions](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/direct_random_q.py): `src/methods/direct_random_q.py`
- [Best-of-N](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/best_of_n.py): `src/methods/best_of_n.py`
- [Self consistency](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/self_consistency.py): `src/methods/self_consistency.py`
- [Dimension refinement](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/dimension_aware_refinement.py): `src/methods/dimension_aware_refinement.py`
- [Annotated questions](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/direct_random_q_anno.py): `src/methods/direct_random_q_anno.py`
- [Candidate weighting](https://github.com/agent4ops/ambig-iac/blob/main/src/methods/weighted_utils.py): `src/methods/weighted_utils.py`
- [Reference proxy](https://github.com/agent4ops/ambig-iac/blob/main/src/user_proxy.py): `src/user_proxy.py`

### Spec Modeling

- [Spec generation](https://github.com/agent4ops/ambig-iac/blob/main/src/spec_generator.py): `src/spec_generator.py`
- [Spec edits](https://github.com/agent4ops/ambig-iac/blob/main/src/edit_actions.py): `src/edit_actions.py`
- [Spec model](https://github.com/agent4ops/ambig-iac/blob/main/src/spec_types.py): `src/spec_types.py`
- [Plan conversion](https://github.com/agent4ops/ambig-iac/blob/main/src/spec_converter.py): `src/spec_converter.py`
- [Dependency graph](https://github.com/agent4ops/ambig-iac/blob/main/src/utils/build_deps.py): `src/utils/build_deps.py`

### LLM Services

- [LLM configuration](https://github.com/agent4ops/ambig-iac/blob/main/src/config.py): `src/config.py`
- [Azure OpenAI client](https://github.com/agent4ops/ambig-iac/blob/main/src/utils/llm.py): `src/utils/llm.py`

### Evaluation

- [Spec evaluation](https://github.com/agent4ops/ambig-iac/blob/main/evaluate.py): `evaluate.py`

### Other components

- **Experiment runner**
- **Azure OpenAI**

## Connections

- Experiment runner → Pipeline entry: runs (evidence: `README.md`)
- Pipeline entry → Task loader: loads tasks (evidence: `main.py`)
- Task loader → IaC task data: reads tasks (evidence: `src/datasets.py`)
- Pipeline entry → Direct method: selects method (evidence: `README.md`)
- Pipeline entry → Random questions: selects method (evidence: `README.md`)
- Pipeline entry → Best-of-N: selects method (evidence: `README.md`)
- Pipeline entry → Self consistency: selects method (evidence: `README.md`)
- Pipeline entry → Dimension refinement: selects method (evidence: `README.md`)
- Random questions → Reference proxy: asks questions (evidence: `src/methods/direct_random_q.py`)
- Best-of-N → Reference proxy: asks questions (evidence: `src/methods/best_of_n.py`)
- Dimension refinement → Candidate weighting: weights candidates (evidence: `src/methods/dimension_aware_refinement.py`)
- Dimension refinement → Spec edits: uses edits (evidence: `src/methods/dimension_aware_refinement.py`)
- Dimension refinement → Reference proxy: asks questions (evidence: `src/methods/dimension_aware_refinement.py`)
- Reference proxy → Azure OpenAI client: queries (evidence: `src/user_proxy.py`)
- LLM configuration → Azure OpenAI client: creates client (evidence: `src/config.py`)
- Azure OpenAI client → Azure OpenAI: sends requests (evidence: `src/utils/llm.py`)
- Pipeline entry → Spec generation: generates spec (evidence: `main.py`)
- Spec generation → Azure OpenAI client: uses client (evidence: `src/spec_generator.py`)
- Spec generation → Spec model: produces spec (evidence: `src/spec_generator.py`)
- Spec edits → Spec model: edits model (evidence: `src/edit_actions.py`)
- Plan conversion → Dependency graph: builds dependencies (evidence: `src/spec_converter.py`)
- Pipeline entry → Saved outputs: saves outputs (evidence: `main.py`)
- Experiment runner → Spec evaluation: runs evaluation (evidence: `README.md`)
- Spec evaluation → Task loader: loads tasks (evidence: `evaluate.py`)
- Spec evaluation → Plan conversion: converts ground truth (evidence: `evaluate.py`)
- Spec evaluation → Saved outputs: compares specs (evidence: `README.md`)
