-0.4 C
New York
Saturday, February 22, 2025

Constructing a Resume Evaluate Agent System with CrewAI


Crafting the right resume is a tedious activity – whether or not you’re a contemporary graduate moving into the job market, or a seasoned skilled aiming for that subsequent large profession transfer. However what if you happen to may have a private resume reviewer at your fingertips – with out spending any cash on LinkedIn Premium or hiring an expensive skilled? Enter the world of AI-powered options for resume optimisation! With the ability of Giant Language Fashions (LLMs) and modern libraries like CrewAI, now you can construct your very personal resume assessment agent. On this weblog, I’ll present you the right way to construct an agentic system with CrewAI for reviewing and optimizing resumes.

Construction of the Resume Reviewer Agentic System

Earlier than moving into the coding half, you will need to perceive the right way to construction an AI system for resume optimisation. One of the simplest ways to do that could be by noting down the duties that we’d like the agent to carry out. So, I’m assuming you will have already made a resume (else you’ll be able to obtain one resume from right here). Now, we might need our resume assessment agentic system to carry out 3 duties:

  1. Learn via and supply suggestions on the resume.
  2. Enhance or re-write the resume primarily based on the suggestions.
  3. Recommend applicable jobs primarily based on the improved resume and specified location.

Now that we have now our necessities clearly written, we will determine on the variety of brokers and their duties. Ideally, it is strongly recommended we go together with one activity per agent to keep away from overburdening any agent. This interprets to us constructing 3 brokers for our CrewAI-based resume assessment agent system:

  1. The primary agent will present suggestions on the resume.
  2. The second agent will enhance the resume primarily based on the suggestions.
  3. And, the third agent would counsel applicable jobs primarily based on the improved resume and specified location.

Additionally Learn: Constructing a RAG-Based mostly Analysis Assistant Utilizing o3-mini and CrewAI

Now that you just perceive how we will use AI for resume optimisation, let’s leap to the Python code and construct our resume reviewer agent.

Python Code to Construct Resume Reviewer Agentic System with CrewAI

Listed below are the step-by-step directions to construct a resume assessment agent with CrewAI. To raised comply with these steps, I counsel you watch this hands-on video parallelly.

So let’s start!

Step 1: Set up and Import Related Libraries

We’ll start with putting in the PyMuPDF, python-docx and most significantly CrewAI.

  • The PyMuPDF library is used for studying PDF paperwork.
  • The python-docx library is used for creating, studying, and modifying Microsoft Phrase (.docx) paperwork.
  • Additionally, guarantee CrewAI is put in in your system. It is among the hottest agentic frameworks to construct multi-agent techniques.
#!pip set up PyMuPDF
#!pip set up python-docx
#!pip set up crewai crewai-tools

Step 2: Loading the Resume

The following step is to import the fitz and docx modules. Right here ‘fitz’ is the identify you utilize to import PyMuPDF, and ‘docx’ is to import the python-docx library.

import fitz  # PyMuPDF for PDF processing
import docx  # python-docx for DOCX processing

We’ll now outline the next three capabilities to allow our agentic system to extract textual content from resumes saved in numerous codecs.

  • The primary perform – “extract_text_from_pdf” will extract contents from the resume in PDF format.
  • The second perform – “extract_text_from_docx” will extract contents from the resume in docx format.
  • The third perform – “extract_text_from_resume” wraps the primary two capabilities and makes use of the respective perform primarily based on whether or not the doc is a PDF or docx.

Let’s run this.

def extract_text_from_pdf(file_path):
    """Extracts textual content from a PDF file utilizing PyMuPDF."""
    doc = fitz.open(file_path)
    textual content = ""
    for web page in doc:
        textual content += web page.get_text()
    return textual content

def extract_text_from_docx(file_path):
    """Extracts textual content from a DOCX file utilizing python-docx."""
    doc = docx.Doc(file_path)
    fullText = []
    for para in doc.paragraphs:
        fullText.append(para.textual content)
    return "n".be part of(fullText)

def extract_text_from_resume(file_path):
    """Determines file sort and extracts textual content."""
    if file_path.endswith(".pdf"):
        return extract_text_from_pdf(file_path)
    elif file_path.endswith(".docx"):
        return extract_text_from_docx(file_path)
    else:
        return "Unsupported file format."

Subsequent, let’s check this perform with 2 resumes. The primary one will likely be a resume in PDF format of an individual named Bruce Wayne (not the superhero).

res1 = extract_text_from_resume('/Customers/admin/Desktop/YT Lengthy/Bruce Wayne.pdf')
print(res1)

Now, we view the second resume.

