# 1110xx/agentforge architecture

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

- Interactive diagram: https://gitdiagram.com/1110xx/agentforge
- Repository: https://github.com/1110xx/agentforge

## Overview

Enterprise Agent Platform is an embeddable, multi-tenant agent runtime: a host submits work through a public API, the platform records stable run state, schedules sandboxed attempts, and exposes approvals, artifacts, events, and A2UI surfaces to clients. Its documented recovery path resumes from a checkpoint with a new attempt; failed effects are not replayed in place. The graph includes the frontend SDK and major documented capabilities. Some subsystem links are omitted because their implementations were not sampled.

Main entry points: [`backend/src/enterprise_agent_platform/persistence/protocol.py`](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/persistence/protocol.py) (Platform store), [`backend/src/enterprise_agent_platform/execution/k8s_worker.py`](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/k8s_worker.py) (Kubernetes worker), [`backend/src/enterprise_agent_platform/fastapi/router.py`](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/fastapi/router.py) (FastAPI API), [`backend/src/enterprise_agent_platform/control/service.py`](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/service.py) (Control plane)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and contracts"]
  node_api["FastAPI API<br/>[router.py]"]
  node_contracts["Contracts"]
end

subgraph group_control["Run control"]
  node_context["Request context<br/>[context.py]"]
  node_control_service["Control plane<br/>[service.py]"]
  node_followup["Follow-up<br/>[followup.py]"]
  node_approval["Approvals and effects"]
end

subgraph group_execution["Execution and tools"]
  node_scheduler["Scheduler"]
  node_worker["Kubernetes worker<br/>[k8s_worker.py]"]
  node_runner["Attempt runtime"]
  node_session["Model session<br/>[session.py]"]
  node_tools["Tool execution"]
end

subgraph group_surfaces["Client surfaces"]
  node_artifacts["Artifact service<br/>[service.py]"]
  node_ui_service["A2UI surfaces<br/>[service.py]"]
  node_frontend_client["Frontend client<br/>[client.ts]"]
  node_protocol["UI protocol<br/>[index.ts]"]
  node_catalog["UI catalog<br/>[index.tsx]"]
  node_react["React components<br/>[index.tsx]"]
end

subgraph group_state["State and platform"]
  node_records["Domain records<br/>[records.py]"]
  node_store[("Platform store<br/>[protocol.py]")]
  node_sql_store[("SQL adapter")]
  node_events["Message and events"]
end

node_host(("Host application"))

node_host -->|"mounts routes"| node_api
node_api -->|"serves contracts"| node_contracts
node_api -->|"uses request context"| node_context
node_control_service -->|"persists state"| node_store
node_control_service -->|"updates records"| node_records
node_worker -->|"runs scheduler"| node_scheduler
node_worker -->|"reports attempt state"| node_control_service
node_worker -->|"configures store"| node_sql_store
node_artifacts -->|"reads and writes"| node_store
node_ui_service -->|"commits revisions"| node_store
node_ui_service -->|"validates surfaces"| node_catalog
node_sql_store -->|"implements port"| node_store
node_frontend_client -->|"projects and streams"| node_frontend_client
node_react -.->|"uses SDK"| node_frontend_client
node_react -.->|"renders protocol"| node_protocol
node_catalog -.->|"provides components"| node_protocol

