Skip to content

Team-01-DAMG-7245/pe-dashboard-ai50

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Case Study 2 โ€” Project ORBIT (Part 2)

Agentification and Secure Scaling of PE Intelligence using MCP


๐Ÿงญ Setting

In Assignment 4 (Project ORBIT Part 1) you automated ingestion and Markdown dashboard generation for the Forbes AI 50 using Airflow ETL + FastAPI + Streamlit.
That system worked, but it was staticโ€”no reasoning, no secure integration with multiple data tools.

Now, Priya Rao (VP of Data Engineering) wants you to evolve it into an agentic, production-ready platform that can:

  • Orchestrate due-diligence workflows through supervisory LLM agents
  • Standardize tool access with the Model Context Protocol (MCP)
  • Employ ReAct reasoning for transparency
  • Run under Airflow orchestration with containerized MCP services
  • Pause for Human-in-the-Loop (HITL) review when risks appear

๐ŸŽฏ Learning Outcomes

By the end you will:

  • Build specialized LLM agents (LangChain v1 or Microsoft Agent Framework)
  • Design a Supervisory Agent Architecture that delegates to sub-agents
  • Implement an MCP server exposing Tools / Prompts / Resources
  • Apply the ReAct pattern (Thought โ†’ Action โ†’ Observation) with structured logs
  • Compose a graph-based workflow (LangGraph or WorkflowBuilder) with conditional edges
  • Integrate Airflow DAGs, Docker, and .env configuration for deployment
  • Add pytest tests and structured logging for maintainability
  • Embed Human-in-the-Loop (HITL) approval nodes for risk verification

Architecture Diagram

The following diagram illustrates the complete system architecture for Assignment 4 - Project ORBIT Part 1, showing the two parallel dashboard generation pipelines (RAG and Structured), Airflow orchestration, and the complete data flow from ingestion to evaluation.

Assignment 4 Architecture Diagram

Diagram Components

  • โ˜๏ธ Airflow Orchestration Layer: 2 DAGs (Initial Load @once, Daily Refresh 0 3 * * *)
  • ๐Ÿ“ฅ Data Ingestion Layer: Web Scraper (homepage, /about, /product, /careers, /blog) โ†’ Raw Storage (S3/GCS)
  • ๐Ÿ”„ Processing Layer - Two Parallel Pipelines:
    • RAG Pipeline (Unstructured): Raw โ†’ Chunk โ†’ Embed โ†’ Vector DB โ†’ LLM โ†’ Dashboard
    • Structured Pipeline (Pydantic): Raw โ†’ Instructor โ†’ Pydantic Models โ†’ Payload โ†’ LLM โ†’ Dashboard
  • ๐ŸŒ API & UI Layer: FastAPI (port 8000) + Streamlit (port 8501)
  • ๐Ÿ“Š Evaluation & Comparison: Rubric-based comparison of RAG vs Structured dashboards
  • ๐Ÿ’พ Storage Layer: S3/GCS, Vector DB (ChromaDB), Local storage

Pipeline Flows

RAG Pipeline:

Raw HTML โ†’ Text Chunker โ†’ Vector DB (Embeddings) โ†’ LLM (Top-K chunks) โ†’ RAG Dashboard

Structured Pipeline:

Raw HTML โ†’ Instructor (Pydantic Extraction) โ†’ Structured Data โ†’ Payload Assembly โ†’ LLM (Structured context) โ†’ Structured Dashboard

To regenerate the diagram:

python scripts/generate_assignment4_architecture_diagram.py

Submission Deliverables

  1. GitHub repo : https://github.com/Team-01-DAMG-7245/pe-dashboard-ai50
  2. EVAL.md : https://github.com/Team-01-DAMG-7245/pe-dashboard-ai50/blob/swara/EVAL.md
  3. Demo video : https://drive.google.com/file/d/1abFljwrx1lSxF5LOVPup7tTnjKDvDKF8/view?usp=sharing
  4. Youtube video : https://youtu.be/BzeN0LC2-8Q
  5. Reflection.md for Evaluation : https://github.com/Team-01-DAMG-7245/pe-dashboard-ai50/blob/main/REFLECTION.md

Quick Start

Run Airflow (Docker)

docker compose up
# Access UI: http://localhost:8080 (admin/admin)

Run App Locally (Dev)

python -m venv airflow_env
source airflow_env/bin/activate
pip install -r requirements.txt
uvicorn src.api:app --reload        # http://localhost:8000
streamlit run src/streamlit_app.py  # http://localhost:8501

Project Structure