res2 = extract_text_from_resume('/Customers/admin/Desktop/YT Lengthy/Anita Sanjok.docx')
print(res2)

Step 3: Making ready the Brokers and Duties

This step is the place CrewAI enters the scene. We’ll now import crewai and begin constructing the agentic system. For this, we’ll want 3 elements from CrewAI, namely- Agent, Job and Crew.

  • Agent represents an AI assistant with a particular function and objective.
  • Job defines an goal that the agent wants to perform.
  • And at last, Crew is used to bundle a number of brokers and their respective duties collectively to work and obtain the set goal.
import os
from crewai import Agent, Job, Crew

Subsequent, we have to add the OpenAI API key, which I’ve saved in a separate file. So, we have to learn the API key from the file and set it as an surroundings variable. On this case we’re utilizing GPT-4o-mini because the LLM.

with open('/Customers/apoorv/Desktop/AV/Code/GAI/keys/openai.txt', 'r') as file:
    openai_key = file.learn()
os.environ['OPENAI_API_KEY'] = openai_key
os.environ["OPENAI_MODEL_NAME"] = 'gpt-4o-mini'

Subsequent, we outline the brokers and their respective duties.

1. Resume Suggestions Agent

Our first agent would be the “resume_feedback” agent. The agent class has some parameters which assist us outline the target of the agent. Lets have a look at them:

  • The function parameter defines the agent’s perform and experience throughout the crew. Right here the agent’s function is that of a “Skilled Resume Advisor”.
  • The objective is the only real goal that guides brokers’ decision-making.
  • Verbose = True allows detailed execution logs for debugging.
  • The backstory offers an in depth description of the traits of the agent. It’s just like defining the context and character of the agent.

Let’s run this.

# Agent 1: Resume Strategist
resume_feedback = Agent(
    function="Skilled Resume Advisor",
    objective="Give suggestions on the resume to make it stand out within the job market.",
    verbose=True,
    backstory="With a strategic thoughts and one eye on element, you excel at offering suggestions on resumes to focus on probably the most related abilities and experiences."
    )

Now let’s outline the duty for the resume_feedback agent. The duty is nothing however the particular project that must be accomplished by the agent to which this activity is assigned.

  • We’ll add an in depth description which ought to be a transparent, and concise assertion of what the duty entails. You will need to notice that the {resume} written in curly braces is a placeholder that will likely be dynamically changed with an precise resume enter when the duty runs. You possibly can pause studying right here, undergo the outline and make adjustments as per your necessities.
  • The anticipated output parameter helps us decide the format of the output. You may get the output in numerous codecs corresponding to  json, markdown or bullet factors
  • The agent parameter highlights the identify of the agent to which this activity is assigned.
# Job for Resume Strategist Agent: Align Resume with Job Necessities
resume_feedback_task = Job(
    description=(
        """Give suggestions on the resume to make it stand out for recruiters. 
        Evaluate each part, inlcuding the abstract, work expertise, abilities, and training. Recommend so as to add related sections if they're lacking.  
        Additionally give an total rating to the resume out of 10.  That is the resume: {resume}"""
    ),
    expected_output="The general rating of the resume adopted by the suggestions in bullet factors.",
    agent=resume_feedback
)

2. Resume Advisor Agent

We’ll do the identical for the following agent, that’s, the resume_advisor agent which writes a resume incorporating the suggestions from the resume_feedback agent and defines its activity within the resume_advisor_task. Be happy to undergo it.

# Agent 2: Resume Strategist
resume_advisor = Agent(
    function="Skilled Resume Author",
    objective="Based mostly on the suggestions recieved from Resume Advisor, make adjustments to the resume to make it stand out within the job market.",
    verbose=True,
    backstory="With a strategic thoughts and one eye on element, you excel at refining resumes primarily based on the suggestions to focus on probably the most related abilities and experiences."
)
# Job for Resume Strategist Agent: Align Resume with Job Necessities
resume_advisor_task = Job(
    description=(
        """Rewrite the resume primarily based on the suggestions to make it stand out for recruiters. You possibly can alter and improve the resume however do not make up information. 
        Evaluate and replace each part, together with the abstract, work expertise, abilities, and training to higher replicate the candidates talents. That is the resume: {resume}"""
    ),
    expected_output= "Resume in markdown format that successfully highlights the candidate's {qualifications} and experiences",
    # output_file="improved_resume.md",
    context=[resume_feedback_task],
    agent=resume_advisor
)

3. Job Researcher Agent

Now, the third agent ought to be capable of counsel jobs primarily based on the {qualifications} and the popular job location of the candidate. For this, we’ll grant a instrument to our subsequent agent that permits it to go looking the web for job postings at a location.

