Leave Request Management System

Submission type

Coded Agent with UiPath SDK

Name

Rajneesh Khare

Industry category in which use case would best fit in (Select up to 2 industries)

HR
Information technology and services

Complexity level

Advanced

Summary (abstract)

This system automatically extracts leave details from natural language, validates against company policies using Context Grounding, checks balances via MCP, and routes to HR only when needed. The result: 90% less manual work, 100% policy compliance, and happier employees and HR.

Tech Stack: LangGraph workflows + UiPath Context Grounding + MCP integration + Human-in-the-Loop approvals

Detailed problem statement

Most organizations struggle with inefficient, error-prone leave request processes that burden HR teams and frustrate employees. Here’s what’s broken:

  1. Manual Processing Bottleneck

    → HR staff spend 15-20 hours per week manually processing leave requests
    → Each request requires multiple steps: reading emails, checking balances, validating policies, updating spreadsheets, sending confirmations
    → Average processing time: 2-3 days per request
    → During peak seasons (holidays, summer), backlogs extend to 5+ days

  2. Policy Compliance Gaps

    → Company leave policies exist in PDF documents, Word files, or intranet pages
    → HR staff must manually search and interpret policies for each request
    15-20% of approved requests violate policies (advance notice requirements, maximum consecutive days, blackout periods)
    → Inconsistent policy application across different HR staff members
    → No systematic way to ensure compliance before approval

  3. Data Silos & System Fragmentation

    → Leave balances stored in separate HRIS/database systems
    → Employee records in another system
    → Policy documents in SharePoint/document repositories
    → Email-based communication creates no central record
    → HR manually copies data between systems, leading to errors

  4. Insufficient Leave Balance Issues

    → Employees submit requests without knowing their current balance
    → HR discovers insufficient balance only after reviewing the request
    → Back-and-forth emails to clarify or adjust dates
    → Employees feel frustrated by delayed rejections

  5. Missing or Incomplete Information

    → Employees forget to include start date, end date, or reason
    → HR must send follow-up emails requesting missing details
    → Multiple email exchanges before processing can begin
    → Information gets lost in email threads

  6. Inconsistent Approval Workflows

    → No clear rules for when HR/manager approval is needed
    → Some requests auto-approved, others require review but criteria unclear
    → Complex cases (extended leave, maternity, policy violations) slip through without proper review
    → No escalation mechanism for edge cases

Detailed solution

An end-to-end intelligent leave request automation system that combines AI-powered natural language understanding, policy compliance validation, real-time system integration, and human oversight to transform leave management from a multi-day manual process into a sub-2-hour automated workflow

