Skip to main content

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)
Start with 3-5 core documents (handbook, leave policy, benefits) and add more over time. The knowledge base automatically handles updates when you replace documents with newer versions.

Architecture

The HR assistant uses a simple but powerful RAG pattern:
Chat Trigger (Employee asks question)

HR Assistant Agent (with RAG)
    ├── Retrieves relevant sections from knowledge base
    ├── Generates accurate answer grounded in retrieved content
    └── Cites specific policy sections

Response to Employee (with source citations)

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

1

Prepare your HR documents

Gather and organize your HR policy documents.Recommended document structure:
  1. Employee Handbook (comprehensive)
    • Company overview and values
    • Employment policies
    • Workplace conduct
    • General benefits overview
    • Contact information
  2. Leave Policy (detailed)
    • Annual leave entitlement and accrual
    • Sick leave
    • Parental leave
    • Compassionate leave
    • Public holidays
    • Leave application process
  3. Benefits Guide (detailed)
    • Health insurance
    • Retirement plans
    • Stock options (if applicable)
    • Wellness programs
    • Professional development
    • Employee assistance program
  4. Onboarding Checklist
    • First day procedures
    • Required paperwork
    • IT setup
    • Training schedule
    • 30-60-90 day expectations
  5. IT Security Policy
    • Password requirements
    • Device management
    • Data protection
    • Acceptable use
    • Incident reporting
  6. Expense Policy
    • What’s reimbursable
    • Spending limits
    • Submission process
    • Approval workflow
    • Payment timeline
Document preparation tips:
  • 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.
2

Create a knowledge base

Create a knowledge base in your MagOneAI project.
  1. Navigate to Knowledge Bases in your project
  2. Click “Create New Knowledge Base”
  3. Name it: “HR Policies and Procedures”
  4. 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 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
Chunking strategies:
  • 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)
For HR documents with clear section headings, automatic chunking works great.
3

Upload HR documents to knowledge base

Add your policy documents to the knowledge base.
  1. In your knowledge base, click “Upload Documents”
  2. Select your prepared HR documents:
    • Employee_Handbook.pdf
    • Leave_Policy.pdf
    • Benefits_Guide.pdf
    • Onboarding_Checklist.pdf
    • IT_Security_Policy.pdf
    • Expense_Policy.pdf
  3. Add metadata (optional but recommended):
    • Document type (e.g., “policy”, “guide”, “procedure”)
    • Effective date
    • Department
    • Version number
  4. Click “Upload and Process”
Processing time:
  • 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:
  1. Upload → 2. Text extraction → 3. Chunking → 4. Embedding → 5. Ready
You can navigate away and return later - processing continues in the background.
4

Verify document processing

Ensure documents were processed correctly.
  1. Check document status: All should show “Ready” or “Active”
  2. 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)
  3. 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)
If retrieval isn’t working well:
  • 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
5

Create the HR assistant agent

Build an agent with RAG capabilities.
  1. Navigate to AgentsCreate New Agent
  2. Configure agent basics:
    • Name: HR Policy Assistant
    • Model: GPT-4 or Claude 3.5 Sonnet
    • Description: “Answers employee questions about HR policies and procedures”
  3. Write the agent persona:
    You are a helpful HR assistant for [Company Name]. You help employees find information about company policies, benefits, and procedures.
    
    Guidelines:
    1. Answer questions using ONLY information from the retrieved policy documents
    2. Always cite the specific policy document and section in your answer
    3. If the information isn't in the documents, say so clearly and suggest contacting HR directly
    4. Be friendly, clear, and concise
    5. For complex or sensitive situations (disciplinary, legal, medical), advise employees to contact HR directly
    6. If a policy has an effective date, mention it
    7. For questions about personal benefits or leave balances, direct to HRIS or HR team (you only provide policy information)
    
    Format your responses as:
    [Clear answer to the question]
    
    **Source:** [Document name, section]
    
    Examples of when to escalate to HR:
    - Personal leave balance inquiries ("How many leave days do I have left?")
    - Sensitive situations (harassment, discrimination, disciplinary)
    - Requests for exceptions to policy
    - Benefits enrollment questions requiring personal information
    - Anything requiring access to employee records
    
    Your goal is to provide quick, accurate information for common policy questions while ensuring employees get proper support for complex cases.
    
  4. 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)
  5. Configure response settings:
    • Temperature: 0.3 (lower = more consistent, factual)
    • Max tokens: 500-1000 (sufficient for most answers)
    • Enable citations: Yes (automatically include sources)
6

Build the chat workflow

Create a simple workflow to connect the agent to chat.
  1. Navigate to WorkflowsCreate New Workflow
  2. Name it: “HR Assistant Chat”
  3. Add nodes: Node 1: Chat Trigger
    • Type: Chat Trigger
    • No specific pattern (respond to any question in this chat)
    Node 2: HR Assistant Agent
    • Agent: HR Policy Assistant
    • Input: {{trigger.user_message}}
    • Enable: Knowledge base retrieval
    Node 3: Response (optional formatting)
    • If you want to add footer or formatting:
      {{agent.response}}
      
      ---
      💡 *Need more help? Contact HR at [email protected]*
      
  4. Save and activate the workflow