We’ll use CrewAI’s SerperDevTool which integrates with Serper.dev for real-time internet search performance.

from crewai_tools import SerperDevTool

Now we import the API key from Serper. You possibly can generate your free Serper API key from https://serper.dev/api-key.

with open('/Customers/apoorv/Desktop/AV/Code/GAI/keys/serper.txt', 'r') as file:
    serper_key = file.learn()

os.environ["SERPER_API_KEY"] = serper_key

search_tool = SerperDevTool()

Now we outline our ultimate agent which is the job_researcher agent. This agent will seek for jobs on the location primarily based on the resume improved by the resume_advisor agent. The construction of the agent is just like the above brokers with the one distinction being the addition of a brand new parameter, which is instruments. Instruments enable you assign the required instruments to an agent which helps within the completion of the duty. Additionally, within the activity we have now added {location} in curly braces for dynamically altering it.

# Agent 3: Researcher
job_researcher = Agent(
    function = "Senior Recruitment Marketing consultant",
    objective = "Discover the 5 most related, not too long ago posted jobs primarily based on the improved resume recieved from resume advisor and the placement choice",
    instruments = [search_tool],
    verbose = True,
    backstory = """As a senior recruitment guide your prowess find probably the most related jobs primarily based on the resume and placement choice is unmatched. 
    You possibly can scan the resume effectively, determine probably the most appropriate job roles and seek for the very best suited not too long ago posted open job positions on the preffered location."""
    )
research_task = Job(
    description = """Discover the 5 most related current job postings primarily based on the resume recieved from resume advisor and placement choice. That is the popular location: {location} . 
    Use the instruments to collect related content material and shortlist the 5 most related, current, job openings. Additionally present the hyperlinks to the job postings.""",
    expected_output=(
        "A bullet level listing of the 5 job openings, with the suitable hyperlinks and detailed description about every job, in markdown format" 
    ),
#    output_file="relevant_jobs.md",
    agent=job_researcher
)

Step 4: Creating the Crew and Reviewing the Output

Now we attain the ultimate step the place we bundle the brokers and the duties so as throughout the Crew performance of crewAI. It has 3 parameters:

  • The brokers parameter lists the brokers within the order wherein they are going to be referred to as and executed.
  • The duties argument lists the duties outlined for every agent within the order of execution.
  • And at last, Verbose=True allows you to see the detailed output so you’ll be able to see what the brokers are doing.

Let’s run this.

crew = Crew(
    brokers=[resume_feedback, resume_advisor, job_researcher],
    duties=[resume_feedback_task, resume_advisor_task, research_task],
    verbose=True
)

And we lastly launched our agentic system with the kickoff performance.

  • crew.kickoff(inputs={…}): Begins the CrewAI execution, and takes in 2 inputs, resume and placement.
  • “resume”: res2: Helps you specify the resume for which the agentix system must work. In our case, we’re engaged on Anita’s resume.
  • “location”: ‘New Delhi’: Specifies the place Anita is in search of a job. And this will likely be New Delhi in our case.
result1 = crew.kickoff(inputs={"resume": res2, "location": 'New Delhi'})

Looks like our crew capabilities completely. Let’s print every agent’s output individually.

from IPython.show import Markdown, show

First, we’ll print resume_feedback agent’s output.

markdown_content = resume_feedback_task.output.uncooked.strip("```markdown").strip("```").strip()
# Show the Markdown content material
show(Markdown(markdown_content))

Then we print the resume_advisor agent’s output.

markdown_content = resume_advisor_task.output.uncooked.strip("```markdown").strip("```").strip()
# Show the Markdown content material
show(Markdown(markdown_content))
Build an AI Resume Review Agentic System with CrewAI

And at last, we print the research_task agent’s output.

markdown_content = research_task.output.uncooked.strip("```markdown").strip("```").strip()
# Show the Markdown content material
show(Markdown(markdown_content))
Build an AI Resume Review Agentic System with CrewAI

And there you will have it. Your totally purposeful resume assessment agentic system with CrewAI.

Additionally Learn: Automating Electronic mail Responses Utilizing CrewAI

Turning your CrewAI Resume Reviewer Agentic System right into a Net App

One attention-grabbing factor we will do with our AI-driven resume optimization system is constructing a web-application for it.

Right here’s the interface of the app I constructed:

Build an AI Resume Review Agentic System with CrewAI

We have now wrapped our code for resume assessment agent with CrewAI in Gradio and hosted the ultimate product on Hugging Face Areas which has a liberal free tier.

