How Salesforce Built Their Harness for 100k Developers on Mastra

Salesforce built a coding IDE for 100,000 developers building on its platform. Under the hood, it runs two agent harnesses — the Claude Agent SDK for Anthropic models, and an open-source Mastra harness for everything else.

Agentforce Vibes and the Salesforce ecosystem

At any large company, implementing Salesforce means writing a ton of custom code and configuration. Salesforce executes code written in a language called Apex, Salesforce's proprietary language whose syntax is connected directly to the org's live schema, and there are around 100,000 active Salesforce developers who work at customers and agencies doing this work.

These days, a lot of what they're building is agents that read and act on a company's live CRM data, e.g. update records, or kick off workflows. They build those agents on Agentforce, Salesforce's native AI agent platform. If you've seen Matthew McConaughey in a commercial getting wet in the rain, he was advertising Agentforce.

Many Salesforce developers writing code for Agentforce or Salesforce are using Agentforce Vibes, a coding IDE the Salesforce team built for the community.

Vibes reads the organization's context before it generates anything, runs the resulting Apex through Salesforce's own compiler and test and analysis tooling, and can go back and fix what breaks. On top of that, it's wrapped in Salesforce's own governance and security controls.

Running the agent loop with Mastra harness and the Claude Agent SDK

The original release of Agentforce Vibes ran on Cline, an open-source, model-agnostic coding-agent extension for VS Code. In August, Salesforce launched an update to the Agentforce Vibes extension. The headline change was what runs the agent loop. The goal was to make it easy for users to switch models if they need to, whether it's because of an internal policy or external limitations.

So now, two production agent harnesses ship from a single package, @salesforce/sfdx-agent-sdk, and the extension picks between them per model, at runtime. Devs don't configure anything. They choose a model, and the right engine runs underneath it.

Claude models run on the Claude Agent SDK, the same harness that drives Claude Code. Everything else in the picker runs on the Mastra harness:

"The Mastra harness is an open-source agent framework that Vibes runs as the default for non-Claude models. Open source means the plumbing is auditable and when Mastra ships an improvement, we inherit it." — Jeff Douglas, Product Management Director, Agentforce Vibes at Salesforce

Building with Mastra as the foundation

The Mastra harness is built on Mastra's core runtime, using Mastra's memory system for an agent's working memory, its MCP client to talk to MCP servers, and its SQLite-backed store to persist state locally. Mastra is basically the engine that comes with various building blocks and Salesforce built on top of this engine, instead of writing a framework from scratch.

Here's what they built:

  • Reaching real providers: Mastra needs to be told how to call a specific model API. Salesforce wrote five separate implementations for that (Anthropic direct, Anthropic through Salesforce's own Bedrock gateway, OpenAI, OpenAI's Responses API, and generic OpenAI-compatible endpoints). Each one converts a generic request into that provider's API shape, handles specific auth format, and re-checks Salesforce's connectivity/credential info on every call.
  • Translating Mastra's events: When an agent runs, Mastra emits an internal stream of events (text arriving, a tool getting called, etc.) in its own format. Salesforce wrote a converter that turns them into the shape their tooling expects. It also logs anything that isn't recognized.
  • Managing tool approvals: It handles pausing an agent mid-run while it waits on a human to approve or deny a tool call.
  • Bridging externally-run tools: Some tools are executed by the VS Code extension itself, not by Mastra. Mastra naturally pauses an agent run while a tool's function is still pending, so Salesforce built a small mechanism that holds that pause open until the extension hands back a real result, then lets Mastra resume automatically.
  • Persistence: Agent and conversation state is stored locally via Mastra's SQLite-backed store, tied to whichever project folder is open, so it survives closing and reopening VS Code.

Optimizing skills and MCP tool catalog searches

The Mastra harness also solves a problem that's not related to choosing the model. Agentforce Vibes ships over 100 Salesforce-built skills. If you pull all of them into the system prompt at once, the developer will pay for it right away. Instead, Mastra's skill-search processor holds them back until they're needed. The agent searches for the right skill and loads it mid-conversation via search_skills / load_skill meta-tools. The same mechanism handles a large MCP tool catalog, surfacing a tool only when it's relevant to the ask. That's a huge cost optimization.

What's next for Agentforce Vibes

The two-harness engine is already the default for all ~100,000 SFDX developers on Agentforce Vibes. Salesforce says more is coming: more models in the picker, deeper integration across the Agentforce platform, and more built-in MCP servers.

The Mastra team has been here for the journey, attending TDX, Salesforce's developer conference, to meet with the Salesforce developer platform team. We also keep a shared Slack channel open to stay in sync as Salesforce keeps developing Agentforce Vibes.

More reading:

Product Marketer & Content Engineer
Articles by Patrycja
Share:

Start building today

Quickstart