โ”œโ”€โ”€ dags/                  # Airflow DAGs (Labs 2-3)
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ forbes_ai50_seed.json   # Company list (Lab 0)
โ”‚   โ”œโ”€โ”€ raw/                     # Scraped HTML/text (Lab 1)
โ”‚   โ”œโ”€โ”€ structured/              # Pydantic models (Lab 5)
โ”‚   โ”œโ”€โ”€ payloads/                # Dashboard payloads (Lab 6)
โ”‚   โ””โ”€โ”€ workflow_dashboards/     # Lab 17 workflow outputs
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ api.py                   # FastAPI endpoints (Lab 7-8)
โ”‚   โ”œโ”€โ”€ models.py                # Pydantic schemas (Lab 5)
โ”‚   โ”œโ”€โ”€ s3_utils.py              # Cloud storage (Lab 1)
โ”‚   โ””โ”€โ”€ streamlit_app.py         # Dashboard UI (Lab 10)
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ docker-compose.yml
โ””โ”€โ”€ README.md

Setup

1. AWS S3 Configuration

aws configure  # Enter your credentials
export AWS_BUCKET_NAME=quanta-ai50-data

2. Seed File

Populate data/forbes_ai50_seed.json with Forbes AI 50 companies from https://www.forbes.com/lists/ai50/

3. Environment Variables

Create .env:

AWS_BUCKET_NAME=quanta-ai50-data
OPENAI_API_KEY=your-api-key-here

๐Ÿงฑ Project Architecture Overview

flowchart TD
    subgraph Airflow
        DAG1[Initial Load DAG]
        DAG2[Daily Update DAG]
        DAG3[Agentic Dashboard DAG]
    end
    subgraph Services
        MCP[MCP Server]
        AGENT[Supervisor Agent]
    end
    DAG3 -->|HTTP/CLI| MCP
    MCP --> AGENT
    AGENT -->|calls Tools| MCP
    AGENT -->|Risk Detected| HITL[Human Approval]
    AGENT --> STORE[(Dashboards DB or S3)]
Loading

๐Ÿงฉ Phase 1 โ€“ Agent Infrastructure & Tool Definition (Labs 12โ€“13)

Lab 12 โ€” Core Agent Tools

Implement async Python tools with Pydantic models for structured I/O:

Tool Purpose get_latest_structured_payload(company_id) Return the latest assembled payload from Assignment 2 rag_search_company(company_id, query) Query the Vector DB for contextual snippets report_layoff_signal(signal_data) Log or flag high-risk events (layoffs / breaches)

โœ… Checkpoint: Unit tests (tests/test_tools.py) validate each toolโ€™s behavior.

โธป

Lab 13 โ€” Supervisor Agent Bootstrap โ€ข Instantiate a Due Diligence Supervisor Agent with system prompt: โ€œYou are a PE Due Diligence Supervisor Agent. Use tools to retrieve payloads, run RAG queries, log risks, and generate PE dashboards.โ€ โ€ข Register the three tools. โ€ข Verify tool invocation loop via ReAct logs.

โœ… Checkpoint: Console logs show Thought โ†’ Action โ†’ Observation sequence.

โธป

๐ŸŒ Phase 2 โ€“ Model Context Protocol (MCP) Integration (Labs 14โ€“15)

Lab 14 โ€” MCP Server Implementation

Create src/server/mcp_server.py exposing HTTP endpoints:

Type Endpoint Description Tool /tool/generate_structured_dashboard Calls structured dashboard logic Tool /tool/generate_rag_dashboard Calls RAG dashboard logic Resource /resource/ai50/companies Lists company IDs Prompt /prompt/pe-dashboard Returns 8-section dashboard template

Provide Dockerfile (Dockerfile.mcp) and .env variables for config.

โœ… Checkpoint: MCP Inspector shows registered tools/resources/prompts.

โธป

Lab 15 โ€” Agent MCP Consumption โ€ข Configure mcp_config.json with base URL and tools. โ€ข Allow Supervisor Agent to invoke MCP tools securely with tool filtering. โ€ข Add integration test (tests/test_mcp_server.py) that requests a dashboard.

โœ… Checkpoint: Agent โ†’ MCP โ†’ Dashboard โ†’ Agent round trip works.

โธป

๐Ÿง  Phase 3 โ€“ Advanced Agent Implementation (Labs 16โ€“18)

Lab 16 โ€” ReAct Pattern Implementation โ€ข Log Thought/Action/Observation triplets in structured JSON (log file or stdout). โ€ข Use correlation IDs (run_id, company_id). โ€ข Save one trace under docs/REACT_TRACE_EXAMPLE.md.

โœ… Checkpoint: JSON logs show sequential ReAct steps.

โธป

Lab 17 โ€” Supervisory Workflow Pattern (Graph-based)

Use LangGraph or WorkflowBuilder to define nodes:

Node Responsibility Planner Constructs plan of actions Data Generator Invokes MCP dashboard tools Evaluator Scores dashboards per rubric Risk Detector Branches to HITL if keywords found

Provide workflow diagram (docs/WORKFLOW_GRAPH.md) and unit test covering both branches.

โœ… Checkpoint: python src/workflows/due_diligence_graph.py prints branch taken.