Right here’s the way it works:

  1. First, drop your resume in a PDF or Phrase doc. The identify of our candidate right here is Bruce Wayne.
  2. Subsequent, choose the popular job location for Bruce who’s our candidate. Let’s say San Francisco
  3. And hit Submit.

Since that is utilizing LLMs on the backend, GPT-4o-mini in our case, it’s going to take a while to judge your resume, give a rating, and suggestions.

And as you’ll be able to see, Bruce received a rating of seven/10. And he has obtained in-depth section-wise suggestions from the CrewAI agentic system. Together with that he additionally received the revised resume and even ideas for jobs in San Francisco. How superb is that this!

Build an AI Resume Review Agentic System with CrewAI
Build an AI Resume Review Agentic System with CrewAI
Build an AI Resume Review Agentic System with CrewAI

If you wish to replicate this CrewAI agentic system within the type of this web-application, you’ll be able to merely clone this repository or duplicate this house and alter the API key. Right here’s how that’s executed:

  1. First, click on on Settings after which click on on Clone repository within the dropdown.
  2. Then scroll right down to the variable and secrets and techniques setting.
  3. You’ll already discover the variables we created for the OpenAI key and Serper_Key. Merely click on on Change and add the API Key within the Worth. Then click on Save.

Additionally, you may get the code to construct this app from the CrewAI agentic system together with the Gradio code within the app.py file in recordsdata part of Hugging Face areas.

The press on app.py

Build an AI Resume Review Agentic System with CrewAI
Build an AI Resume Review Agentic System with CrewAI

Attainable Enhancements on the Resume Reviewer Agent

Like every other agentic system, there may be a number of scope for increasing the resume assessment agent we’ve simply constructed with CrewAI. Listed below are just a few tricks to tinker round with:

  • You possibly can construct a fourth agent that customizes the resume, primarily based on the job you choose.
  • You possibly can construct one other agent ultimately to generate a canopy letter personalized for the job you wish to apply.
  • You may as well construct one other agent that may enable you put together for the job you choose.

Additionally Learn: Tips on how to Construct an AI Pair Programmer with CrewAI?

Conclusion

Constructing a resume reviewer agentic system is a game-changer for job seekers in search of resume optimisation with AI-driven insights. This method effectively analyzes, refines, and suggests jobs primarily based on customized resume suggestions—all at a fraction of the price of premium resume optimizing companies. With CrewAI’s agentic capabilities, we’ve streamlined resume optimisation into an automatic but extremely efficient course of. However that is only the start! CrewAI is engaged on automating every kind of duties and bringing much-needed effectivity to all industries. It’s certainly thrilling instances forward!

Incessantly Requested Questions

Q1. What’s CrewAI?

A. CrewAI is an open-source Python framework designed to assist the event and administration of multi-agent AI techniques. Utilizing CrewAI, you’ll be able to construct LLM-backed AI brokers that may autonomously make choices inside an surroundings primarily based on the variables current.

Q2. Can AI repair my resume?

A. Sure! An AI agent just like the resume reviewer system we constructed utilizing CrewAI, can assist optimize your resume. It might even advocate the proper jobs for you primarily based in your {qualifications}, abilities, and placement.

Q3. What duties can CrewAI do?

A. CrewAI can carry out numerous duties, together with reviewing resumes, writing resumes, trying to find jobs, making use of for jobs, making ready cowl letters and extra.

This autumn.  In what format ought to my resume be?

A. As a way to use this resume reviewer agent, the uploaded resume have to be in both PDF (.pdf) or Phrase (.docx) codecs.

Q5. What AI mannequin is used to assessment resumes?

A. Our resume reviewer agent makes use of OpenAI’s GPT-4o-mini for textual content processing and Serper.dev for real-time job search.

Q6. How correct are the job suggestions supplied by the system?

A. The job suggestions rely on the standard of the resume and the AI’s means to match abilities with job postings. Utilizing Serper.dev, the system retrieves probably the most related and up to date job listings.

Q7. Do I want coding information to construct a resume assessment agent?

A. Fundamental Python programming abilities are required to arrange and modify the CrewAI-based system. Nonetheless, you’ll be able to clone a pre-built repository and replace the API keys to run it with out deep coding experience.

Apoorv is a seasoned AI and Information Science chief with over 14 years of expertise, together with greater than a decade centered on Information Science, Machine Studying, and Deep Studying. Because the Head of Coaching at Analytics Vidhya, he has spearheaded the event of industry-leading AI packages, together with programs on Generative AI, LLM Brokers, MLOps, and Superior Machine Studying, shaping the talents of 1000’s of pros.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles