• unwind ai
  • Posts
  • Build a Multi-agent AI Recruitment Team

Build a Multi-agent AI Recruitment Team

Fully functional multi-agent app using GPT-4o (step-by-step instructions)

We believe the best way routine high-volume tasks can be automated effectively using multiple AI agents and high-frequency technical recruitment is one of those. Manual resume screening, interview scheduling, and candidate communications can consume valuable time that could be better spent on strategic tasks and human interactions.

To address this, we're building a multi-agent AI recruitment system. We will create specialized agents powered by GPT-4o, that each handle different parts of the workflow - from parsing PDFs and analyzing technical skills to integrating with Zoom for scheduling and managing email communications. You’ll learn how to configure these agents and make them work together seamlessly while building a clean Streamlit interface that makes it all look easy.

We're using Phidata, a framework specifically designed for orchestrating AI agents. It provides the infrastructure for agent communication, memory management, and tool integration. Using Phidata, we can easily create agents that not only process multiple input modalities but also reason about them in combination.

Don’t forget to share this tutorial on your social channels and tag Unwind AI (X, LinkedIn, Threads, Facebook) to support us!

What We’re Building

This Streamlit app is a sophisticated recruitment system that can take a candidate's resume, analyze their skills against job requirements, automatically schedule interviews for qualified candidates, and handle all the email communications - while recruiters just monitor the process through a simple dashboard.

When a recruiter uploads a candidate's resume, our system automatically evaluates their technical skills, sends personalized feedback emails, and for qualified candidates, even sets up Zoom interviews - all without manual intervention.

Our multi-agent recruitment system includes three agents: a Resume Analyzer, an Interview Scheduler, and an Email Communication agent.

Features:

  • Intelligent resume analysis with skill matching and experience assessment

  • Automated interview scheduling with Zoom integration

  • Professional email communications for acceptances, rejections, and interview coordination

  • Multi-agent architecture with specialized roles

  • User-friendly Streamlit interface

  • Secure API integration with OpenAI, Zoom, and email services

How the App Works

The system operates through a coordinated team of specialized AI agents:

  1. Resume Analyzer Agent:

    • Processes uploaded PDF resumes using PyPDF2

    • Matches candidate skills against role requirements

    • Evaluates technical experience and project work

    • Makes data-driven selection decisions using a 70% match threshold

  2. Interview Scheduler Agent:

    • Handles Zoom meeting creation and coordination

    • Manages timezone conversions with pytz

    • Creates professional meeting invites

    • Ensures business hours scheduling (9 AM - 5 PM IST)

  3. Email Communication Agent:

    • Drafts and sends professional emails using Gmail

    • Handles acceptance notifications with interview details

    • Provides constructive feedback in rejection emails

    • Maintains consistent branding and tone

Workflow:

  1. Recruiter/user uploads candidate's resume and enters email

  2. Resume Analyzer assesses the application against role requirements

  3. If selected:

    • Email agent sends acceptance notification

    • Scheduler creates Zoom interview

    • Email agent sends interview details

  4. If not selected:

    • Email agent sends constructive feedback with improvement suggestions

Prerequisites

Before we begin, make sure you have the following:

  1. Python installed on your machine (version 3.10 or higher is recommended)

  2. OpenAI API key for GPT-4o

  3. Zoom account with API credentials (Account ID, Client ID, Client Secret)

  4. Gmail account with App Password for automated emails

  5. A code editor of your choice (we recommend VS Code or PyCharm for their excellent Python support)

  6. Basic familiarity with Python programming

Things to do before running the application:

  1. Create/Use a new Gmail account for the recruiter

  2. Enable 2-step verification and generate an App Password for the Gmail account

  3. The App Password is a 16-digit code (use without spaces) that should be generated here - Google App Password Please go through the steps to generate the password. Format - 'afec wejf awoj fwrv' (remove the spaces and enter it in the Streamlit app).

  4. Create/ Use a Zoom account and go to the Zoom App Marketplace to get the API credentials : Zoom Marketplace

  5. Go to Developer Dashboard and create a new app - Select Server to Server OAuth and get the credentials, you’ll see 3 credentials - Client ID, Client Secret, and Account ID.

  6. After that, you need to add a few scopes to the app - so that the Zoom link of the candidate is sent and created through the mail.

  7. The Scopes are meeting:write:invite_links:admin, meeting:write:meeting:admin, meeting:write:meeting:master, meeting:write:invite_links:master, meeting:write:open_app:admin, user:read:email:admin, user:read:list_users:admin, billing:read:user_entitlement:admin, dashboard:read:list_meeting_participants:admin [last 3 are optional]

Step-by-Step Instructions

Setting Up the Environment

First, let's get our development environment ready:

  1. Clone the GitHub repository:

git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
  1. Go to the ai_recruitment_agent_team folder:

cd ai_agent_tutorials/ai_recruitment_agent_team
pip install -r requirements.txt
  1. Get your API Key: OpenAI API key for GPT-4o access, Zoom API credentials (Account ID, Client ID, Client Secret), and email app password of the recruiter's email

Creating the Streamlit App

Let’s create our app. Create a new file ai_recruitment_agent_team.py and add the following code:

  1. Let's set up our imports and custom tools:

    • Phidata as agent framework

    • GPT-4o as the LLM

    • Zoom API, EmailTools Tool from Phidata

    • PyPDF2 for PDF processing

    • pytz for time management

    • Streamlit Session State for state management

