How rahulbalhotra-ship-it/kpmg_ai_team works
1. Overall shape
- This repository is a workspace scaffold for a multi-component product, not a single app.
- It is organized around three runtime surfaces: a Python agent system, a backend service layer, and a browser-based frontend.
- Supporting folders provide shared contracts, database assets, docs, and deployment scaffolding.
2. Agent orchestration layer
- The agents/ package is the core AI/workflow domain.
- It contains individual role-based agents such as director, pm, design, dev, qa, consultant, and partner, suggesting a multi-agent collaboration model.
- agents/agents/graph.py, state.py, parser.py, generators.py, and llm.py indicate that this layer manages stateful agent execution, prompt parsing, output generation, and LLM interaction.
3. Agent workflows and tools
- agents/prompts/ stores prompt templates per agent role, which are part of the agent behavior boundary.
- agents/tools/ includes linter.py and test_runner.py, so agents can trigger or evaluate code-quality and test-related actions.
- agents/workflows/ and agents/graphs/ are placeholders for higher-level orchestration pipelines and graph definitions.
4. Backend service boundary
- The backend/ directory appears to be a separate Python service that exposes application functionality to the rest of the system.
- backend/app/main.py, agent.py, and logger.py suggest an application entrypoint, an agent-facing integration layer, and centralized logging.
- backend/src/api, services, db, middleware, and sockets indicate a conventional backend split into API handlers, business logic, data access, cross-cutting middleware, and real-time communication.
5. Backend and agent integration
- The presence of backend/langgraph/ strongly suggests the backend integrates with a graph-based agent orchestration runtime.
- This likely makes the backend the boundary between external clients and the internal agent system, translating requests into agent workflows and returning structured results.
- backend/uploads/ implies the backend also handles file intake or artifact storage related to workflows.
6. Frontend application surface
- The frontend/ folder contains a browser UI with index.html, game.js, assets.js, style.css, and a src/ tree.
- The src/components/chat, agents, and office folders suggest the UI is organized around conversation, agent visibility/control, and some kind of workspace/office metaphor.
- src/store, hooks, lib, and types indicate a client-side app with local state management and typed domain models.
7. Shared contracts
- shared/constants, shared/schemas, and shared/types are intended to hold cross-cutting definitions used by more than one layer.
- This is the key boundary for keeping the frontend, backend, and agents aligned on the same message shapes and domain concepts.
- For an architecture diagram, this should be shown as a shared contract layer connecting multiple runtimes.
8. Data and persistence
- database/migrations and database/seeds indicate a relational or schema-managed persistence layer, though the specific database engine is not shown here.
- backend/src/db is the backend-side access point to that persistence layer.
- The repo also has a top-level db/README.md, suggesting database setup or conventions are documented separately.
9. Infrastructure and local execution
- docker-compose.yml, infrastructure/docker, and infrastructure/k8s show support for both local container composition and Kubernetes deployment.
- run.bat indicates Windows-friendly startup support.
- .env.example suggests environment-driven configuration across components.
10. Documentation and planning artifacts
- docs/architecture/system_architecture.md is the primary architecture documentation source in the repo.
- docs/prd/ and deliverables/project_plan.md show product and delivery planning materials alongside implementation code.
- These are useful for understanding intended behavior, but the code layout itself already implies the runtime boundaries.
11. Testing strategy
- tests/agents, tests/backend, and tests/frontend show test separation by subsystem.
- test_flow.py suggests there is at least one higher-level end-to-end or workflow-oriented test that crosses boundaries.
- This reinforces that the system is meant to be validated both per layer and as an integrated flow.
12. Likely end-to-end flow
- A user interacts with the frontend.
- The frontend calls the backend over HTTP and possibly sockets for live updates.
- The backend invokes the agent orchestration layer to execute role-based workflows, possibly using graph/state logic and tools.
- Results are persisted through the backend’s DB layer and rendered back in the frontend.
13. How to draw the architecture
- Represent the system as three main boxes: Frontend, Backend, and Agents/Workflow Engine.
- Add Shared Schemas/Types as a cross-cutting layer between them.
- Add Database, Uploads, and External LLM/tooling as dependencies of the backend/agents side.
- Show Docker/K8s as deployment infrastructure rather than application logic.
Main entry points: index.html UI shell · graph.py Agent core · main.py App entry · services Services
Components 25
Agents
Multi-agent workflow engine and prompts
- Agent core · Stateful agent execution and coordination
agents/agents/graph.py - Role agents · Director, PM, design, dev, QA, consultant, partner agents
agents/agents - Prompts · Role-specific prompt definitions
agents/prompts - Tools · Linter and test runner actions
agents/tools - State model · Agent state and parsing/generation helpers
agents/agents/state.py
Backend
Python service boundary and integrations
- App entry · Backend application bootstrap
backend/app/main.py - Agent bridge · Backend adapter for agent execution
backend/app/agent.py - API layer · Request handlers and application endpoints
backend/src/api - Services · Backend domain and orchestration logic
backend/src/services - DB access · Backend-side data access boundary
backend/src/db - Sockets · Live update and streaming channel
backend/src/sockets - LangGraph · Graph-based orchestration runtime integration
backend/langgraph/graph - Uploads · File intake and workflow artifacts
backend/uploads
Frontend
Browser UI and client state
- UI shell · Browser entry and top-level client app
frontend/index.html - Chat · Conversation-focused client components
frontend/src/components/chat - Agent panel · Agent visibility and control components
frontend/src/components/agents - Office view · Workspace metaphor and scene components
frontend/src/components/office - Client store · Client-side state and hooks
frontend/src/store
Shared
Cross-runtime contracts and types
- Contracts · Cross-runtime constants, schemas, and types
shared
Data
Persistence assets and database setup
- Migrations · Database migration definitions
database/migrations - Seeds · Initial or sample database data
database/seeds
Platform
Deployment and repo scaffolding
- Compose · Container composition for local execution
docker-compose.yml - K8s · Kubernetes deployment scaffolding
infrastructure/k8s - Architecture · System architecture and design notes
docs/architecture/system_architecture.md - Plan · Project delivery and planning artifact
deliverables/project_plan.md
Connections 27
- UI shell → Chat: renders · Shell hosts the main conversation surface
- UI shell → Agent panel: renders · Shell exposes agent controls and visibility
- UI shell → Office view: renders · Shell includes workspace-oriented views
- UI shell → Client store: uses · UI is backed by client state
- UI shell → API layer: calls · Browser UI talks to backend endpoints
- UI shell → Sockets: streams · Frontend receives live updates
- UI shell → Contracts: shares · Client aligns with shared types and schemas
- App entry → API layer: serves · Application entry wires API handlers
- App entry → Agent bridge: wires · Backend bootstraps agent integration
- API layer → Services: delegates · API layer calls business services
- Services → DB access: persists · Services use backend data access
- Services → Uploads: stores · Services manage workflow artifacts
- API layer → Sockets: publishes · API and services emit realtime events
- Agent bridge → LangGraph: executes · Backend agent bridge invokes graph runtime
- Agent bridge → Agent core: orchestrates · Backend dispatches work to agent engine
- Agent core → Role agents: coordinates · Core runtime sequences role-based agents
- Agent core → State model: tracks · Execution uses shared workflow state
- Agent core → Prompts: loads · Agent behavior is driven by prompts
- Agent core → Tools: invokes · Agents can run quality and test tools
- Agent core → Contracts: uses · Agent outputs follow shared schemas
- Services → Contracts: uses · Backend and client share domain contracts
- DB access → Migrations: backed by · Database layer depends on schema migrations
- DB access → Seeds: initialized by · Seed data supports local or test setup
- App entry → Compose: deploys via · Local runtime is composed with containers
- App entry → K8s: deploys via · Service is also prepared for Kubernetes
- Architecture → Contracts: documents · Architecture docs describe cross-runtime contracts
- Plan → Architecture: references · Delivery planning follows the architecture view