For a simple HR assistant, you can skip the workflow entirely and just enable the agent in a dedicated chat channel. The workflow is useful if you want to add routing, logging, or formatting logic.
7

Test with common HR questions

Validate that the assistant works correctly.Test these common questions:
  1. “How do I apply for annual leave?”
    • Expected: Step-by-step process from Leave Policy
    • Verify: Cites the correct policy section
  2. “What’s the work from home policy?”
    • Expected: WFH eligibility, approval process, requirements
    • Verify: Accurate information from Employee Handbook
  3. “How many sick days do I get?”
    • Expected: Sick leave entitlement details
    • Verify: Includes any conditions or documentation requirements
  4. “What’s covered by health insurance?”
    • Expected: Benefits overview from Benefits Guide
    • Verify: Mentions where to find detailed coverage info
  5. “Who do I contact for IT issues?”
    • Expected: IT support contact from Onboarding or IT Security Policy
    • Verify: Provides correct contact method
  6. “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
  7. “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
What to check:
  • ✅ 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)
If the assistant gives incorrect information or hallucinates policies, reduce the temperature (try 0.1) and increase the relevance threshold (try 0.75). Also verify your documents are clear and well-structured.
8

Deploy and communicate to employees

Launch the HR assistant and ensure employees know how to use it.Deployment:
  • 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
Communication template:
📢 Introducing the HR Assistant

Need quick answers about company policies and benefits?
Ask our new HR Assistant!

What it can help with:
✅ Leave policies and procedures
✅ Benefits information
✅ Expense reimbursement process
✅ IT and security policies
✅ General HR procedures

How to use it:
1. Go to [chat link] or message @HR-Assistant in Slack
2. Ask your question in plain language
3. Get instant answers with policy citations

Note: For personal inquiries (leave balances, benefits enrollment)
or sensitive matters, please contact the HR team directly.

Try it now: "What's the work from home policy?"
Training:
  • 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:
Employee: How do I apply for annual leave?HR Assistant: To apply for annual leave, follow these steps:
  1. Submit your leave request through the HRIS system at least 2 weeks in advance
  2. Your manager will receive an automatic notification
  3. Leave must be approved by your direct manager
  4. You’ll receive a confirmation email once approved
  5. Log the approved leave in your calendar
Important notes:
  • 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
Source: Leave Policy, Section 2.1 “Annual Leave Application Process”, Effective January 2026
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
Requirements:
  • 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)
Process:
  • Agree on a WFH schedule with your manager
  • Log WFH days in the HRIS system
  • Can be flexible week-to-week with manager approval
Source: Employee Handbook, Section 4.3 “Flexible Work Arrangements”, Updated February 2026
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]
For reference, our sick leave policy provides:
  • 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
Source: Leave Policy, Section 3.1 “Sick Leave Entitlement”Need help with anything else?
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:
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
Agent enhancements:
  • 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
Knowledge base additions:
  • New hire orientation materials
  • Department-specific onboarding guides
  • First week/month expectations
  • Training resources
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
Personalized queries the assistant can handle:
  • “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
Privacy considerations:
  • 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
Workflow modification:
  • Add authentication check before HRIS queries
  • Route personal queries to HRIS-enabled agent
  • General policy queries go to regular RAG agent
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
Approach 2: Multilingual knowledge base
  • Upload policy documents in multiple languages
  • Use multilingual embedding models
  • Retrieve from language-specific documents
  • Respond in the queried language
Languages to consider:
  • Spanish (LATAM, Spain)
  • French (France, Canada)
  • German
  • Mandarin
  • Arabic
  • Hindi
  • Based on your employee demographics
Implementation:
  • Add language detection agent
  • Create translation agents (or use translation API)
  • Configure multilingual embedding model
  • Test thoroughly for accuracy across languages
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)
Routing logic:
  • 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
Benefits:
  • More relevant results for specialized queries
  • Smaller knowledge bases = faster, more accurate retrieval
  • Easier to maintain department-specific policies
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
Analytics dashboard:
  • Most asked questions
  • Questions with no good answers (gaps in knowledge base)
  • Low-rated responses (accuracy issues)
  • Average response helpfulness rating
  • Most retrieved documents
Improvement cycle:
  • 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
Implementation:
  • Add feedback collection node after response
  • Store feedback in database with question/answer
  • Build analytics dashboard
  • Schedule weekly review process
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
Workflow enhancements:
  • 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
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?”
Implementation:
  • 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

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
Document quality:
  • 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
Quality metrics:
  • Answer accuracy (% with correct information)
  • Citation rate (% of answers with sources)
  • Average helpfulness rating (from feedback)
  • Escalation rate (% of queries escalated to HR)
Business impact:
  • 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
Example success story:
After 3 months of deployment:
- 1,200 employees using the HR assistant
- 450 questions answered per week
- 4.2/5 average helpfulness rating
- 68% of basic HR inquiries now self-service
- HR team saved ~20 hours/week
- Employees get instant answers vs. 2-24 hour wait

Next steps

Now that you’ve built an HR assistant, explore related cookbooks:
Need help customizing this for your HR policies or integrating with your HRIS? Contact our solutions team for guidance on enterprise HR automation.