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
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
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.
- โ๏ธ 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
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- GitHub repo : https://github.com/Team-01-DAMG-7245/pe-dashboard-ai50
- EVAL.md : https://github.com/Team-01-DAMG-7245/pe-dashboard-ai50/blob/swara/EVAL.md
- Demo video : https://drive.google.com/file/d/1abFljwrx1lSxF5LOVPup7tTnjKDvDKF8/view?usp=sharing
- Youtube video : https://youtu.be/BzeN0LC2-8Q
- Reflection.md for Evaluation : https://github.com/Team-01-DAMG-7245/pe-dashboard-ai50/blob/main/REFLECTION.md
docker compose up
# Access UI: http://localhost:8080 (admin/admin)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โโโ 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
aws configure # Enter your credentials
export AWS_BUCKET_NAME=quanta-ai50-dataPopulate data/forbes_ai50_seed.json with Forbes AI 50 companies from https://www.forbes.com/lists/ai50/
Create .env:
AWS_BUCKET_NAME=quanta-ai50-data
OPENAI_API_KEY=your-api-key-hereflowchart 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)]
๐งฉ 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
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
- 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)
-
Swara
- Phase 1, 3
-
Nat
- Phase 4
- RAG pipeline
-
Kundana
- Phase 2