click node_api "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/fastapi/router.py"
click node_contracts "https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/contracts"
click node_context "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/context.py"
click node_control_service "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/service.py"
click node_followup "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/followup.py"
click node_approval "https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/control"
click node_records "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/domain/records.py"
click node_store "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/persistence/protocol.py"
click node_sql_store "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/persistence/sqlalchemy_store.py"
click node_scheduler "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/scheduler_service.py"
click node_worker "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/k8s_worker.py"
click node_runner "https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/execution"
click node_session "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/session.py"
click node_tools "https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/tools"
click node_artifacts "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/artifacts/service.py"
click node_ui_service "https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/ui/service.py"
click node_events "https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/platform"
click node_frontend_client "https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-client/src/client.ts"
click node_protocol "https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-protocol/src/index.ts"
click node_catalog "https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-catalog/src/index.tsx"
click node_react "https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-react/src/index.tsx"

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_api,node_contracts toneBlue
class node_context,node_control_service,node_followup,node_approval toneAmber
class node_scheduler,node_worker,node_runner,node_session,node_tools toneMint
class node_artifacts,node_ui_service,node_frontend_client,node_protocol,node_catalog,node_react toneRose
class node_records,node_store,node_sql_store,node_events,node_host toneIndigo
```

## Components

### API and contracts

- [FastAPI API](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/fastapi/router.py): `backend/src/enterprise_agent_platform/fastapi/router.py`
- [Contracts](https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/contracts): `backend/src/enterprise_agent_platform/contracts`

### Run control

- [Request context](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/context.py): `backend/src/enterprise_agent_platform/control/context.py`
- [Control plane](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/service.py): `backend/src/enterprise_agent_platform/control/service.py`
- [Follow-up](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/control/followup.py): `backend/src/enterprise_agent_platform/control/followup.py`
- [Approvals and effects](https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/control): `backend/src/enterprise_agent_platform/control`

### Execution and tools

- [Scheduler](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/scheduler_service.py): `backend/src/enterprise_agent_platform/execution/scheduler_service.py`
- [Kubernetes worker](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/k8s_worker.py): `backend/src/enterprise_agent_platform/execution/k8s_worker.py`
- [Attempt runtime](https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/execution): `backend/src/enterprise_agent_platform/execution`
- [Model session](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/execution/session.py): `backend/src/enterprise_agent_platform/execution/session.py`
- [Tool execution](https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/tools): `backend/src/enterprise_agent_platform/tools`

### Client surfaces

- [Artifact service](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/artifacts/service.py): `backend/src/enterprise_agent_platform/artifacts/service.py`
- [A2UI surfaces](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/ui/service.py): `backend/src/enterprise_agent_platform/ui/service.py`
- [Frontend client](https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-client/src/client.ts): `frontend/packages/agent-ui-client/src/client.ts`
- [UI protocol](https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-protocol/src/index.ts): `frontend/packages/agent-ui-protocol/src/index.ts`
- [UI catalog](https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-catalog/src/index.tsx): `frontend/packages/agent-ui-catalog/src/index.tsx`
- [React components](https://github.com/1110xx/agentforge/blob/main/frontend/packages/agent-ui-react/src/index.tsx): `frontend/packages/agent-ui-react/src/index.tsx`

### State and platform

- [Domain records](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/domain/records.py): `backend/src/enterprise_agent_platform/domain/records.py`
- [Platform store](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/persistence/protocol.py): `backend/src/enterprise_agent_platform/persistence/protocol.py`
- [SQL adapter](https://github.com/1110xx/agentforge/blob/main/backend/src/enterprise_agent_platform/persistence/sqlalchemy_store.py): `backend/src/enterprise_agent_platform/persistence/sqlalchemy_store.py`
- [Message and events](https://github.com/1110xx/agentforge/tree/main/backend/src/enterprise_agent_platform/platform): `backend/src/enterprise_agent_platform/platform`

### Other components

- **Host application**

## Connections

- Host application → FastAPI API: mounts routes
- FastAPI API → Contracts: serves contracts (evidence: `backend/src/enterprise_agent_platform/fastapi/router.py`)
- FastAPI API → Request context: uses request context (evidence: `backend/src/enterprise_agent_platform/fastapi/router.py`)
- Control plane → Platform store: persists state (evidence: `backend/src/enterprise_agent_platform/control/service.py`)
- Control plane → Domain records: updates records (evidence: `backend/src/enterprise_agent_platform/control/service.py`)
- Kubernetes worker → Scheduler: runs scheduler (evidence: `backend/src/enterprise_agent_platform/execution/k8s_worker.py`)
- Kubernetes worker → Control plane: reports attempt state (evidence: `backend/src/enterprise_agent_platform/execution/k8s_worker.py`)
- Kubernetes worker → SQL adapter: configures store (evidence: `backend/src/enterprise_agent_platform/execution/k8s_worker.py`)
- Artifact service → Platform store: reads and writes (evidence: `backend/src/enterprise_agent_platform/artifacts/service.py`)
- A2UI surfaces → Platform store: commits revisions (evidence: `backend/src/enterprise_agent_platform/ui/service.py`)
- A2UI surfaces → UI catalog: validates surfaces (evidence: `backend/src/enterprise_agent_platform/ui/service.py`)
- SQL adapter → Platform store: implements port (evidence: `backend/src/enterprise_agent_platform/persistence/protocol.py`)
- Frontend client → Frontend client: projects and streams (evidence: `frontend/packages/agent-ui-client/src/client.ts`)
- React components → Frontend client: uses SDK
- React components → UI protocol: renders protocol
- UI catalog → UI protocol: provides components
