diff --git a/agents/sop_generator/README.md b/agents/sop_generator/README.md new file mode 100644 index 0000000..8ed9b2d --- /dev/null +++ b/agents/sop_generator/README.md @@ -0,0 +1,37 @@ +# SOP Generator Agent +This agentic AI application generates structured Standard Operating Procedures (SOPs) from high‑level process descriptions. It is built using FastAPI and returns a JSON‑formatted SOP with sections such as Purpose, Scope, Responsibilities, Materials, Steps, KPIs, Risks, and Versioning. + +# How to Run Locally +Clone the repository and navigate to the project folder. +Create and activate a virtual environment: +python -m venv .venv .venv\Scripts\Activate + +# Install dependencies: +pip install -r requirements.txt + +# Start the FastAPI server: +uvicorn sop_agent.main:app --reload + +# Open your browser and visit: +Swagger UI: http://127.0.0.1:8000/docs ReDoc: http://127.0.0.1:8000/redoc + +# API Endpoint +POST /generate_sop Request Body: { "process_description": "Onboarding a new intern in a biotech lab" } + +# Response: +Returns a structured SOP in JSON format. + +# Deployment Instructions +This app can be deployed on Render or any free hosting platform. + +# Render Setup: +Environment: Python 3.x Start command: uvicorn sop_agent.main:app --host 0.0.0.0 --port 8000 The public endpoint will be used to test the API. + +# Project Structure +sop_agent/ ├─ main.py # FastAPI app ├─ agent.py # SOP generation logic ├─ models.py # Pydantic request/response models ├─ init.py requirements.txt README.md + +# Example Output +{ "title": "SOP: Onboarding a new intern in a biotech lab", "purpose": "...", "scope": "...", "responsibilities": ["..."], "materials": ["..."], "steps": ["..."], "kpis": ["..."], "risks": ["..."], "version": "v1.0", "notes": "..." } + +# Notes +This agent is designed to demonstrate structured thinking, reproducible output, and production‑readiness for the DPS AI Engineering Challenge. diff --git a/agents/sop_generator/__init__.py b/agents/sop_generator/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/agents/sop_generator/__init__.py @@ -0,0 +1 @@ + diff --git a/agents/sop_generator/agent.py b/agents/sop_generator/agent.py new file mode 100644 index 0000000..0ee6059 --- /dev/null +++ b/agents/sop_generator/agent.py @@ -0,0 +1,46 @@ +from .models import SOPRequest, SOPResponse + +def generate_sop(request: SOPRequest) -> SOPResponse: + desc = request.process_description.strip() + + if not desc: + desc = "Unnamed process" + + title = f"SOP: {desc[:60]}" + + return SOPResponse( + title=title, + purpose=f"Define a clear, repeatable process for: {desc}", + scope="This SOP applies to all team members involved in this process.", + responsibilities=[ + "Process Owner: Ensures the SOP is followed and updated.", + "Team Members: Execute the steps as described.", + "Supervisor: Reviews outcomes and KPIs regularly." + ], + materials=[ + "Relevant tools, systems, or software required for the process.", + "Access credentials or permissions, if applicable.", + "Documentation templates or forms." + ], + steps=[ + "Step 1: Gather all necessary inputs and prerequisites.", + "Step 2: Execute the core actions described in the process.", + "Step 3: Validate outputs and check for errors or inconsistencies.", + "Step 4: Document results and update tracking systems.", + "Step 5: Escalate issues or deviations to the supervisor if needed." + ], + kpis=[ + "On-time completion rate of the process.", + "Error or rework rate.", + "Cycle time from start to finish.", + "Compliance with documentation requirements." + ], + risks=[ + "Incomplete or incorrect inputs leading to errors.", + "Lack of documentation causing confusion or rework.", + "Delays due to unclear responsibilities.", + "Non-compliance with regulatory or internal standards." + ], + version="v1.0", + notes="This SOP was auto-generated based on a high-level process description. It should be reviewed and adapted." + ) diff --git a/agents/sop_generator/main.py b/agents/sop_generator/main.py new file mode 100644 index 0000000..4e7e8a0 --- /dev/null +++ b/agents/sop_generator/main.py @@ -0,0 +1,17 @@ +from fastapi import FastAPI +from .models import SOPRequest, SOPResponse +from .agent import generate_sop + +app = FastAPI( + title="SOP Generator Agent", + description="Agentic AI service that generates structured SOPs from process descriptions.", + version="0.1.0", +) + +@app.post("/generate_sop", response_model=SOPResponse) +def generate_sop_endpoint(request: SOPRequest): + """ + Generate a structured SOP from a high-level process description. + """ + sop = generate_sop(request) + return sop diff --git a/agents/sop_generator/models.py b/agents/sop_generator/models.py new file mode 100644 index 0000000..4499191 --- /dev/null +++ b/agents/sop_generator/models.py @@ -0,0 +1,18 @@ +from pydantic import BaseModel + +from typing import List, Optional + +class SOPRequest(BaseModel): + process_description: str + +class SOPResponse(BaseModel): + title: str + purpose: str + scope: str + responsibilities: List[str] + materials: List[str] + steps: List[str] + kpis: List[str] + risks: List[str] + version: str + notes: Optional[str] = None diff --git a/agents/sop_generator/requirements.txt b/agents/sop_generator/requirements.txt new file mode 100644 index 0000000..50ac7c0 --- /dev/null +++ b/agents/sop_generator/requirements.txt @@ -0,0 +1,3 @@ +fastapi +uvicorn[standard] +pydantic