from typing import Literal, Tuple, Dict, Optional
import os
import time
import json
import requests
import PyPDF2
from datetime import datetime, timedelta
import pytz

import streamlit as st
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.email import EmailTools
from phi.tools.zoom import ZoomTool
from phi.utils.log import logger
from streamlit_pdf_viewer import pdf_viewer
  1. Create a custom Zoom tool with OAuth handling:

class CustomZoomTool(ZoomTool):
    def __init__(self, *, account_id: Optional[str] = None, 
                 client_id: Optional[str] = None, 
                 client_secret: Optional[str] = None):
        super().__init__()
        self.token_url = "https://zoom.us/oauth/token"
        self.access_token = None
        self.token_expires_at = 0
  1. Define role requirements dictionary:

ROLE_REQUIREMENTS = {
    "ai_ml_engineer": """
        Required Skills:
        - Python, PyTorch/TensorFlow
        - Machine Learning algorithms
        - Deep Learning
        - MLOps
        - RAG, LLM, Prompt Engineering
    """,
    "frontend_engineer": """...""",
    "backend_engineer": """..."""
}
  1. Initialize Resume Analyzer Agent:

def create_resume_analyzer() -> Agent:
    return Agent(
        model=OpenAIChat(id="gpt-4o"),
        description="Expert technical recruiter",
        instructions=[
            "Analyze resume against requirements",
            "Consider project experience",
            "Value hands-on experience",
            "Return JSON response"
        ]
    )
  1. Create Email Agent:

def create_email_agent() -> Agent:
    return Agent(
        model=OpenAIChat(id="gpt-4o"),
        tools=[EmailTools(
            receiver_email=st.session_state.candidate_email,
            sender_email=st.session_state.email_sender
        )],
        instructions=[
            "Draft professional emails",
            "Maintain friendly tone",
            "Use standardized signature"
        ]
    )
  1. Create Scheduler Agent:

def create_scheduler_agent() -> Agent:
    return Agent(
        name="Interview Scheduler",
        model=OpenAIChat(id="gpt-4o"),
        tools=[CustomZoomTool()],
        instructions=[
            "Schedule during business hours",
            "Create proper meeting details",
            "Handle scheduling errors"
        ]
    )
  1. Implement resume analysis:

def analyze_resume(resume_text: str, role: str, analyzer: Agent) -> Tuple[bool, str]:
    response = analyzer.run(f"""
    Analyze against requirements:
    {ROLE_REQUIREMENTS[role]}
    Resume: {resume_text}
    Return JSON with decision and feedback
    """)
    return response["selected"], response["feedback"]
  1. Handle email communications:

def send_selection_email(email_agent: Agent, to_email: str, role: str):
    email_agent.run(f"""
    Send congratulatory email for {role} position
    Include next steps and interview info
    """)

def send_rejection_email(email_agent: Agent, to_email: str, feedback: str):
    email_agent.run(f"""
    Send constructive feedback
    Include learning resources
    Be empathetic and encouraging
    """)
  1. Implement interview scheduling:

def schedule_interview(scheduler: Agent, email: str, role: str):
    meeting_response = scheduler.run(f"""
    Schedule 60-minute technical interview
    Title: '{role} Technical Interview'
    Use IST timezone
    Include meeting details
    """)
  1. Create main Streamlit interface:

def main():
    st.title("AI Recruitment System")
    init_session_state()
    
    with st.sidebar:
        st.header("Configuration")
        # API keys and settings
  1. Add file upload and processing:

resume_file = st.file_uploader("Upload Resume", type=["pdf"])
if resume_file:
    resume_text = extract_text_from_pdf(resume_file)
    st.session_state.resume_text = resume_text
  1. Handle resume analysis workflow:

if st.button("Analyze Resume"):
    with st.spinner("Analyzing..."):
        is_selected, feedback = analyze_resume(
            st.session_state.resume_text,
            role,
            resume_analyzer
        )
  1. Manage interview scheduling:

if st.button("Schedule Interview"):
    with st.spinner("Scheduling..."):
        schedule_interview(
            scheduler_agent,
            st.session_state.candidate_email,
            role
        )

Running the App

With our code in place, it's time to launch the app.

  • In your terminal, navigate to the project folder, and run the following command

streamlit run ai_recruitment_agent_team.py

Disclaimer: This tool is designed to assist in the recruitment process but should not completely replace human judgment in hiring decisions. All automated decisions should be reviewed by human recruiters for final approval.

Working Application Demo

Conclusion

You've built a sophisticated multi-agent AI recruitment system that automates the technical hiring process while maintaining a professional and efficient candidate experience.

For further enhancements, consider:

  • Adding customizable assessment criteria for different roles

  • Implementing calendar integration for more precise scheduling

  • Creating a candidate portal for self-scheduling

  • Adding automated technical assessment tests

  • Implementing analytics dashboard for recruitment metrics

Keep experimenting and refining to build smarter AI solutions!

We share hands-on tutorials like this 2-3 times a week, to help you stay ahead in the world of AI. If you're serious about leveling up your AI skills and staying ahead of the curve, subscribe now and be the first to access our latest tutorials.

Don’t forget to share this tutorial on your social channels and tag Unwind AI (X, LinkedIn, Threads, Facebook) to support us!

Reply

or to participate.