Architecture & Components:

  1. Workflow Orchestration Layer - LangGraph

    Purpose: Manages the complex, multi-step leave request workflow with conditional routing and state persistence.

    Key Features:
    → 11-node state machine handling the complete lifecycle from request submission to final notification
    → Conditional routing based on business rules (policy compliance, leave balance, duration)
    → State persistence tracking 20+ fields across the entire workflow
    → Interrupt mechanism for Human-in-the-Loop interventions

  2. AI Intelligence Layer - UiPath Chat (GPT-4)

    Purpose: Provides natural language understanding and intelligent decision-making throughout the workflow.

    Use Cases:

    A. Leave Information Extraction

    Input: "I need leave from next Monday to Wednesday for a family wedding"
    Output: {
    "leave_start": "2025-10-20",
    "leave_end": "2025-10-22", 
    "leave_reason": "family wedding"
    }
    B. Leave Categorization
    Input: "I need leave from next Monday to Wednesday for a family wedding"
    Output: {
    "leave_start": "2025-10-20",
    "leave_end": "2025-10-22", 
    "leave_reason": "family wedding"
    }
    
    C. Policy Compliance Analysis

    -> Analyzes retrieved policy documents
    -> Determines if request violates any policies
    -> Identifies which specific policy clauses apply
    -> Recommends HR approval for edge cases
  1. Policy Intelligence Layer - Context Grounding

    Purpose: Provides semantic search and retrieval of relevant company policies from indexed document repositories.

    How It Works:

    Step 1: Policy Indexing (One-time setup)
    
    -> Company leave policies stored in UiPath Document Understanding
    -> Documents indexed with semantic embeddings
    -> Folder structure: Shared/company-policy-index
    
    Step 2: Query-time Retrieval
    
    policy_query = f"""What is the company policy on
    Leave type: {leave_category}
    Duration: {leave_days_requested} days
    Reason: {leave_reason}
    """
    
    policy_context = context_grounding.invoke(policy_query)
    
    Step 3: Contextual Results
    -> Returns top relevant policy sections with metadata (source, page number)
    -> Provides context to LLM for compliance analysis
    -> Handles multi-document policy sets
    
    
  2. System Integration Layer - MCP Server

    Purpose: Provides secure, standardized integration with backend systems (databases, email) through reusable tools.

    MCP Tools Implemented:

   A. getEmployeeDetails
      Input: {"employee_email": "john.doe@company.com"}
      Output: {
      "Employee ID": "EMP001",
      "Employee Name": "John Doe",
      "Department": "Engineering",
      "Manager": "Jane Smith"
      }

   B. getLeaveBalance
      Input: {"employee_email": "john.doe@company.com"}
      Output: {
      "Vacation": 18,
      "Sick Leave": 10,
      "Maternity/Paternity": 90,
      "Bereavement": 5,
      "Personal Leave": 3
      }

   C. updateLeaveBalance
      Input: {
      "employee_email": "john.doe@company.com",
      "leave_type": "Vacation",
      "days": 3
      }
      Output: Success (deducts 3 days from Vacation balance)

   D. sendEmail
       Input: {
       "Recipient": "john.doe@company.com",
       "Subject": "Leave Request Approved",
       "Body": "<html>...</html>"
       }
       Output: Email sent successfully
   MCP Architecture:

   -> Streamable HTTP transport for cloud-based MCP server
   -> Bearer token authentication using UiPath access token
   -> Async session management for concurrent operations
  1. Human-in-the-Loop Layer - UiPath Action Center

    Purpose: Provides interactive action tasks at critical decision points requiring human input or judgment.

    HITL Touchpoint 1: Employee Clarification
    Trigger: Missing or incomplete leave request information
    UiPath Action App:
    App: LeaveRequestApp
    Title: “Please fill missing leave details”
    Fields:
    - LeaveStart
    - LeaveEnd
    - LeaveReason

    HITL Touchpoint 2: HR Approval
    Trigger:
    - Leave duration > 5 days
    - Policy violations detected
    - Maternity/Paternity leave
    - Insufficient leave balance requiring exception

    UiPath Action App:
    App: HRApprovalApp
    Title: “Leave Request Needs HR Approval”
    Fields:
    - Employee: “John Doe (ID: EMP001)” [Read-only]
    - LeaveType: “Vacation (Current Balance: 18 days)” [Read-only]
    - Period: “2025-12-20 to 2025-12-30 (11 days)” [Read-only]
    - Reason: “Family vacation abroad” [Read-only]
    - PolicyViolations: “Exceeds 5-day auto-approval limit” [Read-only]
    - ApplicablePolicies: [Policy text from Context Grounding] [Read-only]
    - Approval: [Dropdown: Approved/Rejected]
    - Comments: [Text Area]

Narrated video link (sample: https://bit.ly/4pvuNEL)

Expected impact of this automation

Expected Impact of the AI Leave Management Agent:

→ Drastic Reduction in Processing Time: Slashes the time taken to approve or deny leave requests from days to minutes, providing instant responses for standard cases.

→ Enhanced Policy Compliance & Accuracy: Eliminates human error by programmatically enforcing company policies and accurately tracking leave balances, significantly reducing compliance risks.

→ Improved Employee Experience: Offers employees a seamless, transparent, and fast way to request leave, boosting overall satisfaction and reducing administrative friction.

→ Increased HR Productivity: Frees up HR professionals from repetitive, low-value administrative tasks, allowing them to focus on strategic initiatives like talent management and employee well-being.

UiPath products used (select up to 4 items)

UiPath Action Center
UiPath Apps
UiPath Automation Cloud™
UiPath Coded Agents
UiPath Data Service
UiPath Orchestrator

Automation Applications

Can be integrated with HRMS, ITSM, ERP systems

Integration with external technologies

N/A

TO-BE workflow/architecture diagram (file size up to 4 MB)

Other resources

3 Likes

:waving_hand: Hi there, @rajneesh94 builder,

Thank you so much for being part of the Specialist Coded Agent Challenge. Your creativity, dedication, and automation skills truly blew us away! :collision:

Here’s what’s next:

:spiral_calendar: Nov 5–16: Jury evaluation by @eusebiu.jecan1 & @Adrian_Tamas + community voting
:trophy: Nov 17: Winners announced :tada:

Don’t forget the Community Choice Award, the best-voted project wins a $500 gift card + $60 UiPath Swag voucher! Voting is open till Nov 16, but remember that fresh accounts can’t vote (Level 1 access required, as we want to keep it fair and spam-free).

You’ve already won our admiration, now let’s see who takes home the big prizes :grinning_face_with_smiling_eyes:.

See you around,

Loredana