A multi-agent HR assistant that handles various HR-related queries and actions using OpenAI- Agents Framework

posted 2 min read

Building an AI-Powered HR Assistant with OpenAI Agents SDK

Introduction

In the era of digital transformation, automating HR queries and processes can significantly enhance employee experience and operational efficiency. In this project, I built an intelligent HR Assistant using the OpenAI Agents SDK that can handle a variety of HR-related queries, triage requests, and even trigger backend actions such as leave requests or complaint registration. The assistant features a conversational UI built with Gradio, making it accessible and user-friendly.


Key Features

  • Multi-Agent Architecture: Specialized agents handle different HR domains (leaves, benefits, policies, complaints).
  • Guardrails: Input guardrails ensure only HR-related queries are processed, improving safety and relevance.
  • Tool Integration: Backend functions (tools) are registered with agents, allowing the assistant to perform actions like creating leave requests or registering complaints.
  • Context Management: The assistant maintains conversation history, enabling context-aware, multi-turn conversations.
  • User Interface: A Gradio-based web UI provides a seamless chat experience.

Project Structure & Important Aspects

1. Agent Design

Each HR domain is managed by a dedicated agent:

  • Leaves Agent: Handles leave policies and requests.
  • Benefits Agent: Answers questions about employee benefits.
  • Policy Agent: Provides information on company policies.
  • Complaints Agent: Registers and tracks complaints.

A Triage Agent routes user queries to the appropriate specialist agent.

2. Guardrails

A guardrail agent checks if the user’s query is HR-related before passing it to the triage agent, ensuring the assistant stays on topic.

3. Tool Functions

Tools are Python functions registered with agents. For example:

@function_tool
def create_leave_request(employee_id: str, department: str, leave_type: str, start_date: str, end_date: str):
    return f"Leave request created for {employee_id} in {department} from {start_date} to {end_date} for {leave_type}."

Agents invoke these tools when appropriate, enabling real actions beyond just answering questions.

4. Context Management

The assistant maintains a persistent conversation history, which is included in each prompt to ensure context continuity across multiple turns. This is crucial for handling follow-up questions and multi-step workflows.

5. Gradio UI

A simple yet effective chat interface was built using Gradio, allowing users to interact with the HR assistant in real time.


Example Queries

  • “I need to take a leave next week.”
  • “What is the company’s life insurance policy?”
  • “How many sick leaves do I have left?”
  • “I want to register a complaint about my manager.”
  • “Tell me about the gym membership benefit.”

Demo

Video Demo

Try it Yourself

The full project is available on GitHub:
GitHub Repository


Demo Queries

Try these in the chat UI:

  • “Can I get parental leave?”
  • “How do I register a complaint?”
  • “What are the food coupon benefits?”
  • “Tell me about the weekend shift policy.”
  • “I want to apply for sick leave from tomorrow.”

Conclusion

This project demonstrates how the OpenAI Agents SDK can be leveraged to build robust, context-aware, and action-oriented assistants for enterprise use cases. With modular agents, tool integration, and a user-friendly UI, the HR Assistant is a step towards smarter, more efficient HR operations.


For more details and to contribute, visit the GitHub repository.


0 votes
0 votes

More Posts

Building an Intelligent Contract Assistant with OpenAI Agents SDK

Ramandeep Singh - Jun 10

Building Multi-Agent like application from scratch without any framework

Ramandeep Singh - Aug 14

Integrating a Retrieval-Augmented Generation (RAG) System Using Python and OpenAI

Michael Liang - May 14

Building an AI-Powered Restaurant Management System with OpenAI Agents SDK

Ramandeep Singh - Jun 30

Building Intelligent Workflows Without LLMs: With Microsoft Agent Framework

Shweta Lodha - Oct 16
chevron_left