Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions agents/sop_generator/README.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions agents/sop_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

46 changes: 46 additions & 0 deletions agents/sop_generator/agent.py
Original file line number Diff line number Diff line change
@@ -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."
)
17 changes: 17 additions & 0 deletions agents/sop_generator/main.py
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions agents/sop_generator/models.py
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions agents/sop_generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastapi
uvicorn[standard]
pydantic