viraj-421's picture
Upload folder using huggingface_hub
f78aa33 verified
|
Raw History Blame Contribute Delete
3.39 kB
---
title: Agentic AI Document Review
emoji: 🚀
colorFrom: red
colorTo: blue
sdk: streamlit
sdk_version: 1.30.0
app_file: app.py
pinned: false
---
# Agentic AI Document Review System
This project is a multi-agent system designed to transform raw meeting notes or bullet points into highly structured, professional Product Requirement Documents (PRDs). It utilizes a cyclic workflow to draft, review, and refine the document, with a "Human-in-the-Loop" pause for final QA approval.
## Architecture
The system uses **LangGraph** to orchestrate the workflow and **FastAPI** to expose the process via REST endpoints.
```mermaid
graph TD
%% Define styles
classDef userNode fill:#f9f,stroke:#333,stroke-width:2px;
classDef systemNode fill:#bbf,stroke:#333,stroke-width:2px;
classDef decisionNode fill:#ff9,stroke:#333,stroke-width:2px;
User[User Input: Raw Notes]:::userNode --> |Start Workflow| Writer[Writer Node: Drafts/Revises PRD]:::systemNode
Writer --> Critic{Critic Node: Evaluates Draft}:::decisionNode
Critic -->|Feedback & Reject| Writer
Critic -->|Approve| Pause[Human Approval: Workflow Paused]:::userNode
Pause -->|Human API Approval| End((Workflow Complete)):::systemNode
```
The multi-agent graph consists of:
1. **Writer Node**: Uses an LLM (configured for OpenAI's `gpt-4o`) to generate or revise the PRD based on raw input and reviewer feedback.
2. **Critic Node**: Uses LLM structured tool calling to strictly evaluate the draft against company standards (required sections, formatting, professional tone). It returns a JSON object with `status` (approved/rejected) and detailed `feedback`.
3. **Human Approval Node**: The graph pauses execution here if the Critic approves the document. The system waits for an external API call (`/api/workflow/{thread_id}/approve`) to complete the workflow.
## Setup Instructions
1. **Install Requirements**
Ensure you have Python 3.10+ installed.
```bash
pip install -r requirements.txt
```
2. **Environment Variables**
Create a `.env` file in the root directory and add your OpenAI API key:
```
OPENAI_API_KEY=your_openai_api_key_here
```
3. **Run the Server**
Start the FastAPI application using Uvicorn:
```bash
uvicorn main:app --reload
```
The Swagger UI documentation will be available at `http://127.0.0.1:8000/docs`.
## API Usage Workflow
### 1. Start the Workflow
Submit raw notes to generate a PRD.
**POST** `/api/workflow/start`
```json
{
"raw_input": "Meeting notes: We need a new login page. Users should login with email and password. Also support Google OAuth. Out of scope: Apple login. We need to handle rate limiting for security."
}
```
**Response**: Returns a `thread_id`. Keep this ID for subsequent calls.
### 2. Check Status
Check if the AI agents are still iterating or if they are waiting for human approval.
**GET** `/api/workflow/{thread_id}/status`
Wait until `waiting_for_human` is `true`.
### 3. Review the Document
Retrieve the current draft generated by the Writer.
**GET** `/api/workflow/{thread_id}/document`
### 4. Provide Human Approval
Once satisfied with the document, approve the workflow.
**POST** `/api/workflow/{thread_id}/approve`
After approval, the workflow completes, and the document is finalized.