# langchain-ai/open-agent-platform architecture

> Architecture diagram of the GitHub repository langchain-ai/open-agent-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langchain-ai/open-agent-platform
- Repository: https://github.com/langchain-ai/open-agent-platform

## Overview

##### Project type and purpose
- This is a TurboRepo monorepo containing two Next.js apps:
- apps/docs – a documentation site built in MDX/Next.js
- apps/web  – the main Open Agent Platform (OAP) web application
- Purpose: a no-code, web-based platform for building, configuring, and interacting with LangGraph agents, with RAG integration, external tool connectivity (via MCP), agent supervision, and authentication.

##### Main system components
a. Presentation layer (apps/web/src/app & components):
– Next.js 13 React front-end using the App Router
– UI component library (apps/web/src/components/ui)
– Feature modules (agents, chat, rag, tools, auth, inbox)
b. API layer (apps/web/src/app/api):
– /api/auth            – Supabase auth callback and session management
– /api/langgraph       – Proxy for LangGraph GraphQL API
– /api/oap_mcp         – Proxy to your MCP (external tool) servers
c. State & context providers (apps/web/src/providers):
– Auth, Agents, MCP contexts to supply data to the React tree
d. Data & services
– Supabase (authentication, user data)
– LangGraph Platform (agent definitions & deployments)
– LangConnect RAG server (separate RAG service)
– External MCP tool servers
e. Documentation site (apps/docs):
– MDX pages, custom agent guides, quickstart, setup instructions
f. CI/CD & build orchestration
– TurboRepo (turbo.json) building both apps
– GitHub Actions (ci.yml) running lint/tests

##### Relationships & data flows
- User’s browser → Next.js front-end (SSR/CSR components)
- Front-end calls Next.js API routes → these routes call external services
- Auth flows: front-end ↔ Supabase
- Agent management: API routes ↔ LangGraph API
- RAG features: API routes ↔ LangConnect server
- Tool execution: API routes ↔ MCP servers
- Documentation site is independently served (no backend calls beyond static content)

##### Architectural patterns & design principles
- Monorepo modularization via TurboRepo
- Full-stack Next.js (App Router + API routes = frontend + backend)
- React Context Providers for global state
- Proxy pattern for external service integration
- Config-driven UI (reads LangGraph’s x_oap_ui_config metadata)
- Separation of concerns: feature-based folders, shared UI library

##### Detail
- Call out the provider/context layer under the UI
- API routes by function
- That docs site is an isolated static deployment

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "Client (Browser)"
    Browser("User Browser"):::external
  end

  subgraph "Presentation Layer"
    subgraph "Next.js App Router"
      AppRouter("App Router"):::ui
    end
    UILib("UI Component Library"):::ui
    subgraph "Feature Modules"
      AgentsUI("Agents Module"):::ui
      ChatUI("Chat Module"):::ui
      RAGUI("RAG Module"):::ui
      ToolsUI("Tools Module"):::ui
      InboxUI("Inbox Module"):::ui
      AuthUI("Auth Module"):::ui
    end
  end

  subgraph "State & Context Providers"
    AuthProv("AuthContext"):::service
    AgentsProv("AgentsContext"):::service
    MCPPov("MCPContext"):::service
  end

  subgraph "API Layer"
    APIL1("Auth Proxy"):::api
    APIL2("LangGraph Proxy Defaults"):::api
    APIL3("LangGraph Proxy Pass-Through"):::api
    APIL4("MCP Proxy"):::api
  end

  subgraph "Data & External Services"
    Supabase("Supabase Auth & DB"):::db
    LangGraph("LangGraph GraphQL API"):::external
    LangConnect("LangConnect RAG Server"):::external
    MCPServers("MCP Tool Servers"):::external
    Docs("Documentation Site"):::docs
  end

  Browser --> AppRouter
  AppRouter --> UILib
  AppRouter --> AgentsUI
  AppRouter --> ChatUI
  AppRouter --> RAGUI
  AppRouter --> ToolsUI
  AppRouter --> InboxUI
  AppRouter --> AuthUI

  AgentsUI --> AgentsProv
  RAGUI --> MCPPov
  AuthUI --> AuthProv
  AgentsUI --> AgentsProv
  ToolsUI --> MCPPov

  AuthUI --> APIL1
  AgentsUI --> APIL2
  AgentsUI --> APIL3
  RAGUI --> APIL4
  ToolsUI --> APIL4
  InboxUI --> APIL3

  APIL1 --> Supabase
  APIL2 --> LangGraph
  APIL3 --> LangGraph
  APIL4 --> MCPServers
  APIL4 --> LangConnect
  Supabase --> AuthUI

  Browser --> Docs

  click Docs "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/docs"
  click AppRouter "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/app/(app)"
  click AuthUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/app/(auth)"
  click UILib "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/components/ui"
  click AgentsUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/features/agents"
  click ChatUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/features/chat"
  click RAGUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/features/rag"
  click ToolsUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/features/tools"
  click InboxUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/app/(app)/inbox"
  click InboxUI "https://github.com/langchain-ai/open-agent-platform/tree/main/apps/web/src/components/agent-inbox"
  click APIL1 "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/app/api/auth/callback/route.ts"
  click APIL2 "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/app/api/langgraph/defaults/route.ts"
  click APIL3 "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/app/api/langgraph/proxy/[..._path]/route.ts"
  click APIL4 "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/app/api/oap_mcp/route.ts"
  click AuthProv "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/providers/Auth.tsx"
  click AgentsProv "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/providers/Agents.tsx"
  click MCPPov "https://github.com/langchain-ai/open-agent-platform/blob/main/apps/web/src/providers/MCP.tsx"

  classDef ui fill:#cce5ff,stroke:#004085
  classDef api fill:#d4edda,stroke:#155724
  classDef service fill:#fff3cd,stroke:#856404
  classDef db fill:#e2e3e5,stroke:#6c757d
  classDef external fill:#f8d7da,stroke:#721c24
  classDef docs fill:#f0f0f0,stroke:#6c757d
```
