# foundationagents/aorchestra architecture

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

- Interactive diagram: https://gitdiagram.com/foundationagents/aorchestra
- Repository: https://github.com/foundationagents/aorchestra

## Overview

AOrchestra is a benchmark-oriented framework for dynamically orchestrating specialized sub-agents. For each GAIA, SWE-bench, or Terminal-Bench task, a benchmark runner creates a MainAgent that delegates subtasks with configurable instructions, context, tools, and models; sub-agents execute in the benchmark environment and report results for further orchestration or submission. The repository also includes benchmark-specific task tools and environment adapters. The README documents the three benchmark capabilities; sampled excerpts confirm parts of the SWE-bench and Terminal-Bench flows, so uncertain GAIA wiring is not shown.

Main entry points: [`aorchestra/main_agent.py`](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/main_agent.py) (Main Agent), [`aorchestra/tools/delegate.py`](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/delegate.py) (Delegation Tool), [`aorchestra/subagents/react_agent.py`](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/subagents/react_agent.py) (ReAct Sub-agent), [`aorchestra/subagents/swebench_agent.py`](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/subagents/swebench_agent.py) (SWE Sub-agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Orchestration"]
  node_main_agent["Main Agent<br/>[main_agent.py]"]
  node_delegate_tool["Delegation Tool<br/>[delegate.py]"]
  node_submit_tool["Submission Tool<br/>[submit.py]"]
  node_completion_tool["Completion Tool<br/>[complete.py]"]
  node_gaia_prompt["GAIA Prompts<br/>[gaia.py]"]
  node_swe_prompt["SWE Prompts<br/>[swebench.py]"]
  node_terminal_prompt["Terminal Prompts<br/>[terminalbench.py]"]
end

subgraph group_agent_runtime["Agent Runtime"]
  node_react_agent["ReAct Sub-agent<br/>[react_agent.py]"]
  node_swe_agent["SWE Sub-agent<br/>[swebench_agent.py]"]
  node_base_agent["Agent Runtime<br/>[base_agent.py]"]
  node_memory["Agent Memory<br/>[memory.py]"]
  node_llm["Async LLM<br/>[async_llm.py]"]
end

subgraph group_benchmark_workflows["Benchmark Workflows"]
  node_gaia_runner["GAIA Runner<br/>[gaia_runner.py]"]
  node_swe_runner["SWE-bench Runner<br/>[swebench_runner.py]"]
  node_terminal_runner["Terminal-Bench Runner"]
  node_gaia_tools["GAIA Tools"]
  node_swe_tools["SWE Tools<br/>[aci_tools.py]"]
  node_terminal_executor["Terminal Executor<br/>[base_executor.py]"]
  node_swe_executor["SWE Executor"]
  node_benchmark_env["Benchmark Environment<br/>[env.py]"]
end

subgraph group_integrations["External Services"]
  node_model_service(("LLM Provider"))
  node_sandbox_service(("Execution Sandbox"))
  node_web_services(("Search And Web APIs"))
end

node_user(("Benchmark Operator"))

node_user -->|"runs tasks"| node_gaia_runner
node_user -->|"runs tasks"| node_swe_runner
node_user -->|"runs tasks"| node_terminal_runner
node_gaia_runner -->|"creates"| node_main_agent
node_swe_runner -->|"creates"| node_main_agent
node_terminal_runner -->|"creates"| node_main_agent
node_main_agent -->|"requests decisions"| node_llm
node_llm -->|"calls model"| node_model_service
node_main_agent -->|"dispatches"| node_delegate_tool
node_main_agent -->|"dispatches"| node_submit_tool
node_main_agent -->|"dispatches"| node_completion_tool
node_main_agent -->|"builds prompts"| node_gaia_prompt
node_main_agent -->|"builds prompts"| node_swe_prompt
node_main_agent -->|"builds prompts"| node_terminal_prompt
node_delegate_tool -->|"runs delegated task"| node_react_agent
node_delegate_tool -->|"runs delegated task"| node_swe_agent
node_react_agent -->|"uses runtime"| node_base_agent
node_react_agent -->|"updates memory"| node_memory
node_swe_agent -->|"updates memory"| node_memory
node_react_agent -->|"requests actions"| node_llm
node_swe_agent -->|"requests actions"| node_llm
node_swe_runner -->|"runs tasks"| node_swe_executor
node_terminal_runner -->|"runs tasks"| node_terminal_executor
node_gaia_runner -->|"uses tools"| node_gaia_tools
node_swe_agent -->|"issues commands"| node_swe_tools
node_terminal_executor -->|"executes in"| node_sandbox_service
node_benchmark_env -.->|"provides environment"| node_sandbox_service
node_gaia_tools -.->|"accesses APIs"| node_web_services
node_submit_tool -->|"submits result"| node_benchmark_env
node_delegate_tool -->|"uses task environment"| node_benchmark_env

click node_gaia_runner "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/runners/gaia_runner.py"
click node_swe_runner "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/runners/swebench_runner.py"
click node_terminal_runner "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/runners/terminalbench_runner.py"
click node_main_agent "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/main_agent.py"
click node_delegate_tool "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/delegate.py"
click node_submit_tool "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/submit.py"
click node_completion_tool "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/complete.py"
click node_gaia_prompt "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/prompts/gaia.py"
click node_swe_prompt "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/prompts/swebench.py"
click node_terminal_prompt "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/prompts/terminalbench.py"
click node_react_agent "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/subagents/react_agent.py"
click node_swe_agent "https://github.com/foundationagents/aorchestra/blob/main/aorchestra/subagents/swebench_agent.py"
click node_base_agent "https://github.com/foundationagents/aorchestra/blob/main/base/agent/base_agent.py"
click node_memory "https://github.com/foundationagents/aorchestra/blob/main/base/agent/memory.py"
click node_llm "https://github.com/foundationagents/aorchestra/blob/main/base/engine/async_llm.py"
click node_gaia_tools "https://github.com/foundationagents/aorchestra/tree/main/benchmark/gaia/tools"
click node_swe_tools "https://github.com/foundationagents/aorchestra/blob/main/benchmark/swebench/aci_tools.py"
click node_terminal_executor "https://github.com/foundationagents/aorchestra/blob/main/benchmark/terminalbench/base_executor.py"
click node_swe_executor "https://github.com/foundationagents/aorchestra/blob/main/benchmark/swebench/swebench_executor.py"
click node_benchmark_env "https://github.com/foundationagents/aorchestra/blob/main/benchmark/common/env.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_agent,node_delegate_tool,node_submit_tool,node_completion_tool,node_gaia_prompt,node_swe_prompt,node_terminal_prompt toneBlue
class node_react_agent,node_swe_agent,node_base_agent,node_memory,node_llm toneAmber
class node_gaia_runner,node_swe_runner,node_terminal_runner,node_gaia_tools,node_swe_tools,node_terminal_executor,node_swe_executor,node_benchmark_env toneMint
class node_model_service,node_sandbox_service,node_web_services toneRose
class node_user toneIndigo
```

## Components

### Orchestration

- [Main Agent](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/main_agent.py): `aorchestra/main_agent.py`
- [Delegation Tool](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/delegate.py): `aorchestra/tools/delegate.py`
- [Submission Tool](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/submit.py): `aorchestra/tools/submit.py`
- [Completion Tool](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/tools/complete.py): `aorchestra/tools/complete.py`
- [GAIA Prompts](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/prompts/gaia.py): `aorchestra/prompts/gaia.py`
- [SWE Prompts](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/prompts/swebench.py): `aorchestra/prompts/swebench.py`
- [Terminal Prompts](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/prompts/terminalbench.py): `aorchestra/prompts/terminalbench.py`

### Agent Runtime

- [ReAct Sub-agent](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/subagents/react_agent.py): `aorchestra/subagents/react_agent.py`
- [SWE Sub-agent](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/subagents/swebench_agent.py): `aorchestra/subagents/swebench_agent.py`
- [Agent Runtime](https://github.com/foundationagents/aorchestra/blob/main/base/agent/base_agent.py): `base/agent/base_agent.py`
- [Agent Memory](https://github.com/foundationagents/aorchestra/blob/main/base/agent/memory.py): `base/agent/memory.py`
- [Async LLM](https://github.com/foundationagents/aorchestra/blob/main/base/engine/async_llm.py): `base/engine/async_llm.py`

### Benchmark Workflows

- [GAIA Runner](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/runners/gaia_runner.py): `aorchestra/runners/gaia_runner.py`
- [SWE-bench Runner](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/runners/swebench_runner.py): `aorchestra/runners/swebench_runner.py`
- [Terminal-Bench Runner](https://github.com/foundationagents/aorchestra/blob/main/aorchestra/runners/terminalbench_runner.py): `aorchestra/runners/terminalbench_runner.py`
- [GAIA Tools](https://github.com/foundationagents/aorchestra/tree/main/benchmark/gaia/tools): `benchmark/gaia/tools`
- [SWE Tools](https://github.com/foundationagents/aorchestra/blob/main/benchmark/swebench/aci_tools.py): `benchmark/swebench/aci_tools.py`
- [Terminal Executor](https://github.com/foundationagents/aorchestra/blob/main/benchmark/terminalbench/base_executor.py): `benchmark/terminalbench/base_executor.py`
- [SWE Executor](https://github.com/foundationagents/aorchestra/blob/main/benchmark/swebench/swebench_executor.py): `benchmark/swebench/swebench_executor.py`
- [Benchmark Environment](https://github.com/foundationagents/aorchestra/blob/main/benchmark/common/env.py): `benchmark/common/env.py`

### External Services

- **LLM Provider**
- **Execution Sandbox**
- **Search And Web APIs**

### Other components

- **Benchmark Operator**

## Connections

- Benchmark Operator → GAIA Runner: runs tasks
- Benchmark Operator → SWE-bench Runner: runs tasks
- Benchmark Operator → Terminal-Bench Runner: runs tasks
- GAIA Runner → Main Agent: creates
- SWE-bench Runner → Main Agent: creates
- Terminal-Bench Runner → Main Agent: creates
- Main Agent → Async LLM: requests decisions
- Async LLM → LLM Provider: calls model
- Main Agent → Delegation Tool: dispatches
- Main Agent → Submission Tool: dispatches
- Main Agent → Completion Tool: dispatches
- Main Agent → GAIA Prompts: builds prompts
- Main Agent → SWE Prompts: builds prompts
- Main Agent → Terminal Prompts: builds prompts
- Delegation Tool → ReAct Sub-agent: runs delegated task
- Delegation Tool → SWE Sub-agent: runs delegated task
- ReAct Sub-agent → Agent Runtime: uses runtime
- ReAct Sub-agent → Agent Memory: updates memory
- SWE Sub-agent → Agent Memory: updates memory
- ReAct Sub-agent → Async LLM: requests actions
- SWE Sub-agent → Async LLM: requests actions
- SWE-bench Runner → SWE Executor: runs tasks
- Terminal-Bench Runner → Terminal Executor: runs tasks
- GAIA Runner → GAIA Tools: uses tools
- SWE Sub-agent → SWE Tools: issues commands
- Terminal Executor → Execution Sandbox: executes in
- Benchmark Environment → Execution Sandbox: provides environment
- GAIA Tools → Search And Web APIs: accesses APIs
- Submission Tool → Benchmark Environment: submits result
- Delegation Tool → Benchmark Environment: uses task environment
