Cookbooks

HR Policy and Onboarding

Build an HR knowledge base assistant with RAG

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

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.

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

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.

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

Create the HR assistant agent

Build an agent with RAG capabilities.

  1. Navigate to Agents → Create 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)

Build the chat workflow

Create a simple workflow to connect the agent to chat.

  1. Navigate to Workflows → Create 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 hr@company.com*
  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.

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.

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:

Customization ideas

Extend your HR assistant to handle more scenarios:

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.

MagOneAI© 2026 Magure, Inc.

On this page