# anubhab7105/assembly architecture

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

- Interactive diagram: https://gitdiagram.com/anubhab7105/assembly
- Repository: https://github.com/anubhab7105/assembly

## Overview

Assembly is a multi-agent research workspace: a user submits a question and time budget, the backend coordinates independent model responses and checks disagreements, then returns a synthesized answer with available sources and uncertainty. The graph preserves the documented planning, solving, challenge/research, synthesis, provider, and UI stages. Some internal links are supported by the README or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/orchestration/orchestrator.py`](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/orchestrator.py) (Run orchestrator), [`src/api`](https://github.com/anubhab7105/assembly/tree/main/src/api) (FastAPI endpoints), [`src/providers/router.py`](https://github.com/anubhab7105/assembly/blob/main/src/providers/router.py) (Model router), [`src/research/router.py`](https://github.com/anubhab7105/assembly/blob/main/src/research/router.py) (Web research)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_frontend["Web workspace"]
  node_api_client["API client<br/>[api-client.ts]"]
end

subgraph group_backend["API and execution"]
  node_api["FastAPI endpoints"]
end

subgraph group_orchestration["Agent orchestration"]
  node_orchestrator["Run orchestrator<br/>[orchestrator.py]"]
  node_planner["Task planner<br/>[planner.py]"]
  node_budget["Budget control"]
  node_capacity["Capacity checks<br/>[capacity.py]"]
  node_agent_manager["Agent manager<br/>[agent_manager.py]"]
  node_agents["Independent agents<br/>[base_agent.py]"]
  node_consensus["Consensus scoring<br/>[consensus.py]"]
  node_debate["Debate and challenge<br/>[debate.py]"]
  node_synthesis["Answer synthesis<br/>[synthesizer.py]"]
end

subgraph group_integrations["Providers and research"]
  node_research["Web research<br/>[router.py]"]
  node_sanitizer["Content sanitizer<br/>[sanitize.py]"]
  node_model_router["Model router<br/>[router.py]"]
end

subgraph group_state["Keys and local state"]
  node_key_store["Key storage<br/>[keystore.py]"]
  node_database[("Local SQLite<br/>[base.py]")]
end

node_user(("User"))
node_model_apis["Model APIs"]
node_search_services["Search services"]

node_user -->|"submits question"| node_frontend
node_frontend -->|"uses API"| node_api_client
node_api_client -->|"REST and events"| node_api
node_api -->|"starts runs"| node_orchestrator
node_orchestrator -->|"plans roles"| node_planner
node_orchestrator -->|"enforces budget"| node_budget
node_orchestrator -->|"checks capacity"| node_capacity
node_orchestrator -->|"manages agents"| node_agent_manager
node_planner -->|"selects models"| node_model_router
node_agent_manager -->|"runs independently"| node_agents
node_agents -->|"requests completions"| node_model_router
node_model_router -->|"calls providers"| node_model_apis
node_orchestrator -->|"scores responses"| node_consensus
node_orchestrator -->|"runs challenges"| node_debate
node_orchestrator -->|"requests research"| node_research
node_research -.->|"searches web"| node_search_services
node_research -->|"sanitizes content"| node_sanitizer
node_orchestrator -->|"synthesizes answer"| node_synthesis
node_synthesis -->|"returns answer"| node_frontend
node_api -->|"manages keys"| node_key_store
node_model_router -->|"reads credentials"| node_key_store
node_api -.->|"uses local storage"| node_database

click node_frontend "https://github.com/anubhab7105/assembly/tree/main/frontend/src/app"
click node_api_client "https://github.com/anubhab7105/assembly/blob/main/frontend/src/lib/api-client.ts"
click node_api "https://github.com/anubhab7105/assembly/tree/main/src/api"
click node_orchestrator "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/orchestrator.py"
click node_planner "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/planner.py"
click node_budget "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/budget_controller.py"
click node_capacity "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/capacity.py"
click node_agent_manager "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/agent_manager.py"
click node_agents "https://github.com/anubhab7105/assembly/blob/main/src/agents/base_agent.py"
click node_consensus "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/consensus.py"
click node_debate "https://github.com/anubhab7105/assembly/blob/main/src/orchestration/debate.py"
click node_synthesis "https://github.com/anubhab7105/assembly/blob/main/src/agents/synthesizer.py"
click node_research "https://github.com/anubhab7105/assembly/blob/main/src/research/router.py"
click node_sanitizer "https://github.com/anubhab7105/assembly/blob/main/src/research/sanitize.py"
click node_model_router "https://github.com/anubhab7105/assembly/blob/main/src/providers/router.py"
click node_key_store "https://github.com/anubhab7105/assembly/blob/main/src/core/keystore.py"
click node_database "https://github.com/anubhab7105/assembly/blob/main/src/database/base.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_frontend,node_api_client,node_user toneBlue
class node_api toneAmber
class node_orchestrator,node_planner,node_budget,node_capacity,node_agent_manager,node_agents,node_consensus,node_debate,node_synthesis,node_model_apis toneMint
class node_research,node_sanitizer,node_model_router toneRose
class node_key_store,node_database,node_search_services toneIndigo
```

