# yanzhao77/pavo-ai-agent architecture

> Architecture diagram of the GitHub repository yanzhao77/pavo-ai-agent, 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/yanzhao77/pavo-ai-agent
- Repository: https://github.com/yanzhao77/pavo-ai-agent

## Overview

Pavo turns a natural-language story into a production-ready storyboard through a seven-agent workflow, with project editing, video rendering, export, and a web UI or MCP clients as entry points. The graph preserves the documented memory, RAG, and MCP capabilities; several are represented at their exact subsystem directory because their implementations were not excerpted. Edges are limited to README statements and source references shown in the index or excerpts; unverified RAG wiring is marked dashed.

Main entry points: [`backend/app/services/project_service.py`](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/project_service.py) (Project orchestration), [`backend/app/api/routes.py`](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/api/routes.py) (HTTP API), [`backend/mcp_server/main.py`](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/main.py) (MCP server), [`backend/app/agents/planner.py`](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/planner.py) (Story planner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interfaces"]
  node_web["Web studio<br/>[page.tsx]"]
end

subgraph group_api["Service entry points"]
  node_fastapi["HTTP API<br/>[routes.py]"]
  node_mcp["MCP server<br/>[main.py]"]
  node_adapter["Project adapter<br/>[project_adapter.py]"]
end

subgraph group_creation["Storyboard workflow"]
  node_projectservice["Project orchestration<br/>[project_service.py]"]
  node_planner["Story planner<br/>[planner.py]"]
  node_character["Character design<br/>[character_agent.py]"]
  node_scene["Scene design<br/>[scene_agent.py]"]
  node_props["Prop design<br/>[prop_agent.py]"]
  node_storyboard["Shot storyboard"]
  node_review["Quality review<br/>[reviewer.py]"]
  node_fixer["Storyboard repair<br/>[fixer.py]"]
  node_llm["AI model gateway<br/>[agnes_client.py]"]
end

subgraph group_state["Project and media state"]
  node_projectmodel["Project records<br/>[project.py]"]
  node_database[("SQLite database<br/>[database.py]")]
  node_storage[("Local media storage<br/>[storage.py]")]
  node_video["Video generation<br/>[video_tasks.py]"]
  node_exports["Project export"]
end

subgraph group_intelligence["Memory and knowledge"]
  node_memory[("Personal memory<br/>[store.py]")]
  node_embedding["Embedding client"]
  node_middleware["Memory middleware"]
  node_rag["Knowledge retrieval"]
end

node_author(("Story creator"))
node_mcpclient(("MCP client"))

node_author -.->|"creates story"| node_web
node_web -.->|"sends requests"| node_fastapi
node_mcpclient -->|"invokes tools"| node_mcp
node_fastapi -->|"starts workflow"| node_projectservice
node_mcp -->|"dispatches projects"| node_adapter
node_adapter -->|"delegates workflow"| node_projectservice
node_projectservice -->|"runs pipeline"| node_planner
node_projectservice -->|"runs pipeline"| node_character
node_projectservice -->|"runs pipeline"| node_scene
node_projectservice -->|"runs pipeline"| node_props
node_projectservice -->|"runs pipeline"| node_storyboard
node_projectservice -->|"runs pipeline"| node_review
node_projectservice -->|"runs pipeline"| node_fixer
node_planner -->|"precedes"| node_character
node_character -->|"precedes"| node_scene
node_scene -->|"precedes"| node_props
node_props -->|"precedes"| node_storyboard
node_storyboard -->|"precedes"| node_review
node_review -->|"may trigger"| node_fixer
node_planner -->|"requests completion"| node_llm
node_projectservice -->|"creates and updates"| node_projectmodel
node_fastapi -->|"reads and edits"| node_projectmodel
node_projectmodel -->|"persists records"| node_database
node_projectservice -->|"renders shots"| node_video
node_projectservice -->|"stores rendered media"| node_storage
node_fastapi -->|"exports project"| node_exports
node_mcp -->|"dispatches memory tools"| node_memory
node_mcp -->|"augments tool calls"| node_middleware
node_middleware -->|"reads and writes"| node_memory
node_memory -->|"vectorizes content"| node_embedding
node_planner -.->|"uses preferences"| node_memory
node_storyboard -.->|"uses film knowledge"| node_rag
node_rag -.->|"retrieves vectors"| node_embedding

click node_web "https://github.com/yanzhao77/pavo-ai-agent/blob/master/frontend/src/app/studio/page.tsx"
click node_fastapi "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/api/routes.py"
click node_mcp "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/main.py"
click node_adapter "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/adapter/project_adapter.py"
click node_projectservice "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/project_service.py"
click node_planner "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/planner.py"
click node_character "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/character_agent.py"
click node_scene "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/scene_agent.py"
click node_props "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/prop_agent.py"
click node_storyboard "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/storyboard_agent.py"
click node_review "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/reviewer.py"
click node_fixer "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/fixer.py"
click node_llm "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/agnes_client.py"
click node_projectmodel "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/models/project.py"
click node_database "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/db/database.py"
click node_storage "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/storage.py"
click node_video "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/video_tasks.py"
click node_exports "https://github.com/yanzhao77/pavo-ai-agent/tree/master/backend/app/services/export"
click node_memory "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/memory/store.py"
click node_embedding "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/memory/embedding_client.py"
click node_middleware "https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/middleware/memory_middleware.py"
click node_rag "https://github.com/yanzhao77/pavo-ai-agent/tree/master/backend/mcp_server/rag"

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_web,node_mcpclient toneBlue
class node_fastapi,node_mcp,node_adapter toneAmber
class node_projectservice,node_planner,node_character,node_scene,node_props,node_storyboard,node_review,node_fixer,node_llm toneMint
class node_projectmodel,node_database,node_storage,node_video,node_exports toneRose
class node_memory,node_embedding,node_middleware,node_rag,node_author toneIndigo
```

## Components

### User interfaces

- [Web studio](https://github.com/yanzhao77/pavo-ai-agent/blob/master/frontend/src/app/studio/page.tsx): `frontend/src/app/studio/page.tsx`

### Service entry points

- [HTTP API](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/api/routes.py): `backend/app/api/routes.py`
- [MCP server](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/main.py): `backend/mcp_server/main.py`
- [Project adapter](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/adapter/project_adapter.py): `backend/mcp_server/adapter/project_adapter.py`

### Storyboard workflow

- [Project orchestration](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/project_service.py): `backend/app/services/project_service.py`
- [Story planner](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/planner.py): `backend/app/agents/planner.py`
- [Character design](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/character_agent.py): `backend/app/agents/character_agent.py`
- [Scene design](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/scene_agent.py): `backend/app/agents/scene_agent.py`
- [Prop design](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/prop_agent.py): `backend/app/agents/prop_agent.py`
- [Shot storyboard](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/storyboard_agent.py): `backend/app/agents/storyboard_agent.py`
- [Quality review](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/reviewer.py): `backend/app/agents/reviewer.py`
- [Storyboard repair](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/agents/fixer.py): `backend/app/agents/fixer.py`
- [AI model gateway](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/agnes_client.py): `backend/app/services/agnes_client.py`

### Project and media state

- [Project records](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/models/project.py): `backend/app/models/project.py`
- [SQLite database](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/db/database.py): `backend/app/db/database.py`
- [Local media storage](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/storage.py): `backend/app/services/storage.py`
- [Video generation](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/app/services/video_tasks.py): `backend/app/services/video_tasks.py`
- [Project export](https://github.com/yanzhao77/pavo-ai-agent/tree/master/backend/app/services/export): `backend/app/services/export`

### Memory and knowledge

- [Personal memory](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/memory/store.py): `backend/mcp_server/memory/store.py`
- [Embedding client](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/memory/embedding_client.py): `backend/mcp_server/memory/embedding_client.py`
- [Memory middleware](https://github.com/yanzhao77/pavo-ai-agent/blob/master/backend/mcp_server/middleware/memory_middleware.py): `backend/mcp_server/middleware/memory_middleware.py`
- [Knowledge retrieval](https://github.com/yanzhao77/pavo-ai-agent/tree/master/backend/mcp_server/rag): `backend/mcp_server/rag`

### Other components

- **Story creator**
- **MCP client**

## Connections

- Story creator → Web studio: creates story (evidence: `README.md`)
- Web studio → HTTP API: sends requests (evidence: `README.md`)
- MCP client → MCP server: invokes tools (evidence: `README.md`)
- HTTP API → Project orchestration: starts workflow (evidence: `backend/app/api/routes.py`)
- MCP server → Project adapter: dispatches projects (evidence: `backend/mcp_server/main.py`)
- Project adapter → Project orchestration: delegates workflow (evidence: `backend/mcp_server/adapter/project_adapter.py`)
- Project orchestration → Story planner: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Project orchestration → Character design: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Project orchestration → Scene design: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Project orchestration → Prop design: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Project orchestration → Shot storyboard: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Project orchestration → Quality review: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Project orchestration → Storyboard repair: runs pipeline (evidence: `backend/app/services/project_service.py`)
- Story planner → Character design: precedes (evidence: `README.md`)
- Character design → Scene design: precedes (evidence: `README.md`)
- Scene design → Prop design: precedes (evidence: `README.md`)
- Prop design → Shot storyboard: precedes (evidence: `README.md`)
- Shot storyboard → Quality review: precedes (evidence: `README.md`)
- Quality review → Storyboard repair: may trigger (evidence: `README.md`)
- Story planner → AI model gateway: requests completion
- Project orchestration → Project records: creates and updates (evidence: `backend/app/services/project_service.py`)
- HTTP API → Project records: reads and edits (evidence: `backend/app/api/routes.py`)
- Project records → SQLite database: persists records (evidence: `backend/app/models/project.py`)
- Project orchestration → Video generation: renders shots (evidence: `README.md`)
- Project orchestration → Local media storage: stores rendered media (evidence: `backend/app/services/project_service.py`)
- HTTP API → Project export: exports project (evidence: `backend/app/api/routes.py`)
- MCP server → Personal memory: dispatches memory tools (evidence: `backend/mcp_server/main.py`)
- MCP server → Memory middleware: augments tool calls (evidence: `backend/mcp_server/main.py`)
- Memory middleware → Personal memory: reads and writes (evidence: `backend/mcp_server/middleware/memory_middleware.py`)
- Personal memory → Embedding client: vectorizes content (evidence: `backend/mcp_server/memory/store.py`)
- Story planner → Personal memory: uses preferences (evidence: `README.md`)
- Shot storyboard → Knowledge retrieval: uses film knowledge (evidence: `README.md`)
- Knowledge retrieval → Embedding client: retrieves vectors (evidence: `backend/mcp_server/rag/retriever.py`)
