Building a simple coaching agent
Leverage your data and the Talent Agent SDK to build an employee coaching agent.
One of the most common requests our friends in talent management get asked to do is to help coach someone through a difficult conversation or to upskill as a leader. While this is often one of the most enjoyable parts of the job, it can be challenging to provide the sort of coaching a manager or employee needs without the full set of data. Additionally, it can be helpful to roleplay some of the conversation beforehand to ensure that they have all the talking points down.
Fortunately, this is where the Talent Agent SDK and the intersection of HR and IT really shines. Let's take a look at building a quick coaching agent in Slack that helps solve this problem.
Prerequisites
We're going to let the agent SDK do most of the heavy lifting here and pull in the HRBP agent and the HR Analyst agent to help us out. For simplicity, we'll also rely on the Slack integration built into the SDK and this tutorial presumes you already have that setup.
First clone the Agent SDK starter from https://github.com/peoplelogic/agent-sdk-starter
Then, let's enable the HRBP and the HR Analyst within
src/main/resources/application.properties:
peoplelogic.agent.HRBusinessPartnerAgent.enabled=true
peoplelogic.agent.HRAnalystAgent.enabled=trueSetting up your coaching tool
To add the coaching functionality to the HRBP agent, we need to create a new Tool. If you recall from the Getting Started guide, we need to do this through a new @PeoplelogicTool component. We're also going to wire in several of the other SDK components that we'll need to work with.
@PeoplelogicTools("hrbp-coaching-tools")
public class HRBPCoachingTools {
@Autowired
PersonalContentRetriever personalContentRetriever;
@Autowired
@Qualifier("apmContentRetriever")
ContentRetriever apmContentRetriever;
@Autowired
CustomerKnowledgeContentRetriever customerKnowledgeContentRetriever;
@Autowired
ChatMemoryProvider chatMemoryProvider;
@Autowired
ChatModel chatLanguageModel;
@Autowired
HRAnalystAgent analyst;
HRBusinessPartnerAgent agentWithFiles;
}So far, so good - we've brought in components that help us fetch data from the organization and also uploaded through the conversation and we've brought in some core components like the chat model and the memory so we can setup some overrides of our agents. But what good is a coaching agent, without the coaching prompt! Let's add the new prompt just below the agentWithFiles definition:
Quite the prompt, but no-one ever said coaching was easy! With that out of the way we just need to adjust the HRBP agent a bit. You can see that we autowired in the HRAnalystAgent with its default configuration - that's because we want to call it with all its available tools. We need to adjust the HRBP so that when we call it from inside our tool that it doesn't use any other tools - just the knowledge we're giving it. Add this method at the bottom of your class:
With that out of the way, we can get to the actual work - let's build our tool.
Building the coach
To build the actual coach, we'll need to create a method that we can have the SDK call when it wants to help someone with leadership coaching. Add the method below in to your coaching tools class.
As you can see, we're giving the tool both a very detailed description AND a detailed name so that the LLM has as much information as possible to call our tool. We're also passing in both required (name and general topic) and optional inputs such as recent reviews, OKRs and even the employee's job description.
Now let's take a look at how we might use all this information:
We'll break this into a few parts for simplicity. First, we're going to setup the basic instruction to go with our earlier system message - remember, every call to the agents needs both! Then, we need to do some cleanup of the additional inputs and ensure those have actually been uploaded. Finally, we're going to call the HR Analyst and let it work its magic analyzing any reviews, surveys or OKRs and include those in what we want to pass to the coaching tool.
All that's left is to handle the Job Description file and then ship all this information off to the HRBP agents that we setup earlier. Again, we're doing some basic cleanup and safety checking in case the job description was provided and then we call the HRBP agent with everything we've pulled together so far and send the result back to the LLM!
The coach in action
Now that we've written the prompts, configured the agents, built the tools, we just need to tell the built-in HRBP agent about your new tool. Let's go back to src/main/resources/application.properties and add the following:
That's it! Deploy your agents or load the application locally and then let's load up our Slack application and see if the tool works.
Pretty impressive! The agent incorporated the files we uploaded, gave us great conversation starters based on the recent reviews and goal progress, and when prompted for specifics even took the initiative to leverage another tool that the HRBP has available, creating a new IDP (Individual development plan) to use in the conversation. This will all be a big help for your friends in HR!
Future improvements
While this example is a great one, there's a few places that we could definitely improve moving forward. For example:
Including the Universal Talent API so that there's no need to upload files.
Feel free to suggest other improvements as you work through the tutorial and as always, happy coding!
Last updated
Was this helpful?
