Artificial Intelligence / Admins / Consultants

Ultimate Guide to Creating AI Agents in Salesforce

By Ian Gotts

Branded content with Elements.cloud

Salesforce’s launch of Agentforce has everyone talking about the potential of agents. But there are many unanswered questions: how do I assess if my organization is ready? How should I think about building agents? What agents deliver the best ROI?

The article is based on our experience building multiple agents for our organization and, working with Salesforce, developing a repeatable implementation approach.

The AI Mindset

The rapid advancements in AI models and the art of prompting have revolutionized what AI can accomplish. We’ve been harnessing the power of AI since the launch of ChatGPT almost two years ago. It’s now deeply integrated across every corner of our business – from product management to marketing, business excellence, IT, and even finance. And we’re not stopping there; we’ve embedded AI in multiple areas of our Elements.cloud platform.

What’s been fascinating is the cultural shift that’s emerged in Elements.cloud. Instead of fearing AI or being dismissive of its capabilities, our teams have embraced it with a mindset of, “why not?” or “what if we tried?”. Every task is now seen through the lens of “can AI assist with this?”.

Enter the AI Agent

You’ve probably encountered those bots on websites that try (often in vain) to answer your simplest questions. These bots operate on predefined decision trees, trying to guide you to the right resource. The result? Experiences that range from mildly helpful to “press one for confusion, press two to get stuck in a loop”.

An AI agent is able to have a conversation with the user and is equipped with resources – data, automated workflows, and even guardrails that tell it when to pass things off to a human. We need to think of an AI agent as that eager, fresh-faced new hire who’s just joined your team. Yes, they need to be taught about your organization, its culture, policies, and the tools at their disposal. But let’s not forget, they’re also your brand ambassador, interacting with thousands of customers. If they’re not ‘on-brand’, the cost-cutting pursuit of automating customer interactions could backfire spectacularly.

So, your AI agents are not just about reducing costs; it’s about delivering an experience that aligns with who you are as a company.

JTBD: Jobs To Be Done

Initially, AI agents will handle the simplest transactional tasks. A critical element of their success will be the seamless handoff to a human when necessary. Over time, the best AI implementations will set new standards for what customers expect from their interactions. The quality of customer service isn’t determined by the skills or salary of the person on the other end of the line, it’s about the effectiveness of the AI agent – how well it’s been instructed, how well it understands processes, and how clean the data is.

AI agents are poised to become a significant competitive differentiator. A poor AI experience can easily push customers toward a competitor that has mastered AI agent implementation. Organizations that have not exploited agents for employee support – sales, HR, finance, etc. – will lose in the war for talent.

What Is Agentforce?

Salesforce launched Agentforce which enables agents to be developed that have access to your org metadata and data from external systems via Data Cloud. This means that every Trailblazer can be a part of the new agentic revolution.

The diagram below shows what Salesforce has built over the last 25 years:

The Agent is launched from within Salesforce, an experience site, an external website, or triggered from Apex or a Flow.

The user engages with the agent. The Atlas Reasoning Engine interprets user input and reads the Agent fields and Topic Classification Description to decide which Topic to use.

Once it has chosen the Topic, it looks at the Topic Scope, Instructions, and Action Description fields associated with the Topic to decide what to do. The Action is delivered by using the linked metadata which could be Apex, a Flow, or a Prompt Template. (Other metadata types will be added over time.)

The power of Agents is the reusability of metadata, just like in other areas of the Salesforce platform. The diagram below is an ERD of the Agent-related metadata and how it connected with the core Salesforce platform and Data Cloud. Whilst this looks complex it is all very manageable, and Salesforce has provided a simple step-by-step approach to design, build, and deploy Agents.

Agent

Think of an agent as a ‘domain’ – it is a collection of Topics. A typical Agent is “Customer Support” or “Employee Support”. For the future, think about the broad capabilities of the Agent but start with only one Topic to keep the scope tight. Over time you can add more Topics to give the Agent more capabilities.

So in summary, an Agent…

  • Covers a broad scope, e.g. Customer Service.
  • Supports a function or business unit.
  • Has scope that is determined by its Role – i.e. where it is launched from.
  • Has other information fields that determine its behavior, e.g. tone of voice.
  • Has one or many Topics, but should not have more than 15 Topics.

