As Salesforce continues to move toward AI-assisted development, Agentforce is emerging as a powerful tool that helps developers interact with their org metadata, objects, and configurations using intelligent prompts. When combined with Visual Studio Code (VS Code) and the Salesforce CLI, Agentforce enables a faster, more context-aware way to explore and build on the Salesforce platform.
This guide walks you through how to set up Agentforce in VS Code step by step, using the recommended Sandbox environment for safe experimentation. From installing VS Code and Salesforce Extension Pack to authorizing your org, enabling telemetry, and activating the Salesforce DX MCP server, this tutorial covers everything required to get Agentforce Vibes up and running smoothly.
Whether you’re a Salesforce developer, admin, or architect, learning to configure Agentforce in VS Code can significantly improve how you query metadata, validate objects and fields, and interact with your Salesforce org using AI-driven prompts; all without leaving your development environment.
Prerequisite
It is advisable to use Agentforce Vibe within the Sandbox environment.
Step-by-Step Guide to Set Up Agentforce in VS Code
Step 1: Download and install VS Code.
Step 2: Install the CLI from Salesforce CLI.
Step 3: Launch Visual Studio Code.
Step 4: On the left toolbar, click the Extensions icon.
Step 5: Search for Salesforce Extension Pack and click Install.
Step 6: In Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
Step 7: Type and select SFDX: Create Project With Manifest.
Step 8: Press Enter to accept the standard option.
Step 9: Enter the project name and press Enter.
Step 10: Select a folder to store the project.
Step 11: Click Create Project. You should see something like this as your base setup.
Step 12: In Visual Studio Code, open the Command Palette by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (macOS).
Step 13: Type and select SFDX: Authorize an Org.
Step 14: Press Enter to accept the Project Default login URL option.
Step 15: Press Enter to accept the default alias.
This opens the Salesforce login in a separate browser window.
Step 16: Log in using your Org credentials. If prompted to allow access, click Allow.
After you authenticate in the browser, the CLI remembers your credentials. Just follow these steps in VS Code or the Agentforce Vibes IDE.
Step 17: Select File > Preferences > Settings (Windows or Linux) or Code > Settings > Settings (macOS).
Step 18: Search for salesforcedx-vscode-core.telemetry.enabled to confirm that this Salesforce telemetry setting is on in your workspace. If the setting isn’t on, select the checkbox to enable telemetry.
Step 19: Next, search for telemetry, then choose ‘all’ from the dropdown menu for the Telemetry: Telemetry Level setting.
Step 20: Open a terminal and run sf config set disable-telemetry=false –global to enable CLI telemetry.
Step 21: Press Command+Shift+P on Mac or Ctrl+Shift+P in Windows to open the Command Palette, and run Developer: Reload Window.
By default, Agentforce Vibes extension is enabled in the desktop application and can be launched from your Salesforce org from the Set Up menu. Click the icon in the status bar to turn off Agentforce Vibes at any time.
MCP in Salesforce lets Agentforce connect directly to your Salesforce org, tools, and metadata.
Think of it as a live bridge that helps AI understand your org and build the right code every time.
Step 22: Enable the Salesforce DX MCP server.
Step 23: Enter Prompt.For Example:-
“Check whether Mask__c is a custom field on Account.”
“Does the object Invoice__c exist in this Salesforce org?”
Step 24: Validate Agentforce MCP Connection and Prompt Response
After entering your prompt in Agentforce Vibes, verify that Agentforce successfully connects to your Salesforce org via the MCP server.
- Confirm that Agentforce returns a valid response based on your org’s metadata
- For example:
- If the field exists, Agentforce should confirm the object and field details
- If it does not exist, Agentforce should clearly indicate that the metadata was not found
- Ensure there are no authentication or MCP connection errors in the VS Code output or terminal logs
If the response is accurate, your Agentforce setup in VS Code is complete and ready for use.
You can now use Agentforce Vibes in VS Code to query metadata, validate objects and fields, and assist with Salesforce development tasks using AI-powered prompts directly within your development environment.
Demo Video
Conclusion
Setting up Agentforce in VS Code is a foundational step toward embracing AI-powered development within the Salesforce ecosystem. By completing this setup, from installing the Salesforce CLI and Extension Pack to enabling telemetry and configuring the MCP server, you create a direct, intelligent bridge between Agentforce and your Salesforce org.
Using Agentforce Vibes in a Sandbox environment ensures you can safely explore org metadata, validate custom objects and fields, and test AI-assisted queries without impacting production data. With prompts like checking whether a custom field exists or verifying an object in your org, Agentforce streamlines tasks that traditionally required manual navigation or complex queries. You can also create a custom Agentforce agent.
As Salesforce continues to expand Agentforce capabilities, mastering this setup in VS Code positions you ahead of the curve, allowing you to work smarter, reduce context switching, and build with greater confidence. Once configured, Agentforce becomes more than a tool; it becomes a reliable development companion for modern Salesforce teams.
Transform your processes with tailored Salesforce services. Let our experts help you scale smarter and faster.
No Data Found.