# ucsb-ai/gea architecture

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

- Interactive diagram: https://gitdiagram.com/ucsb-ai/gea
- Repository: https://github.com/ucsb-ai/gea

## Overview

GEA is a research system for evolving groups of coding agents through shared experience. The main workflow starts at `GEA_outer.py`, which coordinates repeated self-improvement steps: agents are prompted to modify their coding behavior, evaluated on SWE-bench or Polyglot tasks, and their results inform subsequent evolution. The coding agents use language-model APIs and tools to work on repository issues; evaluation runs them in Docker-based benchmark environments and produces reports. The graph reflects documented capabilities and source-index references; several internal implementation details were not sampled, so some documented subsystem links use the README as evidence.

Main entry points: [`self_improve_step.py`](https://github.com/ucsb-ai/gea/blob/main/self_improve_step.py) (Self-Improvement Step), [`GEA_outer.py`](https://github.com/ucsb-ai/gea/blob/main/GEA_outer.py) (GEA Coordinator), [`polyglot/harness.py`](https://github.com/ucsb-ai/gea/blob/main/polyglot/harness.py) (Polyglot Harness), [`coding_agent.py`](https://github.com/ucsb-ai/gea/blob/main/coding_agent.py) (SWE Coding Agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_evolution["Evolution Loop"]
  node_gea["GEA Coordinator<br/>[GEA_outer.py]"]
  node_improve["Self-Improvement Step"]
  node_improve_prompts["Improvement Prompts"]
  node_diagnose_prompt["Diagnosis Prompt"]
end

subgraph group_agent["Coding Agents"]
  node_coding_agent["SWE Coding Agent<br/>[coding_agent.py]"]
  node_poly_agent["Polyglot Coding Agent"]
  node_llm_tools["Tool-Enabled LLM<br/>[llm_withtools.py]"]
  node_llm["LLM Client<br/>[llm.py]"]
  node_agent_tools["Agent Tools"]
  node_test_prompt["Test Instructions<br/>[testrepo_prompt.py]"]
end

subgraph group_evaluation["Benchmark Evaluation"]
  node_swe_harness["SWE-bench Harness<br/>[harness.py]"]
  node_swe_report["SWE-bench Reports<br/>[report.py]"]
  node_poly_harness["Polyglot Harness<br/>[harness.py]"]
  node_poly_build["Polyglot Image Builder<br/>[docker_build.py]"]
  node_poly_eval["Polyglot Evaluation<br/>[run_evaluation.py]"]
end

subgraph group_support["Shared Support"]
  node_docker_helpers["Docker Helpers<br/>[docker_utils.py]"]
  node_common["Common Utilities<br/>[common_utils.py]"]
  node_evo_utils["Evolution Utilities<br/>[evo_utils.py]"]
  node_git_utils["Git Utilities<br/>[git_utils.py]"]
  node_log_parser["Test Log Parsers<br/>[swe_log_parsers.py]"]
end

node_researcher(("GEA Operator"))
node_docker["Docker Runtime"]

node_researcher -->|"runs"| node_gea
node_gea -->|"runs steps"| node_improve
node_gea -->|"uses prompts"| node_improve_prompts
node_gea -->|"uses utilities"| node_common
node_gea -->|"uses utilities"| node_docker_helpers
node_gea -->|"uses utilities"| node_evo_utils
node_improve -->|"builds prompts"| node_improve_prompts
node_improve -->|"requests diagnosis"| node_diagnose_prompt
node_improve -->|"requests responses"| node_llm
node_improve -->|"evaluates SWE"| node_swe_harness
node_improve -->|"evaluates Polyglot"| node_poly_harness
node_improve -->|"requests reports"| node_swe_report
node_improve -->|"uses utilities"| node_common
node_improve -->|"uses utilities"| node_evo_utils
node_improve -->|"uses utilities"| node_docker_helpers
node_coding_agent -->|"requests model"| node_llm_tools
node_coding_agent -->|"uses Git"| node_git_utils
node_coding_agent -->|"uses tools"| node_agent_tools
node_llm_tools -->|"uses client"| node_llm
node_llm_tools -->|"dispatches tools"| node_agent_tools
node_poly_agent -->|"requests model"| node_llm_tools
node_poly_agent -->|"uses Git"| node_git_utils
node_swe_harness -->|"runs agent"| node_coding_agent
node_swe_harness -->|"runs containers"| node_docker
node_swe_harness -->|"uses test guidance"| node_test_prompt
node_poly_harness -->|"runs agent"| node_poly_agent
node_poly_harness -->|"runs containers"| node_docker
node_poly_harness -->|"builds images"| node_poly_build
node_poly_harness -->|"uses test guidance"| node_test_prompt
node_poly_eval -->|"uses image builder"| node_poly_build
node_poly_build -->|"uses helpers"| node_docker_helpers
node_poly_build -->|"builds images"| node_docker
node_improve_prompts -->|"reads files"| node_common
node_improve_prompts -->|"logs safely"| node_docker_helpers
node_coding_agent -.->|"uses test guidance"| node_test_prompt
node_swe_report -.->|"parses test logs"| node_log_parser

click node_gea "https://github.com/ucsb-ai/gea/blob/main/GEA_outer.py"
click node_improve "https://github.com/ucsb-ai/gea/blob/main/self_improve_step.py"
click node_improve_prompts "https://github.com/ucsb-ai/gea/blob/main/prompts/self_improvement_prompt.py"
click node_diagnose_prompt "https://github.com/ucsb-ai/gea/blob/main/prompts/diagnose_improvement_prompt.py"
click node_coding_agent "https://github.com/ucsb-ai/gea/blob/main/coding_agent.py"
click node_poly_agent "https://github.com/ucsb-ai/gea/blob/main/coding_agent_polyglot.py"
click node_llm_tools "https://github.com/ucsb-ai/gea/blob/main/llm_withtools.py"
click node_llm "https://github.com/ucsb-ai/gea/blob/main/llm.py"
click node_agent_tools "https://github.com/ucsb-ai/gea/tree/main/tools"
click node_test_prompt "https://github.com/ucsb-ai/gea/blob/main/prompts/testrepo_prompt.py"
click node_swe_harness "https://github.com/ucsb-ai/gea/blob/main/swe_bench/harness.py"
click node_swe_report "https://github.com/ucsb-ai/gea/blob/main/swe_bench/report.py"
click node_poly_harness "https://github.com/ucsb-ai/gea/blob/main/polyglot/harness.py"
click node_poly_build "https://github.com/ucsb-ai/gea/blob/main/polyglot/docker_build.py"
click node_poly_eval "https://github.com/ucsb-ai/gea/blob/main/polyglot/run_evaluation.py"
click node_docker_helpers "https://github.com/ucsb-ai/gea/blob/main/utils/docker_utils.py"
click node_common "https://github.com/ucsb-ai/gea/blob/main/utils/common_utils.py"
click node_evo_utils "https://github.com/ucsb-ai/gea/blob/main/utils/evo_utils.py"
click node_git_utils "https://github.com/ucsb-ai/gea/blob/main/utils/git_utils.py"
click node_log_parser "https://github.com/ucsb-ai/gea/blob/main/utils/swe_log_parsers.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_gea,node_improve,node_improve_prompts,node_diagnose_prompt toneBlue
class node_coding_agent,node_poly_agent,node_llm_tools,node_llm,node_agent_tools,node_test_prompt toneAmber
class node_swe_harness,node_swe_report,node_poly_harness,node_poly_build,node_poly_eval toneMint
class node_docker_helpers,node_common,node_evo_utils,node_git_utils,node_log_parser toneRose
class node_researcher,node_docker toneIndigo
```

## Components

### Evolution Loop

- [GEA Coordinator](https://github.com/ucsb-ai/gea/blob/main/GEA_outer.py): `GEA_outer.py`
- [Self-Improvement Step](https://github.com/ucsb-ai/gea/blob/main/self_improve_step.py): `self_improve_step.py`
- [Improvement Prompts](https://github.com/ucsb-ai/gea/blob/main/prompts/self_improvement_prompt.py): `prompts/self_improvement_prompt.py`
- [Diagnosis Prompt](https://github.com/ucsb-ai/gea/blob/main/prompts/diagnose_improvement_prompt.py): `prompts/diagnose_improvement_prompt.py`

### Coding Agents

- [SWE Coding Agent](https://github.com/ucsb-ai/gea/blob/main/coding_agent.py): `coding_agent.py`
- [Polyglot Coding Agent](https://github.com/ucsb-ai/gea/blob/main/coding_agent_polyglot.py): `coding_agent_polyglot.py`
- [Tool-Enabled LLM](https://github.com/ucsb-ai/gea/blob/main/llm_withtools.py): `llm_withtools.py`
- [LLM Client](https://github.com/ucsb-ai/gea/blob/main/llm.py): `llm.py`
- [Agent Tools](https://github.com/ucsb-ai/gea/tree/main/tools): `tools`
- [Test Instructions](https://github.com/ucsb-ai/gea/blob/main/prompts/testrepo_prompt.py): `prompts/testrepo_prompt.py`

### Benchmark Evaluation

- [SWE-bench Harness](https://github.com/ucsb-ai/gea/blob/main/swe_bench/harness.py): `swe_bench/harness.py`
- [SWE-bench Reports](https://github.com/ucsb-ai/gea/blob/main/swe_bench/report.py): `swe_bench/report.py`
- [Polyglot Harness](https://github.com/ucsb-ai/gea/blob/main/polyglot/harness.py): `polyglot/harness.py`
- [Polyglot Image Builder](https://github.com/ucsb-ai/gea/blob/main/polyglot/docker_build.py): `polyglot/docker_build.py`
- [Polyglot Evaluation](https://github.com/ucsb-ai/gea/blob/main/polyglot/run_evaluation.py): `polyglot/run_evaluation.py`

### Shared Support

- [Docker Helpers](https://github.com/ucsb-ai/gea/blob/main/utils/docker_utils.py): `utils/docker_utils.py`
- [Common Utilities](https://github.com/ucsb-ai/gea/blob/main/utils/common_utils.py): `utils/common_utils.py`
- [Evolution Utilities](https://github.com/ucsb-ai/gea/blob/main/utils/evo_utils.py): `utils/evo_utils.py`
- [Git Utilities](https://github.com/ucsb-ai/gea/blob/main/utils/git_utils.py): `utils/git_utils.py`
- [Test Log Parsers](https://github.com/ucsb-ai/gea/blob/main/utils/swe_log_parsers.py): `utils/swe_log_parsers.py`

### Other components

- **GEA Operator**
- **Docker Runtime**

## Connections

- GEA Operator → GEA Coordinator: runs (evidence: `README.md`)
- GEA Coordinator → Self-Improvement Step: runs steps (evidence: `GEA_outer.py`)
- GEA Coordinator → Improvement Prompts: uses prompts (evidence: `GEA_outer.py`)
- GEA Coordinator → Common Utilities: uses utilities (evidence: `GEA_outer.py`)
- GEA Coordinator → Docker Helpers: uses utilities (evidence: `GEA_outer.py`)
- GEA Coordinator → Evolution Utilities: uses utilities (evidence: `GEA_outer.py`)
- Self-Improvement Step → Improvement Prompts: builds prompts (evidence: `self_improve_step.py`)
- Self-Improvement Step → Diagnosis Prompt: requests diagnosis (evidence: `self_improve_step.py`)
- Self-Improvement Step → LLM Client: requests responses (evidence: `self_improve_step.py`)
- Self-Improvement Step → SWE-bench Harness: evaluates SWE (evidence: `self_improve_step.py`)
- Self-Improvement Step → Polyglot Harness: evaluates Polyglot (evidence: `self_improve_step.py`)
- Self-Improvement Step → SWE-bench Reports: requests reports (evidence: `self_improve_step.py`)
- Self-Improvement Step → Common Utilities: uses utilities (evidence: `self_improve_step.py`)
- Self-Improvement Step → Evolution Utilities: uses utilities (evidence: `self_improve_step.py`)
- Self-Improvement Step → Docker Helpers: uses utilities (evidence: `self_improve_step.py`)
- SWE Coding Agent → Tool-Enabled LLM: requests model (evidence: `coding_agent.py`)
- SWE Coding Agent → Git Utilities: uses Git (evidence: `coding_agent.py`)
- SWE Coding Agent → Agent Tools: uses tools
- Tool-Enabled LLM → LLM Client: uses client (evidence: `llm_withtools.py`)
- Tool-Enabled LLM → Agent Tools: dispatches tools (evidence: `llm_withtools.py`)
- Polyglot Coding Agent → Tool-Enabled LLM: requests model (evidence: `coding_agent_polyglot.py`)
- Polyglot Coding Agent → Git Utilities: uses Git (evidence: `coding_agent_polyglot.py`)
- SWE-bench Harness → SWE Coding Agent: runs agent (evidence: `swe_bench/harness.py`)
- SWE-bench Harness → Docker Runtime: runs containers (evidence: `swe_bench/harness.py`)
- SWE-bench Harness → Test Instructions: uses test guidance (evidence: `swe_bench/harness.py`)
- Polyglot Harness → Polyglot Coding Agent: runs agent (evidence: `polyglot/harness.py`)
- Polyglot Harness → Docker Runtime: runs containers (evidence: `polyglot/harness.py`)
- Polyglot Harness → Polyglot Image Builder: builds images (evidence: `polyglot/harness.py`)
- Polyglot Harness → Test Instructions: uses test guidance (evidence: `polyglot/harness.py`)
- Polyglot Evaluation → Polyglot Image Builder: uses image builder (evidence: `polyglot/run_evaluation.py`)
- Polyglot Image Builder → Docker Helpers: uses helpers (evidence: `polyglot/docker_build.py`)
- Polyglot Image Builder → Docker Runtime: builds images (evidence: `polyglot/docker_build.py`)
- Improvement Prompts → Common Utilities: reads files (evidence: `prompts/self_improvement_prompt.py`)
- Improvement Prompts → Docker Helpers: logs safely (evidence: `prompts/self_improvement_prompt.py`)
- SWE Coding Agent → Test Instructions: uses test guidance
- SWE-bench Reports → Test Log Parsers: parses test logs
