Headless Development Tools
MCP Solutions
Agentforce Vibes
Plugins and Skills
Build and Deploy an Enhanced Chat Agent
Ground an Agent with Agentforce Data Libraries
In this headless example, you develop an agent, ground it with Agentforce data libraries, test, and activate it.
Use your preferred AI assistant, such as Claude Code or Agentforce Vibes.
Complete all the prerequisites in Headless Examples.
In your terminal, run sf org list. If you see the headless org alias in the list, you’re successfully authenticated.
This example also requires:
Copy and paste this prompt into your AI assistant:
1Create a Q&A agent called "QnA".Your AI assistant creates the agent. We’re not ready to publish and activate it yet.
Agentforce Data Libraries (ADL) enhance the accuracy of AI features, such as Agentforce agents, by connecting them to your trusted data sources. Data libraries use unstructured or semi-structured data. They convert large sets of information from the web, documents, or text fields into useful, searchable information.
Download these files to your filesystem so that you can use them to ground the agent.
Create two Agentforce data libraries: one file-based data libary and a second data library based on Salesforce Knowledge articles.
Copy and paste this prompt into your AI assistant:
1Create an Agentforce data library. Add the order-tracking.txt, product-troubleshooting.txt, and technical-support.txt files to the data library. Create a second data library and link Salesforce Knowledge articles from the Product category to the data library.Your AI assistant creates the two data libraries. A data library can’t support multiple data sources so we need two data libraries, one for the files and one for the knowledge articles.
Wire the two new Agentforce data libraries into the QnA agent.
Copy and paste this prompt into your AI assistant:
1Ground the QnA agent with the two new Agentforce data libraries.Your AI assistant connects the data libraries to the agent to improve the accuracy of agent responses.
Copy and paste this prompt into your AI assistant:
1Test the agent with realistic customer scenarios and interactions.Your AI assistant generates a test plan and executes the tests. If any tests fail, review the root causes returned by your AI assistant and ask it to apply the recommended fixes.
These tests aren’t saved to a regression test suite. That step is outside the scope of this example. To build a test suite, see Testing API Developer Guide or the Agentforce Testing Center in Salesforce Help.
Note
Copy and paste this prompt into your AI assistant:
1Commit and activate the agent in the org.Your AI assistant publishes and activates the agent.