# copilotkit/openintelligentui architecture

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

- Interactive diagram: https://gitdiagram.com/copilotkit/openintelligentui
- Repository: https://github.com/copilotkit/openintelligentui

## Overview

Open Intelligent UI is an interactive-answer chat application: a user asks or selects a starter prompt, the agent answers and chooses text, a structured table, or a sandboxed visualization, and the app streams the result into the conversation. The graph also preserves the documented demo, provider-key, mobile prompt-picking, trip-image, and MCP capabilities. Source evidence is partial; unsampled subsystems are included only where the README or tree supports their existence, and uncertain connections are omitted.

Main entry points: [`apps/agent/main.py`](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/main.py) (Deep agent graph), [`apps/app/src/components/chat`](https://github.com/copilotkit/openintelligentui/tree/main/apps/app/src/components/chat) (Chat interface), [`apps/mcp/src/server.ts`](https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/server.ts) (MCP server), [`apps/app/src/app/api/pick/route.ts`](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/app/api/pick/route.ts) (Mobile prompt pick)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat experience"]
  node_chat["Chat interface"]
  node_starter["Demo gallery<br/>[index.tsx]"]
  node_keyui["Provider key UI"]
  node_pick["Mobile prompt pick<br/>[route.ts]"]
end

subgraph group_agent["Agent runtime"]
  node_copilotroute["Agent API route<br/>[route.ts]"]
  node_agent["Deep agent graph<br/>[main.py]"]
  node_model["Chat model<br/>[model.py]"]
  node_vizroute["Visualization router"]
  node_skills["Agent skills<br/>[skill_backend.py]"]
  node_memory[("Conversation checkpoints")]
  node_sampledata["Sample data query<br/>[query.py]"]
  node_tripimages["Trip stop photos<br/>[trip_images.py]"]
  node_forms["Form generation<br/>[form.py]"]
  node_todos["Task list tools<br/>[todos.py]"]
end

subgraph group_render["Interactive rendering"]
  node_native["Native components<br/>[tool-rendering.tsx]"]
  node_sandbox["Sandboxed UI renderer<br/>[renderer.tsx]"]
  node_design["Design system<br/>[index.ts]"]
end

subgraph group_integration["Extensions"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_mcp_skills["MCP skill resources<br/>[skills.ts]"]
  node_mcp_renderer["MCP document assembly<br/>[renderer.ts]"]
end

node_visitor(("Chat user"))
node_llmprovider(("Model provider"))
node_jev(("Jev routing service"))
node_photos(("Photo source"))

node_visitor -->|"asks"| node_chat
node_starter -->|"starts prompt"| node_chat
node_chat -->|"sends turns"| node_copilotroute
node_keyui -.->|"supplies keys"| node_chat
node_chat -->|"polls prompts"| node_pick
node_pick -->|"returns prompt"| node_chat
node_copilotroute -->|"forwards stream"| node_agent
node_agent -->|"invokes"| node_model
node_model -->|"requests completion"| node_llmprovider
node_agent -->|"routes presentation"| node_vizroute
node_vizroute -->|"requests decision"| node_jev
node_agent -->|"loads skills"| node_skills
node_agent -->|"checkpoints state"| node_memory
node_agent -->|"calls tool"| node_sampledata
node_agent -->|"calls tool"| node_tripimages
node_tripimages -.->|"fetches photos"| node_photos
node_agent -->|"calls tool"| node_forms
node_agent -->|"uses tools"| node_todos
node_chat -.->|"renders components"| node_native
node_chat -.->|"renders generated UI"| node_sandbox
node_mcp -->|"loads resources"| node_mcp_skills
node_mcp -->|"assembles documents"| node_mcp_renderer
node_mcp_renderer -->|"embeds styles"| node_design

click node_chat "https://github.com/copilotkit/openintelligentui/tree/main/apps/app/src/components/chat"
click node_starter "https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/demo-gallery/index.tsx"
click node_keyui "https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/chat/provider-keys-dialog.tsx"
click node_pick "https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/app/api/pick/route.ts"
click node_copilotroute "https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/app/api/copilotkit/route.ts"
click node_agent "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/main.py"
click node_model "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/model.py"
click node_vizroute "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/visualization_router.py"
click node_skills "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/skill_backend.py"
click node_memory "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/bounded_memory_saver.py"
click node_sampledata "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/query.py"
click node_tripimages "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/trip_images.py"
click node_forms "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/form.py"
click node_todos "https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/todos.py"
click node_native "https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/tool-rendering.tsx"
click node_sandbox "https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/generative-ui/open-generative-ui/renderer.tsx"
click node_design "https://github.com/copilotkit/openintelligentui/blob/main/packages/design-system/src/index.ts"
click node_mcp "https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/server.ts"
click node_mcp_skills "https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/skills.ts"
click node_mcp_renderer "https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/renderer.ts"

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_chat,node_starter,node_keyui,node_pick,node_visitor toneBlue
class node_copilotroute,node_agent,node_model,node_vizroute,node_skills,node_memory,node_sampledata,node_tripimages,node_forms,node_todos toneAmber
class node_native,node_sandbox,node_design toneMint
class node_mcp,node_mcp_skills,node_mcp_renderer toneRose
class node_llmprovider,node_jev,node_photos toneIndigo
```

## Components

### Chat experience

- [Chat interface](https://github.com/copilotkit/openintelligentui/tree/main/apps/app/src/components/chat): `apps/app/src/components/chat`
- [Demo gallery](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/demo-gallery/index.tsx): `apps/app/src/components/demo-gallery/index.tsx`
- [Provider key UI](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/chat/provider-keys-dialog.tsx): `apps/app/src/components/chat/provider-keys-dialog.tsx`
- [Mobile prompt pick](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/app/api/pick/route.ts): `apps/app/src/app/api/pick/route.ts`

### Agent runtime

- [Agent API route](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/app/api/copilotkit/route.ts): `apps/app/src/app/api/copilotkit/route.ts`
- [Deep agent graph](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/main.py): `apps/agent/main.py`
- [Chat model](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/model.py): `apps/agent/src/model.py`
- [Visualization router](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/visualization_router.py): `apps/agent/src/visualization_router.py`
- [Agent skills](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/skill_backend.py): `apps/agent/src/skill_backend.py`
- [Conversation checkpoints](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/bounded_memory_saver.py): `apps/agent/src/bounded_memory_saver.py`
- [Sample data query](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/query.py): `apps/agent/src/query.py`
- [Trip stop photos](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/trip_images.py): `apps/agent/src/trip_images.py`
- [Form generation](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/form.py): `apps/agent/src/form.py`
- [Task list tools](https://github.com/copilotkit/openintelligentui/blob/main/apps/agent/src/todos.py): `apps/agent/src/todos.py`

### Interactive rendering

- [Native components](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/tool-rendering.tsx): `apps/app/src/components/tool-rendering.tsx`
- [Sandboxed UI renderer](https://github.com/copilotkit/openintelligentui/blob/main/apps/app/src/components/generative-ui/open-generative-ui/renderer.tsx): `apps/app/src/components/generative-ui/open-generative-ui/renderer.tsx`
- [Design system](https://github.com/copilotkit/openintelligentui/blob/main/packages/design-system/src/index.ts): `packages/design-system/src/index.ts`

### Extensions

- [MCP server](https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/server.ts): `apps/mcp/src/server.ts`
- [MCP skill resources](https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/skills.ts): `apps/mcp/src/skills.ts`
- [MCP document assembly](https://github.com/copilotkit/openintelligentui/blob/main/apps/mcp/src/renderer.ts): `apps/mcp/src/renderer.ts`

### Other components

- **Chat user**
- **Model provider**
- **Jev routing service**
- **Photo source**

## Connections

- Chat user → Chat interface: asks (evidence: `README.md`)
- Demo gallery → Chat interface: starts prompt (evidence: `README.md`)
- Chat interface → Agent API route: sends turns (evidence: `README.md`)
- Provider key UI → Chat interface: supplies keys (evidence: `README.md`)
- Chat interface → Mobile prompt pick: polls prompts (evidence: `apps/app/src/app/api/pick/route.ts`)
- Mobile prompt pick → Chat interface: returns prompt (evidence: `apps/app/src/app/api/pick/route.ts`)
- Agent API route → Deep agent graph: forwards stream (evidence: `README.md`)
- Deep agent graph → Chat model: invokes (evidence: `apps/agent/main.py`)
- Chat model → Model provider: requests completion (evidence: `apps/agent/src/model.py`)
- Deep agent graph → Visualization router: routes presentation (evidence: `apps/agent/main.py`)
- Visualization router → Jev routing service: requests decision (evidence: `apps/agent/src/visualization_router.py`)
- Deep agent graph → Agent skills: loads skills (evidence: `apps/agent/main.py`)
- Deep agent graph → Conversation checkpoints: checkpoints state (evidence: `apps/agent/main.py`)
- Deep agent graph → Sample data query: calls tool (evidence: `apps/agent/main.py`)
- Deep agent graph → Trip stop photos: calls tool (evidence: `apps/agent/main.py`)
- Trip stop photos → Photo source: fetches photos (evidence: `README.md`)
- Deep agent graph → Form generation: calls tool (evidence: `apps/agent/main.py`)
- Deep agent graph → Task list tools: uses tools (evidence: `apps/agent/main.py`)
- Chat interface → Native components: renders components (evidence: `README.md`)
- Chat interface → Sandboxed UI renderer: renders generated UI (evidence: `README.md`)
- MCP server → MCP skill resources: loads resources (evidence: `apps/mcp/src/server.ts`)
- MCP server → MCP document assembly: assembles documents (evidence: `apps/mcp/src/server.ts`)
- MCP document assembly → Design system: embeds styles (evidence: `apps/mcp/src/renderer.ts`)