## Components

### User experience

- [Web workspace](https://github.com/anubhab7105/assembly/tree/main/frontend/src/app): `frontend/src/app`
- [API client](https://github.com/anubhab7105/assembly/blob/main/frontend/src/lib/api-client.ts): `frontend/src/lib/api-client.ts`

### API and execution

- [FastAPI endpoints](https://github.com/anubhab7105/assembly/tree/main/src/api): `src/api`

### Agent orchestration

- [Run orchestrator](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/orchestrator.py): `src/orchestration/orchestrator.py`
- [Task planner](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/planner.py): `src/orchestration/planner.py`
- [Budget control](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/budget_controller.py): `src/orchestration/budget_controller.py`
- [Capacity checks](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/capacity.py): `src/orchestration/capacity.py`
- [Agent manager](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/agent_manager.py): `src/orchestration/agent_manager.py`
- [Independent agents](https://github.com/anubhab7105/assembly/blob/main/src/agents/base_agent.py): `src/agents/base_agent.py`
- [Consensus scoring](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/consensus.py): `src/orchestration/consensus.py`
- [Debate and challenge](https://github.com/anubhab7105/assembly/blob/main/src/orchestration/debate.py): `src/orchestration/debate.py`
- [Answer synthesis](https://github.com/anubhab7105/assembly/blob/main/src/agents/synthesizer.py): `src/agents/synthesizer.py`

### Providers and research

- [Web research](https://github.com/anubhab7105/assembly/blob/main/src/research/router.py): `src/research/router.py`
- [Content sanitizer](https://github.com/anubhab7105/assembly/blob/main/src/research/sanitize.py): `src/research/sanitize.py`
- [Model router](https://github.com/anubhab7105/assembly/blob/main/src/providers/router.py): `src/providers/router.py`

### Keys and local state

- [Key storage](https://github.com/anubhab7105/assembly/blob/main/src/core/keystore.py): `src/core/keystore.py`
- [Local SQLite](https://github.com/anubhab7105/assembly/blob/main/src/database/base.py): `src/database/base.py`

### Other components

- **User**
- **Model APIs**
- **Search services**

## Connections

- User → Web workspace: submits question (evidence: `README.md`)
- Web workspace → API client: uses API (evidence: `README.md`)
- API client → FastAPI endpoints: REST and events (evidence: `README.md`)
- FastAPI endpoints → Run orchestrator: starts runs (evidence: `README.md`)
- Run orchestrator → Task planner: plans roles (evidence: `src/orchestration/orchestrator.py`)
- Run orchestrator → Budget control: enforces budget (evidence: `src/orchestration/orchestrator.py`)
- Run orchestrator → Capacity checks: checks capacity (evidence: `src/orchestration/orchestrator.py`)
- Run orchestrator → Agent manager: manages agents (evidence: `src/orchestration/orchestrator.py`)
- Task planner → Model router: selects models (evidence: `README.md`)
- Agent manager → Independent agents: runs independently (evidence: `src/orchestration/agent_manager.py`)
- Independent agents → Model router: requests completions (evidence: `src/agents/base_agent.py`)
- Model router → Model APIs: calls providers (evidence: `README.md`)
- Run orchestrator → Consensus scoring: scores responses (evidence: `src/orchestration/orchestrator.py`)
- Run orchestrator → Debate and challenge: runs challenges (evidence: `src/orchestration/orchestrator.py`)
- Run orchestrator → Web research: requests research (evidence: `src/orchestration/orchestrator.py`)
- Web research → Search services: searches web (evidence: `README.md`)
- Web research → Content sanitizer: sanitizes content (evidence: `src/research/sanitize.py`)
- Run orchestrator → Answer synthesis: synthesizes answer (evidence: `src/orchestration/orchestrator.py`)
- Answer synthesis → Web workspace: returns answer (evidence: `README.md`)
- FastAPI endpoints → Key storage: manages keys (evidence: `src/main.py`)
- Model router → Key storage: reads credentials (evidence: `src/providers/router.py`)
- FastAPI endpoints → Local SQLite: uses local storage (evidence: `README.md`)
