What you’ll build
You’ll build an intelligent HR assistant that answers employee questions about policies, benefits, and procedures using RAG (Retrieval-Augmented Generation). Instead of employees searching through long PDF handbooks or waiting for HR responses, they can ask natural language questions and get instant, accurate answers with citations to official policy documents. This workflow demonstrates how to:- Create and manage knowledge bases from HR documents
- Use RAG to ground AI responses in your actual policies
- Build conversational agents that cite sources
- Handle common HR queries automatically while escalating complex cases
- Provide 24/7 access to HR information
What employees can ask
Your HR assistant can handle questions like:- “How do I apply for annual leave?”
- “What’s the work from home policy?”
- “How many sick days do I get?”
- “What’s the process for expense reimbursement?”
- “Who do I contact for IT issues?”
- “What benefits am I eligible for?”
- “How does the performance review process work?”
- “What’s the dress code?”
- “Can I take unpaid leave?”
Prerequisites
Before you begin, ensure you have:- MagOneAI instance with knowledge base capabilities
- HR policy documents in PDF, DOCX, or Markdown format:
- Employee handbook
- Leave policy
- Benefits guide
- Onboarding checklist
- IT security policy
- Expense policy
- Code of conduct
- Any other policy documents
- LLM provider configured (GPT-4, Claude 3.5 Sonnet recommended for accurate retrieval)
Architecture
The HR assistant uses a simple but powerful RAG pattern:Why RAG is essential for HR assistants
Accuracy
Answers are grounded in actual policy documents, not hallucinated or outdated information
Auditability
Every answer cites the specific policy section, making it easy to verify and audit
Easy Updates
Update policies by replacing documents - the assistant automatically uses the latest version
Consistent Answers
All employees get the same information regardless of who they ask or when
Step-by-step build
Prepare your HR documents
Gather and organize your HR policy documents.Recommended document structure:
-
Employee Handbook (comprehensive)
- Company overview and values
- Employment policies
- Workplace conduct
- General benefits overview
- Contact information
-
Leave Policy (detailed)
- Annual leave entitlement and accrual
- Sick leave
- Parental leave
- Compassionate leave
- Public holidays
- Leave application process
-
Benefits Guide (detailed)
- Health insurance
- Retirement plans
- Stock options (if applicable)
- Wellness programs
- Professional development
- Employee assistance program
-
Onboarding Checklist
- First day procedures
- Required paperwork
- IT setup
- Training schedule
- 30-60-90 day expectations
-
IT Security Policy
- Password requirements
- Device management
- Data protection
- Acceptable use
- Incident reporting
-
Expense Policy
- What’s reimbursable
- Spending limits
- Submission process
- Approval workflow
- Payment timeline
- Use clear section headings (improves retrieval)
- Keep policies in separate documents by topic (more targeted retrieval)
- Include effective dates and version numbers
- Use consistent terminology across documents
- PDFs and DOCX both work well
If your documents are very long (100+ pages), consider splitting them into smaller topic-specific files for better retrieval accuracy.
Create a knowledge base
Create a knowledge base in your MagOneAI project.
- Navigate to Knowledge Bases in your project
- Click “Create New Knowledge Base”
- Name it: “HR Policies and Procedures”
- Configure settings:
- Chunking strategy: Automatic (recommended) or Custom
- Automatic: ~500-1000 token chunks with overlap
- Custom: Define your own chunk size (use if you have specific requirements)
- Embedding model: Use default or select specific model
- Metadata: Enable to track document source, version, effective date
- Chunking strategy: Automatic (recommended) or Custom
Understanding chunking
Understanding chunking
Chunking breaks large documents into smaller sections that can be retrieved independently. This is crucial for RAG accuracy.Why chunking matters:
- Large documents can’t be retrieved in full (context limits)
- Smaller chunks = more precise retrieval
- Overlap ensures context isn’t lost at chunk boundaries
- Automatic (recommended): Smart chunking based on document structure
- Fixed size: Consistent chunk sizes (e.g., 1000 tokens)
- Semantic: Chunk by topics/sections (requires more configuration)
Upload HR documents to knowledge base
Add your policy documents to the knowledge base.
- In your knowledge base, click “Upload Documents”
- Select your prepared HR documents:
- Employee_Handbook.pdf
- Leave_Policy.pdf
- Benefits_Guide.pdf
- Onboarding_Checklist.pdf
- IT_Security_Policy.pdf
- Expense_Policy.pdf
- Add metadata (optional but recommended):
- Document type (e.g., “policy”, “guide”, “procedure”)
- Effective date
- Department
- Version number
- Click “Upload and Process”
- Small documents (under 10 pages): ~1-2 minutes
- Medium documents (10-50 pages): ~5-10 minutes
- Large documents (50+ pages): ~10-30 minutes
You’ll see a progress indicator showing:
- Upload → 2. Text extraction → 3. Chunking → 4. Embedding → 5. Ready
Verify document processing
Ensure documents were processed correctly.
- Check document status: All should show “Ready” or “Active”
- Review chunks: Click on a document to see how it was chunked
- Verify chunks are logical (not cutting mid-sentence)
- Check that chunk size is reasonable (~500-1000 tokens)
- Test retrieval: Use the knowledge base “Test” feature
- Query: “What is the annual leave policy?”
- Verify: Relevant chunks from Leave_Policy.pdf are retrieved
- Check: Relevance scores (should be >0.7 for good matches)
- Adjust chunk size (try smaller chunks for more precision)
- Ensure documents have clear section headings
- Check for OCR issues (if scanned PDFs)
- Verify document language matches embedding model
Create the HR assistant agent
Build an agent with RAG capabilities.
- Navigate to Agents → Create New Agent
-
Configure agent basics:
- Name: HR Policy Assistant
- Model: GPT-4 or Claude 3.5 Sonnet
- Description: “Answers employee questions about HR policies and procedures”
-
Write the agent persona:
-
Enable RAG:
- Toggle “Enable Knowledge Base”
- Select: “HR Policies and Procedures”
- Retrieval settings:
- Number of chunks to retrieve: 5-10 (start with 5)
- Relevance threshold: 0.7 (only use highly relevant chunks)
- Reranking: Enable if available (improves accuracy)
-
Configure response settings:
- Temperature: 0.3 (lower = more consistent, factual)
- Max tokens: 500-1000 (sufficient for most answers)
- Enable citations: Yes (automatically include sources)
Build the chat workflow
Create a simple workflow to connect the agent to chat.
- Navigate to Workflows → Create New Workflow
- Name it: “HR Assistant Chat”
-
Add nodes:
Node 1: Chat Trigger
- Type: Chat Trigger
- No specific pattern (respond to any question in this chat)
- Agent: HR Policy Assistant
- Input:
{{trigger.user_message}} - Enable: Knowledge base retrieval
- If you want to add footer or formatting:
- Save and activate the workflow
Test with common HR questions
Validate that the assistant works correctly.Test these common questions:
-
“How do I apply for annual leave?”
- Expected: Step-by-step process from Leave Policy
- Verify: Cites the correct policy section
-
“What’s the work from home policy?”
- Expected: WFH eligibility, approval process, requirements
- Verify: Accurate information from Employee Handbook
-
“How many sick days do I get?”
- Expected: Sick leave entitlement details
- Verify: Includes any conditions or documentation requirements
-
“What’s covered by health insurance?”
- Expected: Benefits overview from Benefits Guide
- Verify: Mentions where to find detailed coverage info
-
“Who do I contact for IT issues?”
- Expected: IT support contact from Onboarding or IT Security Policy
- Verify: Provides correct contact method
-
“How many leave days do I have left?” (personal query)
- Expected: “I don’t have access to personal leave balances. Please check [HRIS system] or contact HR.”
- Verify: Correctly escalates personal data queries
-
“Can I bring my dog to work?” (likely not in documents)
- Expected: “I don’t see information about pet policies in our documents. Please contact HR at…”
- Verify: Doesn’t hallucinate an answer
- ✅ Answers are accurate and from documents
- ✅ Citations are included
- ✅ Personal queries are escalated appropriately
- ✅ “Don’t know” responses when info isn’t available
- ✅ Friendly, helpful tone
- ✅ Response time (under 5 seconds for most queries)
Deploy and communicate to employees
Launch the HR assistant and ensure employees know how to use it.Deployment:Training:
- Add chat widget to employee portal or intranet
- Create dedicated Slack channel: #ask-hr-assistant
- Add to Microsoft Teams as a bot (if integrated)
- Include in onboarding for new hires
- Host a brief demo session
- Create a 2-minute video showing how to use it
- Include in new hire onboarding
- Share example questions employees can ask
Key concepts demonstrated
Knowledge Base Creation
Build searchable knowledge bases from documents with automatic chunking and embedding
RAG (Retrieval-Augmented Generation)
Ground AI responses in your actual documents to ensure accuracy and prevent hallucinations
Conversational Agents
Create natural language assistants that understand intent and provide helpful responses
Chat-Triggered Workflows
Build always-on assistants that respond instantly to employee questions
Source Citation
Automatically include citations so employees can verify information
Graceful Escalation
Recognize when to escalate to humans vs. answering directly
Example conversation
Here’s a realistic conversation with the HR assistant:View example conversation
View example conversation
Employee: How do I apply for annual leave?HR Assistant: To apply for annual leave, follow these steps:
Employee: What’s the work from home policy?HR Assistant: Our hybrid work policy allows eligible employees to work from home up to 3 days per week. Here are the key details:Eligibility:
Employee: How many sick days do I have left?HR Assistant: I don’t have access to your personal leave balances or accrual information.To check your remaining sick leave:
Employee: Can I bring my dog to work?HR Assistant: I don’t see specific information about pets or animals in the workplace in our current policy documents.Please contact HR directly at [email protected] to ask about pet policies. They’ll be able to provide guidance on whether this is permitted and any conditions that might apply.Is there anything else I can help you with regarding our documented policies?
- Submit your leave request through the HRIS system at least 2 weeks in advance
- Your manager will receive an automatic notification
- Leave must be approved by your direct manager
- You’ll receive a confirmation email once approved
- Log the approved leave in your calendar
- Annual leave is subject to operational requirements and manager approval
- During busy periods (Q4, product launches), advance notice requirements may be longer
- Emergency or last-minute leave should be discussed directly with your manager
Employee: What’s the work from home policy?HR Assistant: Our hybrid work policy allows eligible employees to work from home up to 3 days per week. Here are the key details:Eligibility:
- Employees who have completed their probation period
- Roles that don’t require on-site presence
- Manager approval required
- Minimum 2 days per week in office (typically Tuesday and Thursday are anchor days)
- Reliable internet connection and appropriate workspace
- Availability during core hours (10am-4pm)
- Participation in all required meetings (in-person or virtual)
- Agree on a WFH schedule with your manager
- Log WFH days in the HRIS system
- Can be flexible week-to-week with manager approval
Employee: How many sick days do I have left?HR Assistant: I don’t have access to your personal leave balances or accrual information.To check your remaining sick leave:
- Log into the HRIS portal at [portal.company.com]
- Go to “My Leave” → “Balances”
- Or contact HR at [email protected]
- 10 sick days per year (accrued monthly)
- Medical certificate required for absences over 3 consecutive days
- Unused sick leave doesn’t carry over to the next year
Employee: Can I bring my dog to work?HR Assistant: I don’t see specific information about pets or animals in the workplace in our current policy documents.Please contact HR directly at [email protected] to ask about pet policies. They’ll be able to provide guidance on whether this is permitted and any conditions that might apply.Is there anything else I can help you with regarding our documented policies?
Customization ideas
Extend your HR assistant to handle more scenarios:Add onboarding workflow for new hires
Add onboarding workflow for new hires
Create a step-by-step onboarding assistant:New workflow: “New Hire Onboarding”
- Triggered when a new employee is added to HRIS
- Sends welcome message with onboarding checklist
- Guides through required paperwork
- Schedules orientation sessions
- Assigns training modules
- Checks progress at 30-60-90 day marks
- Add “onboarding mode” that provides proactive guidance
- Create personalized checklist based on role and department
- Send reminders for incomplete tasks
- Connect manager and buddy for support
- New hire orientation materials
- Department-specific onboarding guides
- First week/month expectations
- Training resources
Integrate with HRIS for personalized answers
Integrate with HRIS for personalized answers
Connect to your HRIS for employee-specific information:Integration approach:
- Add HRIS API tool to your project
- Configure authentication (OAuth, API key)
- Create agent with HRIS access
- “How many leave days do I have left?” → Fetch from HRIS
- “When is my next performance review?” → Check review schedule
- “What benefits am I enrolled in?” → Query benefits data
- “When is my anniversary?” → Calculate from hire date
- “Who is my manager?” → Fetch org chart data
- Require authentication before providing personal data
- Only show employee their own data (verify user identity)
- Log all personal data access for audit trails
- Follow GDPR/privacy regulations
- Add authentication check before HRIS queries
- Route personal queries to HRIS-enabled agent
- General policy queries go to regular RAG agent
Add multilingual support
Add multilingual support
Support employees in multiple languages:Approach 1: Translation layer
- Detect user’s language
- Translate query to English
- Process with RAG (English documents)
- Translate response back to user’s language
- Upload policy documents in multiple languages
- Use multilingual embedding models
- Retrieve from language-specific documents
- Respond in the queried language
- Spanish (LATAM, Spain)
- French (France, Canada)
- German
- Mandarin
- Arabic
- Hindi
- Based on your employee demographics
- Add language detection agent
- Create translation agents (or use translation API)
- Configure multilingual embedding model
- Test thoroughly for accuracy across languages
Create department-specific knowledge bases
Create department-specific knowledge bases
Tailor information by department:Create multiple knowledge bases:
-
Engineering HR KB: Engineering-specific policies
- On-call compensation
- Equipment and tools policy
- Conference and training budget
- Open source contribution policy
-
Sales HR KB: Sales-specific policies
- Commission structure
- Travel and expense policies
- Sales incentive programs
- Territory and quota policies
- General HR KB: Company-wide policies (existing)
- Detect user’s department (from HRIS or user profile)
- Query department-specific KB first
- Fall back to general KB if not found
- Or query both and merge results
- More relevant results for specialized queries
- Smaller knowledge bases = faster, more accurate retrieval
- Easier to maintain department-specific policies
Add feedback and learning loop
Add feedback and learning loop
Improve the assistant over time:Feedback collection:
- Add 👍 👎 buttons after each response
- Ask “Was this helpful?”
- Collect: What was wrong? (if unhelpful)
- Track which questions get poor feedback
- Most asked questions
- Questions with no good answers (gaps in knowledge base)
- Low-rated responses (accuracy issues)
- Average response helpfulness rating
- Most retrieved documents
- Weekly review of low-rated responses
- Identify knowledge gaps
- Add missing documents or clarify existing ones
- Refine agent persona based on feedback
- A/B test persona changes
- Add feedback collection node after response
- Store feedback in database with question/answer
- Build analytics dashboard
- Schedule weekly review process
Build HR request automation
Build HR request automation
Automate common HR requests beyond just answering questions:Automated request handling:
- Leave requests: “I’d like to request leave from [date] to [date]” → Create leave request in HRIS → Notify manager → Confirm to employee
- Document requests: “I need an employment verification letter” → Generate letter template → Route to HR for signature → Deliver to employee
- Policy clarifications: “Can you clarify the expense policy for [scenario]?” → Escalate to HR with context → Track response → Update knowledge base with clarification
- Add intent detection: query vs. request
- Route requests to appropriate automation workflows
- Create tickets/tasks in HRIS or HR system
- Send confirmation and status updates
- Include human approval for sensitive requests
Create interactive policy explorer
Create interactive policy explorer
Make policies more accessible and engaging:Interactive features:
-
“Benefits quiz”: “What benefits am I eligible for based on my situation?”
- Ask clarifying questions (full-time/part-time, tenure, dependents)
- Provide personalized benefits summary
-
“Leave calculator”: “How much leave will I accrue by [date]?”
- Calculate based on tenure and accrual rates
- Show when they’ll hit certain thresholds
-
“Policy scenarios”: Present common scenarios and guide through policy
- “What if I need to work from another country for a month?”
- “What if I need to take emergency leave?”
- Create scenario-based agent personas
- Build multi-turn conversation flows
- Use Forms or Wizards for data collection
- Provide clear, step-by-step guidance
Best practices for HR assistants
- Content Management
- Privacy & Security
- Employee Experience
- Continuous Improvement
Keep your knowledge base current and accurate:
- Regular updates: Review and update documents quarterly
- Version control: Tag documents with effective dates
- Archive old policies: Remove outdated information
- Clear ownership: Assign document owners (HR team members)
- Change notifications: Alert when policies change
- Test after updates: Verify assistant answers correctly with new policies
- Use clear headings and structure
- Write in plain language (avoid jargon)
- Include examples and scenarios
- Keep policies concise and focused
- Cross-reference related policies
Measuring success
Track these metrics to demonstrate value: Usage metrics:- Daily/weekly active users
- Total questions asked
- Questions per employee
- Peak usage times
- Answer accuracy (% with correct information)
- Citation rate (% of answers with sources)
- Average helpfulness rating (from feedback)
- Escalation rate (% of queries escalated to HR)
- HR team time saved (basic inquiries handled by bot)
- Employee time saved (instant answers vs. waiting for HR response)
- Reduction in email/ticket volume to HR
- Improved policy awareness and compliance
Next steps
Now that you’ve built an HR assistant, explore related cookbooks:- IT Support Triage - Similar RAG-based support automation for IT
- Sales Intelligence Assistant - Another chat-triggered assistant pattern
- Document Compliance Review - Advanced document analysis with RAG
Need help customizing this for your HR policies or integrating with your HRIS? Contact our solutions team for guidance on enterprise HR automation.