โธป

Lab 18 โ€” HITL Integration & Visualization โ€ข Implement CLI or HTTP pause for human approval. โ€ข Record execution path with LangGraph Dev UI or Mermaid. โ€ข Save trace and decision path in docs/REACT_TRACE_EXAMPLE.md.

โœ… Checkpoint: Demo video shows workflow pausing and resuming after approval.

โธป

โ˜๏ธ Phase 4 โ€“ Orchestration & Deployment (Add-On)

Airflow DAGs Integration

Create under airflow/dags/:

File Purpose orbit_initial_load_dag.py Initial data load and payload assembly orbit_daily_update_dag.py Incremental updates of snapshots and vector DB orbit_agentic_dashboard_dag.py Invokes MCP + Agentic workflow daily for all AI 50 companies

โœ… Checkpoint: Each DAG runs locally or in Dockerized Airflow and updates dashboards.

Containerization and Configuration

Provide: โ€ข Dockerfile.mcp (for MCP Server) โ€ข Dockerfile.agent (for Supervisor Agent + Workflow) โ€ข docker-compose.yml linking services + optional vector DB โ€ข .env.example for API keys and service URLs โ€ข config/settings_example.yaml for parameterization

โœ… Checkpoint: docker compose up brings up MCP + Agent locally.

โธป

๐Ÿงช Testing & Observability

Minimum Tests (pytest)

Test Purpose test_tools.py Validate core tools return expected schema test_mcp_server.py Ensure MCP endpoints return Markdown test_workflow_branches.py Assert risk vs no-risk branch logic

Run: pytest -v --maxfail=1 --disable-warnings

Logging & Metrics โ€ข Use Python logging or structlog (JSON format). โ€ข Include fields: timestamp, run_id, company_id, phase, message. โ€ข Optional: emit basic counters (e.g., dashboards generated, HITL triggered).

โธป

๐Ÿ“ฆ Deliverables

Deliverable Requirements

1 Updated GitHub Repo (pe-dashboard-ai50-v3) Full code + docs + Airflow DAGs 2 MCP Server Service Dockerized HTTP server exposing Tools/Resources/Prompts 3 Supervisor Agent & Workflow Implements ReAct + Graph + HITL 4 Airflow Integration DAG invokes Agentic workflow on schedule 5 Configuration Mgmt .env and config/ externalization 6 Testing Suite โ‰ฅ 3 pytest cases 7 Structured Logging JSON ReAct trace saved to docs/ 8 Docker Deployment Dockerfiles + docker-compose 9 Demo Video (โ‰ค 5 min) Show workflow execution + HITL pause 10 Contribution Attestation Completed form

โธป

๐Ÿงฎ Dashboard Format (Reference)

Eight mandatory sections: 1. Company Overview 2. Business Model and GTM 3. Funding & Investor Profile 4. Growth Momentum 5. Visibility & Market Sentiment 6. Risks and Challenges 7. Outlook 8. Disclosure Gaps (bullet list of missing info)

Rules โ€ข Use literal โ€œNot disclosed.โ€ for missing fields. โ€ข Never invent ARR/MRR/valuation/customer logos. โ€ข Always include final Disclosure Gaps section.

โธป

๐Ÿš€ Production Readiness Checklist

Before submission, verify that your system: โ€ข Has working Airflow DAGs for initial/daily/agentic runs โ€ข Runs MCP Server + Agent via Docker Compose โ€ข Loads config and secrets from .env or config/ โ€ข Implements structured ReAct logging (JSON) โ€ข Includes at least 3 automated pytest tests โ€ข Documents setup and run instructions in README.md โ€ข Demo video shows HITL pause/resume โ€ข README contains system diagram and architecture summary

โธป

๐Ÿงพ Submission โ€ข Repo name: pe-dashboard-ai50-v3- โ€ข Push to GitHub with all code, docs, and Docker/Airflow files. โ€ข Include demo video link in README. โ€ข Submit GitHub URL + video link via LMS.

โธป

๐Ÿ“š References & Resources โ€ข Python AI Series modules (Structured Outputs, Tool Calling, Agents, MCP) โ€ข Model Context Protocol Docs โ€ข LangGraph Docs โ€ข Microsoft Agent Framework Samples โ€ข Apache Airflow Quick Start โ€ข Docker Compose Guide


Contributions

  • Swara: Phase 1 (Labs 0โ€“1), Phase 2 (Lab 5), Phase 3 (Labs 8โ€“9)
  • Nat: Phase 1 (Labs 2โ€“3), Phase 4 (Labs 10โ€“11)
  • Kundana: Phase 2 (Labs 4, 6),Phase 3(Lab 7)

Roles & Responsibilities

  • Swara

    • Phase 1, 3
  • Nat

    • Phase 4
    • RAG pipeline
  • Kundana

    • Phase 2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •