AI-powered workflow automation is transforming HR and People Operations in 2026. One of the highest-impact applications is automating employee feedback loops using large language models (LLMs). In this practical guide, you'll learn—step by step—how to design, build, and deploy an automated feedback workflow that collects, analyzes, and routes employee feedback using LLMs. Whether you're an HR tech lead or a developer supporting People Ops, this tutorial will get you from zero to production-ready automation.
For a broader context on the role of AI in HR, see our Pillar: The Ultimate Guide to AI Workflow Automation for HR and People Operations in 2026.
Prerequisites
- Python 3.10+ (tested with 3.11.6)
- OpenAI API access (or Azure OpenAI, or Hugging Face Inference API for open-source LLMs)
- LangChain (v0.1.0+)
- FastAPI (v0.110+)
- Basic knowledge of REST APIs and Python scripting
- Access to an HRIS or survey tool with webhook support (e.g., BambooHR, Workday, or Google Forms)
- Optional: Slack API token (for feedback routing/notifications)
1. Define Your Automated Feedback Workflow
- Identify Feedback Touchpoints: Decide where feedback will be collected (e.g., post-onboarding, quarterly reviews, exit interviews, or continuous pulse surveys).
- Determine Feedback Channels: Will employees submit feedback via email, web forms, Slack, or another tool? For this tutorial, we’ll use a simple web form connected to a webhook.
-
Set Objectives: What do you want the LLM to do? Typical objectives include:
- Summarize feedback
- Detect sentiment (positive/neutral/negative)
- Flag urgent or sensitive issues
- Route feedback to the right HR team member
Tip: For more on AI workflow design in HR, see Hands-On with the Top AI-Powered HR Workflow Automation Tools for 2026.
2. Set Up Your Development Environment
-
Create and activate a Python virtual environment:
python3 -m venv venv source venv/bin/activate -
Install required packages:
pip install openai langchain fastapi uvicorn python-dotenv -
Set up API keys:
- Create a
.envfile in your project root:
OPENAI_API_KEY=sk-... SLACK_API_TOKEN=xoxb-...- Load environment variables in your Python scripts with
python-dotenv.
- Create a
3. Build the LLM-Powered Feedback Analyzer
-
Create a new Python file:
feedback_llm.py -
Implement the LLM feedback analysis logic:
import os from dotenv import load_dotenv from langchain.llms import OpenAI load_dotenv() llm = OpenAI( openai_api_key=os.getenv("OPENAI_API_KEY"), temperature=0.2, model_name="gpt-4" ) def analyze_feedback(feedback_text): prompt = f""" Analyze the following employee feedback: 1. Summarize the main points in 2 sentences. 2. Detect sentiment (positive, neutral, or negative). 3. Flag if the feedback is urgent or sensitive (yes/no). 4. Suggest which HR team should address it (e.g., People Ops, IT, Legal, DEI). Feedback: \"\"\"{feedback_text}\"\"\" """ return llm(prompt)Description: This function sends feedback text to the LLM and receives a structured response. You can tune the prompt for your organization's needs.
4. Build a FastAPI Webhook to Receive Feedback
-
Create
main.py:from fastapi import FastAPI, Request from feedback_llm import analyze_feedback app = FastAPI() @app.post("/feedback") async def receive_feedback(request: Request): data = await request.json() feedback_text = data.get("feedback") result = analyze_feedback(feedback_text) return {"analysis": result}Description: This API endpoint receives feedback (e.g., from a form or webhook), analyzes it with your LLM function, and returns the analysis.
-
Run your FastAPI server locally:
uvicorn main:app --reloadTest with:
curl -X POST http://localhost:8000/feedback -H "Content-Type: application/json" -d '{"feedback": "I feel the onboarding process was confusing and I did not receive my equipment on time."}'Screenshot Description: The terminal shows
Uvicorn running on http://127.0.0.1:8000and a successful POST request returning the LLM's structured analysis.
5. Automate Feedback Routing (e.g., Slack Notification)
-
Add Slack integration to your workflow (optional):
import requests import os def send_slack_notification(channel, message): slack_token = os.getenv("SLACK_API_TOKEN") headers = {"Authorization": f"Bearer {slack_token}"} data = { "channel": channel, "text": message } response = requests.post( "https://slack.com/api/chat.postMessage", headers=headers, json=data ) return response.json() -
Modify your FastAPI endpoint to route urgent/sensitive feedback:
@app.post("/feedback") async def receive_feedback(request: Request): data = await request.json() feedback_text = data.get("feedback") result = analyze_feedback(feedback_text) # Parse the LLM result (assuming it returns a string, parse as needed) if "urgent: yes" in result.lower() or "sensitive: yes" in result.lower(): send_slack_notification("#hr-alerts", f"URGENT FEEDBACK: {result}") return {"analysis": result}Screenshot Description: Slack channel
#hr-alertsdisplays a notification: URGENT FEEDBACK: ... with the LLM's summary and routing suggestion.
6. Connect Your HRIS or Survey Tool
-
Configure your feedback form to POST to your FastAPI endpoint:
- For Google Forms, use an automation tool like Zapier or Make (Integromat) to send form responses to
http://your-server/feedback. - For BambooHR/Workday, use native webhook support to POST feedback to your endpoint.
Screenshot Description: Zapier dashboard showing a trigger ("New Google Form Response") and an action ("POST to Webhook").
- For Google Forms, use an automation tool like Zapier or Make (Integromat) to send form responses to
-
Test end-to-end: Submit feedback via your form and verify:
- The feedback hits your API and is analyzed by the LLM.
- Urgent/sensitive feedback triggers Slack notification (if configured).
- All feedback is logged or stored for HR review.
7. (Optional) Store and Visualize Feedback
-
Add a database (e.g., SQLite, PostgreSQL) for storing feedback and LLM analysis:
import sqlite3 def log_feedback(feedback, analysis): conn = sqlite3.connect('feedback.db') c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS feedback (id INTEGER PRIMARY KEY, feedback TEXT, analysis TEXT)''') c.execute("INSERT INTO feedback (feedback, analysis) VALUES (?, ?)", (feedback, analysis)) conn.commit() conn.close() -
Call
log_feedback()in your FastAPI endpoint. - Visualize feedback trends (optional): Use BI tools like Metabase or Tableau to connect to your database and generate dashboards on sentiment, urgency, and team routing.
Common Issues & Troubleshooting
-
LLM API errors (rate limits, authentication):
- Check your API key and usage quotas.
- Handle exceptions in your LLM function:
try: result = llm(prompt) except Exception as e: print(f"LLM error: {e}") return "LLM unavailable"
-
Webhook not triggering:
- Test your endpoint with
curlor Postman. - Check webhook URL and payload format in your HRIS/survey tool.
- Test your endpoint with
-
Slack notifications not delivered:
- Verify your Slack API token and channel permissions.
- Check the Slack API response for errors.
-
LLM hallucinations or inconsistent outputs:
- Refine your prompts for clarity and structure.
- Consider prompt validation frameworks—see Prompt Validation Frameworks: Reducing Hallucinations in LLM-Based Workflows.
-
Data privacy and compliance:
- Ensure you’re not sending sensitive PII to external APIs without proper agreements.
- For compliance best practices, see AI Workflow Automation for Compliance in HR: New Rules, New Opportunities.
Next Steps
- Scale your workflow: Integrate with more HR touchpoints (onboarding, offboarding, quarterly reviews). For onboarding automation, see How to Automate Employee Onboarding Workflows with LLMs: Step-by-Step Guide (2026).
- Audit for bias and compliance: Regularly review LLM outputs to ensure fairness and mitigate risk. See How to Audit AI-Driven HR Workflows for Bias and Compliance in 2026.
- Experiment with open-source LLMs: Try alternatives to OpenAI for data privacy or cost reasons.
- Expand automation: Explore related use cases in procurement approvals (How LLMs Are Streamlining Procurement Approvals: Practical Use Cases for 2026).
- Stay up-to-date: For comprehensive strategies, revisit our Ultimate Guide to AI Workflow Automation for HR and People Operations in 2026.