- SalesforceChaCha
- Posts
- ๐ Where Should an Agent Actually Execute? ๐บ
๐ Where Should an Agent Actually Execute? ๐บ
LOCATION, LOCATION, LOCATION

Good morning, Salesforce Nerds!
Your agent can run inside Salesforce.
That sentence ends too many architecture reviews. ๐ฏ
โCanโ is a capability. โShouldโ is a decision.
Architects get paid for the second one. ๐ฐ
Every enterprise now asks where the agentโs reasoning and actions should live. Traditional application design never made you pick a home for software that thinks. ๐ง
Choose badly and you pay in security gaps, integration sprawl, latency, cost, and maintenance. Choose well and nobody notices, which is the architectโs version of applause. ๐
Not every problem needs an agent, either. A Flow that works is not a failure of imagination. ๐
This issue gives you a framework for the choice.
Five ideas, one argument: location is architecture.

TABLE OF CONTENTS
๐ Where Should an Agent Actually Execute? ๐บ
HOME FIELD VS. AWAY GAME
NATIVE OR EXTERNAL EXECUTION
Agentforce earns its place when the work lives in Salesforce. Records, flows, Apex actions, and sharing rules sit one hop away. ๐
Native execution gives you a short path to data and a security model you already govern.
The agent acts through a Salesforce user, so field-level security and sharing rules still apply. The Einstein Trust Layer adds masking so sensitive fields stay out of prompts. ๐ก๏ธ
Latency favors native too. No network hop separates the reasoning from the record it edits.
Then the meter starts. Flex Credits price an agent action at 20 credits, about 10 cents at list, so a chatty agent earns a budget line. ๐ธ
Default to native for Salesforce-centric work. Leave only when the job demands it, not when a demo dazzles.
External execution wins when the job spans systems.
Think ERP, ticketing, a data warehouse, and a model you picked yourself. A hyperscaler runtime or custom orchestrator hands you control over models, tooling, and observability. ๐งฐ
The price of that freedom is ownership of identity, retries, and uptime. Freedom has a pager. ๐
DIVIDE AND DONโT CONQUER
HYBRID WITHOUT THE HANGOVER
Most landscapes end up hybrid. The trick is dividing duties without welding systems together. ๐ง
Give each layer one job.
1๏ธโฃ Salesforce owns customer data and business process.
2๏ธโฃ Middleware owns routing and API governance.
3๏ธโฃ The external agent owns cross-system reasoning.
A practical split: Agentforce handles the customer conversation, an external agent reconciles inventory and pricing, and middleware brokers the calls. ๐งฉ
Protocols loosen the weld. MCP gives an agent a standard way to call tools. A2A lets one agent delegate work to another agent that reasons on its own. ๐
Salesforce supports both through Agentforce and MuleSoft, though some pieces have carried beta labels so besure to check release status before you commit a roadmap. ๐
Coupling hides in the details. If Agent A needs Agent Bโs internal prompt format, you built a monolith with extra steps. ๐ชข
Define handoffs by outcome and payload, never by internals. Then you can swap any layer without a rewrite.
WHO GETS TO SAY YES
PARTIAL SUCCESS IS FAILURE
TRANSACTIONS DONโT SPAN SYSTEMS
Salesforce gives you a transaction. Your ERP gives you a different one. Nothing gives you both. โ๏ธ
An agent that updates an Opportunity, calls billing, and then times out has created a crime scene.
Plan for it. ๐จ
Ask one question for every step: what happens if this one fails after the last one succeeded?
Long-running work belongs off the synchronous path. Queue it, track its state, and let the agent check back. โณ
Retries demand idempotency. Send the same request twice and the downstream system must do the work once. ๐
// Conceptual: stable idempotency key, bounded retries, human escalation
public class BillingSyncJob implements Queueable, Database.AllowsCallouts {
public void execute(QueueableContext ctx) {
String key = 'opp-' + oppId + '-v' + version; // same key on every retry
HttpResponse res = BillingClient.post(payload, key);
if (res.getStatusCode() >= 500 && attempt < MAX_ATTEMPTS) {
System.enqueueJob(new BillingSyncJob(oppId, version, attempt + 1));
} else if (res.getStatusCode() >= 400) {
ErrorLog.record(oppId, res); // park it for a human
}
}
}Think in sagas: a chain of steps where each step has an undo.
Failure needs a plan. Compensate, park the work, or escalate to a human. Pretending failure cannot happen is not on the menu. ๐งฏ
PRINCIPLES BEFORE PLATFORMS
PLACE AGENTS ON PURPOSE
Pick principles, not a platform. Platforms change quarterly. Principles survive. ๐
Write down where agents may run, which systems they may touch, and who authorizes each action.
Add how work hands off across boundaries. ๐
Run natively when the work is Salesforce work. Run elsewhere when it is not. Run nothing when a rule will do. ๐๏ธ
The Salesforce architect belongs at this table, fluent in the platform and the ecosystem around it. The seat goes to whoever brings the framework. ๐ช
Executives get the same benefit: fewer surprises on the invoice and in the audit.
Where an agent runs is a decision, not a default. Make it on purpose. ๐งญ
SOUL FOOD
Todayโs Principle
"Simplicity is prerequisite for reliability."
and now....Salesforce Memes



What did you think about today's newsletter? |