Topics

Think of a Topic as the “Jobs To Be Done”, i.e. the actions that are currently delivered by a human but that you want to ‘agentify’. This may be by an Agent or an Agent in partnership with a human.

In principle, a Topic…

  • Has a tight scope covering a process with an outcome”.
  • Has a description and scope that helps the Atlas Reasoning Engine decide when to use the Topic.
  • Is described in one or more UPN Process Diagrams.
  • Can have one or many Actions and Instructions.
  • Should not have more than 15 Actions.

Actions

An Action is how an Agent can interact with Salesforce to achieve its goal, based on its understanding of the Action from its description. Actions are reusable and are intended to be shared across Topics. Each Action is delivered through a single Apex, Flow, Prompt Template.

Here are some considerations:

  • Actions should be narrowly scoped so that the Agent’s behavior is easy to predict.
  • Ideally, reuse existing metadata, but ensure that the metadata only delivers the expected outcome for the scope of the Action.
  • The metadata descriptions are copied into the Action but can be updated. These descriptions inform the Atlas Reasoning Engine when and how to use the Action so are written with natural language.

Instructions

The Instructions are stored with the Topic and they are rather like prompts as they are written in natural language. The Atlas Reasoning Engine uses the Instructions and Action descriptions to plan how to deliver an outcome.

When writing Instructions, you must consider that they…

  • Are part of the Topic and not a separate metadata item.
  • May reference Actions directly.
  • Are used to provide guardrails for the Agent, along with the Topic description and scope.
  • Change an Agent’s behavior based on the order.

Metadata

Metadata is the secret sauce of the Salesforce platform and is how the core platform – Data Cloud and Agentforce – are tightly integrated. The metadata that an Action uses are Apex, Flow, and Prompt Templates, so they should be familiar to Trailblazers who are becoming Agentblazers. Now that Flow is so powerful there are fewer situations when Apex needs to be written, which means that building Agents is low-code development.

Implementation Approach: Repeatable, Proven, Flexible

Building Agents will be iterative. The initial Agent is deployed with just one Topic. You can then start extending the capabilities by adding Actions to Topics, and Topics to Agents.

We’ve developed a proven, repeatable approach that has been documented as a UPN process map that is freely available to download. You can modify it to dovetail with your implementation and governance processes. It has documentation templates, design patterns, examples, and AI prompts to accelerate the development.

Implementation Approach: documented as UPN diagram

Setup

There are several licenses and permissions you need to run Agentforce, including Data Cloud. These are all covered in the Trailhead and Agentforce workshops. Don’t underestimate how long this takes to get right.

Use Cases

In the Use Case phase, you brainstorm the potential use cases based on their impact and potential benefits for the business. You need to educate your management on the ‘art of the possible’ but at the same time, you need to manage their expectations about the speed of delivery – especially with the first use case.

Select the easiest and simplest use case for the first one to implement. Here are a couple of approaches you can use to identify use cases:

  • Look at your existing processes, if they are documented, and work out which could be easily delivered by an Agent. AI can help you document your processes.
  • Look at processes that are delivered by your bots today that could be dramatically enhanced by an Agent.
  • Look for inspiration from the Salesforce library.

The outcome of this phase is the chosen use case.

Design

Time spent in design will save you 10x in rework making changes to an Agent that is in production. Process diagrams are the key design document for the Agent. The design phase can be short, but process thinking will ensure that you’ve considered all the angles.

“We have been promoting the whole notion of design thinking and process thinking. When it comes to AI, having the mindset of process pattern thinking, I think it’s going to be really critical, especially as we are held accountable to having ROI at the end of the day with improving these technologies to improve processes.”

Juan Perez, CIO of Salesforce

Our first Agent was allowing employees to query HR Policies based on their location, which was relatively straightforward. Our second was more complex, booking PTO for an employee.

There are rules about planning PTO; you can’t exceed your allowance, you shouldn’t book weekends or your local country’s public holidays, etc. The process identified that to make the agent work we needed to update some metadata, create some new metadata, and restructure some of our policy documents. None of this was impossible, but it was far easier to get right before we started building the Agent as it affected how we wrote the Instructions and Actions.

Topic UPN diagram, drawn using Elements.cloud

