# offloadmemory/agentfork architecture

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

- Interactive diagram: https://gitdiagram.com/offloadmemory/agentfork
- Repository: https://github.com/offloadmemory/agentfork

## Overview

AgentFork is a multi-tenant platform for authoring, evaluating, and delivering AI agents. Teams configure agents and workflows, connect models and knowledge sources, validate behavior in a playground or evaluation suite, then publish versioned agents for inference through APIs and chat channels. Knowledge ingestion and retrieval, analytics, and access controls support this lifecycle. The tree and README establish several capabilities; sampled source confirms selected runtime paths, not every UI-to-API connection or subsystem implementation.

Main entry points: [`apps/web-ui/app/api/v1/inference/route.ts`](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/v1/inference/route.ts) (Inference API), [`apps/web-ui/app/api/knowledge-bases/route.ts`](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/knowledge-bases/route.ts) (Knowledge base API), [`libs/shared/src/services/llm-provider-service.ts`](https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/llm-provider-service.ts) (LLM provider management), [`apps/web-ui/app/api/agents/route.ts`](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/agents/route.ts) (Agent management API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_author["Agent authoring"]
  node_agent_ui["Agent studio<br/>[page.tsx]"]
  node_agent_api["Agent management API<br/>[route.ts]"]
  node_workflow_engine["Workflow engine<br/>[workflow-engine.ts]"]
  node_playground["Agent playground<br/>[page.tsx]"]
end

subgraph group_knowledge["Knowledge and retrieval"]
  node_kb_ui["Knowledge base workspace<br/>[page.tsx]"]
  node_kb_api["Knowledge base API<br/>[route.ts]"]
  node_crawler["Web crawler<br/>[crawlee-engine.ts]"]
end

subgraph group_delivery["Inference and delivery"]
  node_inference_api["Inference API<br/>[route.ts]"]
  node_sessions["Inference sessions"]
  node_widget["Embeddable widget"]
  node_widget_api["Widget API client<br/>[api.service.ts]"]
  node_channels["Channel management<br/>[page.tsx]"]
end

subgraph group_observe["Evaluation and operations"]
  node_evaluation["Evaluation suite<br/>[page.tsx]"]
  node_analytics["Analytics dashboards<br/>[page.tsx]"]
  node_dashboard_queries["Dashboard query service"]
  node_mission_control["Agent operations console<br/>[page.tsx]"]
end

subgraph group_platform["Platform services"]
  node_llm_config["LLM provider management"]
  node_mcp["MCP server management<br/>[page.tsx]"]
  node_database[("Platform database")]
end

node_team(("Platform team"))
node_model_provider{{"LLM providers"}}
node_end_user(("Agent end user"))
node_external_tools{{"External tools"}}

node_team -->|"designs agents"| node_agent_ui
node_agent_ui -->|"manages agents"| node_agent_api
node_team -->|"configures sources"| node_kb_ui
node_kb_ui -->|"manages knowledge"| node_kb_api
node_kb_api -.->|"starts crawls"| node_crawler
node_team -->|"tests agents"| node_playground
node_playground -->|"tests configuration"| node_agent_api
node_team -->|"evaluates behavior"| node_evaluation
node_team -->|"configures models"| node_llm_config
node_llm_config -->|"stores provider records"| node_database
node_llm_config -->|"discovers models"| node_model_provider
node_agent_api -->|"stores agent data"| node_database
node_kb_api -->|"stores knowledge data"| node_database
node_inference_api -->|"manages sessions"| node_sessions
node_sessions -->|"persists session state"| node_database
node_end_user -->|"chats through"| node_widget
node_widget -->|"sends messages"| node_widget_api
node_widget_api -->|"requests inference"| node_inference_api
node_end_user -->|"calls REST inference"| node_inference_api
node_inference_api -->|"generates responses"| node_model_provider
node_inference_api -->|"resolves workflow turns"| node_workflow_engine
node_inference_api -.->|"loads tool configuration"| node_mcp
node_inference_api -.->|"invokes tools"| node_external_tools
node_team -->|"configures delivery"| node_channels
node_team -->|"reviews insights"| node_analytics
node_analytics -->|"queries metrics"| node_dashboard_queries
node_dashboard_queries -->|"reads tenant data"| node_database
node_team -->|"operates agent runtime"| node_mission_control

click node_agent_ui "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/agents/page.tsx"
click node_agent_api "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/agents/route.ts"
click node_workflow_engine "https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/workflow/workflow-engine.ts"
click node_playground "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/agents/playground/page.tsx"
click node_kb_ui "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/knowledge-bases/page.tsx"
click node_kb_api "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/knowledge-bases/route.ts"
click node_crawler "https://github.com/offloadmemory/agentfork/blob/main/libs/knowledge-base/src/web-crawler/crawlee-engine.ts"
click node_inference_api "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/v1/inference/route.ts"
click node_sessions "https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/inference-session-service.ts"
click node_widget "https://github.com/offloadmemory/agentfork/blob/main/apps/sdk/src/components/smc-chat-widget/smc-chat-widget.tsx"
click node_widget_api "https://github.com/offloadmemory/agentfork/blob/main/apps/sdk/src/services/api.service.ts"
click node_channels "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/connectors/page.tsx"
click node_evaluation "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/evaluation/experiments/page.tsx"
click node_analytics "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/analytics/page.tsx"
click node_dashboard_queries "https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/dashboard-query-service.ts"
click node_mission_control "https://github.com/offloadmemory/agentfork/blob/main/apps/mission-control/app/(console)/dashboard/page.tsx"
click node_llm_config "https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/llm-provider-service.ts"
click node_mcp "https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/mcp-servers/page.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_agent_ui,node_agent_api,node_workflow_engine,node_playground,node_end_user toneBlue
class node_kb_ui,node_kb_api,node_crawler toneAmber
class node_inference_api,node_sessions,node_widget,node_widget_api,node_channels toneMint
class node_evaluation,node_analytics,node_dashboard_queries,node_mission_control toneRose
class node_llm_config,node_mcp,node_database,node_team,node_model_provider,node_external_tools toneIndigo
```

## Components

### Agent authoring

- [Agent studio](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/agents/page.tsx): `apps/web-ui/app/(dashboard)/agents/page.tsx`
- [Agent management API](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/agents/route.ts): `apps/web-ui/app/api/agents/route.ts`
- [Workflow engine](https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/workflow/workflow-engine.ts): `libs/shared/src/workflow/workflow-engine.ts`
- [Agent playground](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/agents/playground/page.tsx): `apps/web-ui/app/(dashboard)/agents/playground/page.tsx`

### Knowledge and retrieval

- [Knowledge base workspace](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/knowledge-bases/page.tsx): `apps/web-ui/app/(dashboard)/knowledge-bases/page.tsx`
- [Knowledge base API](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/knowledge-bases/route.ts): `apps/web-ui/app/api/knowledge-bases/route.ts`
- [Web crawler](https://github.com/offloadmemory/agentfork/blob/main/libs/knowledge-base/src/web-crawler/crawlee-engine.ts): `libs/knowledge-base/src/web-crawler/crawlee-engine.ts`

### Inference and delivery

- [Inference API](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/api/v1/inference/route.ts): `apps/web-ui/app/api/v1/inference/route.ts`
- [Inference sessions](https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/inference-session-service.ts): `libs/shared/src/services/inference-session-service.ts`
- [Embeddable widget](https://github.com/offloadmemory/agentfork/blob/main/apps/sdk/src/components/smc-chat-widget/smc-chat-widget.tsx): `apps/sdk/src/components/smc-chat-widget/smc-chat-widget.tsx`
- [Widget API client](https://github.com/offloadmemory/agentfork/blob/main/apps/sdk/src/services/api.service.ts): `apps/sdk/src/services/api.service.ts`
- [Channel management](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/connectors/page.tsx): `apps/web-ui/app/(dashboard)/connectors/page.tsx`

### Evaluation and operations

- [Evaluation suite](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/evaluation/experiments/page.tsx): `apps/web-ui/app/(dashboard)/evaluation/experiments/page.tsx`
- [Analytics dashboards](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/analytics/page.tsx): `apps/web-ui/app/(dashboard)/analytics/page.tsx`
- [Dashboard query service](https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/dashboard-query-service.ts): `libs/shared/src/services/dashboard-query-service.ts`
- [Agent operations console](https://github.com/offloadmemory/agentfork/blob/main/apps/mission-control/app/(console)/dashboard/page.tsx): `apps/mission-control/app/(console)/dashboard/page.tsx`

### Platform services

- [LLM provider management](https://github.com/offloadmemory/agentfork/blob/main/libs/shared/src/services/llm-provider-service.ts): `libs/shared/src/services/llm-provider-service.ts`
- [MCP server management](https://github.com/offloadmemory/agentfork/blob/main/apps/web-ui/app/(dashboard)/mcp-servers/page.tsx): `apps/web-ui/app/(dashboard)/mcp-servers/page.tsx`
- **Platform database**

### Other components

- **Platform team**
- **LLM providers**
- **Agent end user**
- **External tools**

## Connections

- Platform team → Agent studio: designs agents
- Agent studio → Agent management API: manages agents
- Platform team → Knowledge base workspace: configures sources
- Knowledge base workspace → Knowledge base API: manages knowledge
- Knowledge base API → Web crawler: starts crawls
- Platform team → Agent playground: tests agents
- Agent playground → Agent management API: tests configuration
- Platform team → Evaluation suite: evaluates behavior
- Platform team → LLM provider management: configures models
- LLM provider management → Platform database: stores provider records
- LLM provider management → LLM providers: discovers models
- Agent management API → Platform database: stores agent data
- Knowledge base API → Platform database: stores knowledge data
- Inference API → Inference sessions: manages sessions
- Inference sessions → Platform database: persists session state
- Agent end user → Embeddable widget: chats through
- Embeddable widget → Widget API client: sends messages
- Widget API client → Inference API: requests inference
- Agent end user → Inference API: calls REST inference
- Inference API → LLM providers: generates responses
- Inference API → Workflow engine: resolves workflow turns
- Inference API → MCP server management: loads tool configuration
- Inference API → External tools: invokes tools
- Platform team → Channel management: configures delivery
- Platform team → Analytics dashboards: reviews insights
- Analytics dashboards → Dashboard query service: queries metrics
- Dashboard query service → Platform database: reads tenant data
- Platform team → Agent operations console: operates agent runtime
