Build Better Agents: Overlapping Topics
I recently attended a “Build Better Agents” session hosted by Salesforce, and it covered some really important ideas for anyone working with Agentforce.
We got into topics like:
Latency
Unexpected responses
RAG optimization
Overlapping topics
Optimizing instructions to improve responses and how best to architect deterministic versus non-deterministic logic
It sparked a lot of thoughts for me, both from what was shared and from my own experience building agents hands-on. So I’m kicking off a short series to unpack some best practices and lessons learned.
The first topic I’ll cover is overlapping topics, but before we dive in, I want to take a step back. If you’re designing agents, it’s critical to understand the lifecycle of a turn, what’s actually happening behind the scenes when a user interacts with an agent.
Note: I highly recommend bookmarking Salesforce's published Agentforce guide: link - I reference it often and try to abide by some of the standards discussed in this resource
Reasoning Engine Process Steps
A “turn” is a single interaction between a user and a large language model, one prompt in, one response out. As everyday users of LLMs, we’re used to how seamless this feels. But under the hood, there’s a lot of complex logic at play to interpret that input and generate a meaningful response.
If you're building or optimizing agents, understanding this behind-the-scenes flow is critical, it’s what separates agents that feel helpful from those that feel clunky or inconsistent.
The diagram above outlines how the Agentforce 2.0 reasoning engine works. While it focuses on the Service Agent template and includes a few extra steps for escalation, the overall flow is similar for Employee Agents too. Here's a quick summary of what’s happening behind the scenes: The user kicks things off by prompting the agent, this starts the turn.
The agent identifies the relevant topic (we’ll cover how that works shortly).
Based on the topic and input, the agent decides whether to respond directly or run an action.
If actions are needed, the agent executes them, and can loop through multiple if necessary.
Once the right info is gathered, the agent sends a final response to the user, closing the turn.
You can actually watch this reasoning unfold step-by-step inside Agent Builder, which makes it easier to troubleshoot, optimize, and improve your agent logic over time.
Topic Overlap / Classification
Whenever someone tells me their agent “isn’t acting right,” the first question I ask is: “Is it identifying the right topic?”
More often than not, that’s where the issue starts. Topics are the first critical decision point in the reasoning engine. If the agent misclassifies the topic, everything downstream, actions, logic, instructions can break or behave in unexpected ways.
That’s why overlapping topics can be so tricky. If multiple topics are too similar, or not clearly differentiated, the model may latch onto the wrong one, especially when the user input is vague or phrased in an unexpected way. And when that happens, even the best-designed actions won’t fire the way you want.
What Determines What Topic Is Selected
The Agent chooses a topic based on two things: the topic name and the classification description. That’s it. It doesn’t factor in your topic’s scope, instructions, or actions when deciding which one to select.
Because of this, your topic names need to be clear and action-oriented. Use recognizable language that starts with a verb like “Provide Order Status,” “Create New Case,” or “Answer Billing Question.” Make it obvious what job the topic is meant to handle.
Your classification description is where you should include examples of how a user might ask for help. Think of keywords or phrases they might use, and be sure each topic’s description is distinct from the others.
Solving for Overlap
If you’re seeing topic overlap, here are a few things to try:
Make the topic name more descriptive and specific
Add sample utterances to your classification description
Scan your topics for similar phrasing and tighten up the language
Avoid using vague or interchangeable terms across topics
But even with perfect naming and descriptions, some overlap is inevitable. Let’s say you're building a Service Agent for a travel resort. You might have one topic for room reservations and another for booking experiences. Even if those topics are well crafted, users might just say, “I want to make a reservation.” The agent won’t always know which one they mean.
In cases like this, I like to build in a follow-up instruction that prompts clarification, something like: “Ask the user if they’re trying to reserve a room or book an experience.”
Once the user responds, that added context in the conversation history helps the agent make a better topic selection on the next turn.