The UPN process diagram shows the capabilities of the Topic, and if you need more clarity on an activity step, you can drill down to a lower-level diagram. That is the power of UPN.

If you operate in a regulated industry you will need the UPN process diagram to show the processes that the Agent is delivering, and how it supports compliance. The diagram and their notes can be signed-off and version-controlled so that you build up a history of the changes – the diagram and the attachments. This will prove vital as the Agent iterates over time.

Once you are clear on the process steps, AI can write the first draft of the Instructions and Actions. The Instructions and Actions are attached to each activity step with a change history – this is critically important. As we all learn how to make Agents deliver great results consistently, the Instructions and Actions descriptions will keep evolving. Tracking what works, and what didn’t in the past makes troubleshooting and testing so much easier.

You can update the Instructions and Actions in the UPN diagram. AI can run a consistency check to ensure that you have not introduced conflicts, duplications, or gaps. It can also suggest where you can streamline the process.

For building our own Agents, we’ve realized that you need to think through the process in far more detail than you would if a human were delivering the process. The AI agent doesn’t have the company/contextual common sense. It only knows what you’ve told it about. You need to be far more explicit about the rules and guardrails.

For the Agent to deliver the Actions, you may also need to build or modify existing metadata – Apex, Flow, Prompt Templates. If you are able to reuse metadata, then make sure that it is documented, you understand exactly what it does, and you are happy to let the Agent loose using it. AI can write user stories for this work, along with acceptance criteria for testing.

Again, though this all sounds time-consuming, it is not. Mapping the process can happen very quickly, and the UPN diagram is a great way of accelerating executive buy in, and sign-off from your security and compliance teams.

Build and Deploy

AI can create the build spec for the Agent, its Topics, Instructions, and Actions from the UPN diagram. The better the analysis and UPN diagram in the Design phase, the better the Agent, and the better the user stories define the metadata you need to build or existing metadata you need to modify.

Because building an Agent is so fast, you can iterate quickly. As you test the user input and see how the agent responds, you will need to make changes, especially as we are all still learning how to write Instructions and Actions to get consistent results.

Our experience is that some changes are by tweaking instructions, which you can do in Agent Builder, but other changes require an Instruction to be turned into Actions, particularly if you want to be prescriptive. As this may also change the logic, it is quicker to go back to the UPN process diagram and design it there rather than trying to make the changes directly into Agent Builder. An added benefit is you have up-to-date documentation and version history.

The power of this approach is…

  • Speed: Build spec is generated for Agent Builder.
  • Accuracy: The Agent reflects the process.
  • Control: The UPN diagram is the backup of the Agent design.

When the Agent is built, the metadata is visible via the Metadata API. That means it is in the Elements.cloud metadata dictionary and all the dependencies are visible. With the reuse of metadata, it is critically important that you know the impact of changing something.

A dependency tree in Elements.cloud metadata dictionary.

For example, you want to change a Flow that supports an internal process. That same Flow is also used in three Topics, as you can see from the image above, so could impact the Agent’s behavior. Or worse, the Agent will ignore it and come up with a workaround that you wouldn’t even know it was doing.

Repeat after me: dependencies and documentation.

“For all of those of you who have been fastidiously documenting…. You are done. And for the slackers out there, you have another reason to add descriptions. You give a description to an action, just like you would introduce it to a colleague. That teaches Einstein. Let’s give it up for documentation. I love it.”

John Kucera, SVP Product Management, Salesforce

Operate and Monitor

The impact of consumption pricing is a source of debate, it is a fundamental shift. But less has been thought about in terms of monitoring. This is no different from supervising a team of call center agents, except you have far more granular data on performance. Every conversation between the Agent and a user is logged in Data Cloud.

Monitoring the effectiveness of the Agent, and the handoffs to a human will help scope the additional capabilities to be added to Topics, or new Topics that need to be added to the Agent. It also means you see where to train and update the Agent.

Armed with this data you can evaluate the ROI against your success criteria. That means you can understand your monthly bill, but also forecast future usage and savings. That will give your executive leadership the confidence to double down on AI agents.

Success Secrets

1. Start Small, Go Big

