How yazeedmshayekh2/lms works
1. Overall shape
- This repository is a Python-based AI application with a clear split between a backend service, an agent-orchestration layer, and a separate frontend bundle.
- The core architecture is centered on LLM-driven agent graphs rather than a traditional CRUD domain model.
2. Runtime and entrypoints
- main.py and src/app.py are the top-level application entrypoints.
- src/api/server.py is the backend API server boundary.
- run.sh and docker/docker-compose.yml indicate the system is designed to run as coordinated services in containers.
3. API layer
- src/api/server.py is the external interface for callers.
- This layer likely receives requests, validates inputs, and delegates work into the agent subsystem rather than implementing business logic itself.
- The API is the main boundary between the outside world and the internal graph-based workflows.
4. Agent orchestration core
- src/agents/graph.py and src/agents/state.py define the primary execution model for the application.
- src/agents/common/supervisor/* contains the orchestration logic that routes work between nodes and tools.
- The presence of nodes.py, edges.py, enums.py, prompts.py, and graph.py suggests a graph/state-machine style agent pipeline with explicit transitions and prompt templates.
5. Supervisor pattern
- The supervisor package is the coordination layer that likely decides which sub-agent or tool should handle the current task.
- This is a key architectural boundary: the supervisor manages control flow, while specialized tool graphs do the actual task execution.
- checkpointer.py suggests the supervisor workflow can persist or resume execution state across steps.
6. Specialized tool workflows
- Under src/agents/common/tools/, there are three task-specific subsystems:
- assignment_maker
- quiz_generator
- summarizer
- Each tool has its own graph.py, nodes.py, and prompts.py, which implies each is a self-contained agent workflow with its own internal processing steps.
- These tools are likely invoked by the supervisor depending on the user request or application context.
7. LLM abstraction layer
- src/ai/llms/config.py, enums.py, and factory.py form a provider/model abstraction.
- This layer isolates the rest of the app from a specific LLM vendor or model choice.
- The orchestration code depends on this layer to create model instances consistently.
8. Data flow through the system
- A request enters through the API server.
- The request is translated into application state in src/agents/state.py.
- The supervisor graph evaluates that state, selects a route, and hands off to one of the specialized tool graphs.
- Tool graphs use prompts and LLM calls to produce outputs, then return results back through the supervisor to the API response path.
9. Prompt-driven behavior
- Prompts are first-class artifacts in this repo, stored separately for the supervisor and each tool.
- This means behavior is configured as much through prompt templates as through code.
- For architecture diagrams, prompts should be shown as inputs to the agent nodes rather than as a separate runtime service.
10. Frontend boundary
- The frontend/ directory is packaged separately with its own Dockerfile.
- This suggests a distinct presentation layer that consumes the backend API, rather than being embedded in the Python service.
- The frontend is not where agent logic lives; it is a client of the backend.
11. Containerization and deployment
- There are Dockerfiles for both src/ and frontend/, plus a Compose file under docker/.
- The repo is structured for multi-container deployment, likely with at least one backend container and one frontend container.
- .env.example indicates runtime configuration is environment-driven, especially for model credentials or service settings.
12. Documentation signals
- docs/architecture.md, docs/api.md, and docs/agents.md indicate the repo has already been conceptualized around architecture, API boundaries, and agent behavior.
- For diagramming, the most important structural elements are:
- external client
- frontend
- API server
- supervisor agent graph
- specialized tool graphs
- LLM factory/provider layer
- checkpoint/state persistence boundary
13. What is most important to draw
- The central diagram should emphasize the orchestration flow: API → supervisor graph → tool graph → LLM → result.
- The frontend should be shown as a separate consumer of the API.
- Checkpointing/state should be shown as cross-cutting support inside the agent runtime, not as a standalone business subsystem.
Main entry points: supervisor/graph.py Supervisor · factory.py LLM Factory · tools.py Tools Facade · agents/graph.py Agent Graph
Components 18
Presentation
Frontend client and app entrypoints
Backend API
HTTP boundary and application bootstrap
- App · Application bootstrap and wiring
src/app.py - API Server · External API boundary for requests into the system
src/api/server.py
Agent Runtime
Graph-based orchestration and task workflows
- Agent Graph · Top-level agent workflow coordinator
src/agents/graph.py - Agent State · Shared state passed through agent workflows
src/agents/state.py - Supervisor · Routes tasks between specialized agent tools
src/agents/common/supervisor/graph.py - Sup Nodes · Supervisor step implementations
src/agents/common/supervisor/nodes.py - Sup Edges · Supervisor routing transitions
src/agents/common/supervisor/edges.py - Sup Prompts · Supervisor prompt templates
src/agents/common/supervisor/prompts.py - Checkpoint · Persisted execution state for resuming workflows
src/agents/common/checkpointer.py - Assign Tool · Assignment-making workflow
src/agents/common/tools/assignment_maker/graph.py - Quiz Tool · Quiz-generation workflow
src/agents/common/tools/quiz_generator/graph.py - Summary Tool · Summarization workflow
src/agents/common/tools/summarizer/graph.py - Tools Facade · Shared tool dispatch and organization layer
src/agents/common/tools.py
LLM Layer
Model provider abstraction
- LLM Factory · Builds configured model clients
src/ai/llms/factory.py - LLM Config · Model and provider configuration
src/ai/llms/config.py - LLM Enums · Supported providers and model choices
src/ai/llms/enums.py
Connections 19
- Frontend → API Server: calls · Frontend consumes backend endpoints
- Main → App: starts · Primary process boots the app
- App → API Server: wires · Application bootstrap creates the API boundary
- API Server → Agent Graph: delegates · Requests are handed into agent workflows
- Agent Graph → Agent State: uses · Workflow execution is driven by shared state
- Agent Graph → Supervisor: routes · Top-level agent graph hands control to the supervisor
- Supervisor → Sup Nodes: executes · Supervisor runs its step nodes
- Supervisor → Sup Edges: transitions · Supervisor uses explicit routing edges
- Supervisor → Sup Prompts: prompts · Supervisor behavior is prompt-driven
- Supervisor → Checkpoint: persists · Workflow state can be saved and resumed
- Supervisor → Tools Facade: dispatches · Supervisor selects among available tools
- Tools Facade → Assign Tool: includes · Assignment-making workflow is one available tool
- Tools Facade → Quiz Tool: includes · Quiz-generation workflow is one available tool
- Tools Facade → Summary Tool: includes · Summarization workflow is one available tool
- Assign Tool → LLM Factory: uses · Tool workflow builds model clients through the LLM layer
- Quiz Tool → LLM Factory: uses · Tool workflow builds model clients through the LLM layer
- Summary Tool → LLM Factory: uses · Tool workflow builds model clients through the LLM layer
- LLM Factory → LLM Config: reads · Factory is configured by provider settings
- LLM Factory → LLM Enums: selects · Factory uses supported provider/model choices