Focus first on Agents in narrowly scoped use cases to build experience. This could be customer-facing support sites or employee-facing business processes. The learning you get from this first Agent is as important as the ROI. You need to build in the feedback mechanisms so that you get early warning on issues and you need the ability to respond quickly, particularly if the Agent is customer-facing.

2. Go Slow to Go Fast

Agentforce will deliver results faster if you have a mature implementation approach; process-led change, data governance, and metadata management. Use the first agent to build a strong foundation, this will accelerate subsequent Agent use cases.

“We took four days to build our first Agent because we took time to get the approach right. The second, more complex agent took less than five hours.”

Adrian King, Founder and CTO, Elements.cloud

The key principles are:

  • Agentforce is a process-led implementation: Don’t start building until you are clear on the process in detail.
  • Strong data governance is key: Data quality and data governance go hand in hand. Data is everything the agent uses; customer data, knowledge documents, metadata descriptions, etc.
  • Metadata is how agents know your business: Metadata documentation used to be an afterthought – it is now used to drive agent behavior.

3. It All Starts With Process

The initial Agents are replacing or supporting business processes that are currently delivered by humans. Those processes need to be clearly defined down to a level of detail which means you understand how the agent can be built – the devil is in the details.

Don’t think that the process mapping will slow down the delivery of an Agent. The process diagram can be created very quickly – the first draft could be drawn from AI by looking at your org, existing diagrams, or even the text from a transcript.

If you don’t draw the process diagram, you will take far longer to deploy an Agent due to the constant rework as you discover things you have overlooked. Building an Agent using the Agent Builder is really fast, once you know what you are doing. But if you build the wrong thing, reworking and iterating your way to an acceptable Agent will take longer, knock your confidence, and lose executive support.

Take the time to plan.

4. Agents Can Help Build Agents

Elements.cloud provides the design documentation and metadata insights that are the foundation for exceptional agents. We’ve designed a repeatable implementation cycle with documentation templates that have enabled us to use AI agents to accelerate the implementation cycle.

AI agents can…

  • Draw process maps.
  • Highlight areas that could be ‘agentified’.
  • Write Instructions and Actions.
  • Check on conflicts between Instructions, Actions, and your guardrails.
  • Write user stories and acceptance criteria.
  • Identify metadata that could be reused.
  • Build Agents.
  • Create training and testing content.

“Using a process-led approach we went from zero to a working Agent to support staff around HR Policies in less than two weeks from Agentforce going GA. This included designing and documenting the approach and building AI Agents to accelerate it.”

Jack Lavous, Head of Business Excellence, Elements.cloud

AI can get you 80% of the way there, dramatically reducing the time to build an Agent. But your knowledge of your business, your needs, and your expected outcomes will be required to validate and refine the results. Business analysis is the new superpower, as discussed in this roundtable.

5. Avoid Data Cloud Complexity

Data Cloud is required for every Agentforce implementation because that is where the tracking data is stored. However, you don’t need to implement Data Cloud unless you want to pull data from external systems and make it available to the agent via Apex, Flow, or Prompt Templates.

If your Agent is using unstructured data – support articles, policy documents, contracts – then it will need to use the Data Cloud vector database and Prompt Templates to query it. This is a straightforward use case.

Based on our experience of implementing Data Cloud, we’ve written a series of ebooks and presented them at Dreamforce, which is available on Salesforce+.

Summary

Agents are as disruptive to the delivery of apps and their underlying business models as the shift from on-premise to cloud was over 20 years ago. The early cloud use cases were limited and they did not give us any insights into what was going to be possible. It feels like the agents are following a similar path, except it is all happening so much faster.

Those organizations that are best placed are already in good shape; with well-understood processes, strong data governance, and effective metadata management. But they need to lean in and explore the ‘art of the possible’. No organization can afford to use compliance, data quality, or risk as an excuse to sit on the sidelines. The future winners have already started; they are piloting, experimenting, and learning – and they are accelerating away from the pack who may never catch up.

If you want to dig deeper into Agents, explore our Ultimate Guide to Creating Agents eBook and get access to the approach and templates.

The Author

Ian Gotts

Founder & CEO Elements.cloud : Salesforce UG co-leader, customer & evangelist since 2002 : Author : Bass player : Speaker... bit.ly/IGshowreel

Leave a Reply