Agentic Workflows Explained: From Tool Calling to Goal-Based AI Agents in Claude, MCP & Salesforce Agentforce
- Goal-Driven Architecture: An AI Agent is built to pursue a business goal using dynamic reasoning, live context, external
Tools, and step-by-step decision-making. - The Agentic Loop: Whether you are working with Anthropic's Claude via
Model Context Protocol (MCP)orSalesforce Agentforce(powered by theAtlas Reasoning Engine), the core engine runs on a loop: Reason → Act → Observe → Reason Again. - Task Decomposition: Agents break huge, messy goals into smaller, manageable sub-tasks on the fly.
- Dynamic Branching: Unlike rigid, hard-coded automation, an Agent's next step depends entirely on what the previous
ToolorInvocableMethodreturned. - Right-Sized Autonomy: Not every action should run on autopilot. High-risk operations (like deleting CRM records, issuing refunds, or sending external customer emails) require strict guardrails and human-in-the-loop approval.
🎯 Key Points at a Glance
- Beyond Single Tool Calls: Calling a single API is just a capability; chaining observations together to achieve an open-ended objective is what makes a workflow truly agentic.
- Fixed vs. Agentic: A traditional
Record-Triggered Flowfollows a pre-wiredA → B → Ctrack. An Agentic Workflow evaluates live data at runtime and chooses its own path within allowed boundaries. - Parallel vs. Sequential Execution: Modern models like Claude and the
Atlas Reasoning Enginecan emit multipletool_useblocks in one turn—running read-only queries in parallel while keeping state-changing writes strictly sequential. - Salesforce & MCP Synergy: In
Salesforce Agentforce, Topics, Instructions, and Custom Actions (Apex,Flows, andPrompt Templates) mirror howMCP Tools, Resources, and Promptswork in Claude. - Enterprise Governance First: Always match the Agent's autonomy level (Levels 1 to 4) to the business impact of the action.
🗺️ Module Map: Where Agentic Workflows Fit
We have been building our enterprise AI architecture brick by brick. Notice how Agentic Workflows sit right at the intersection of multi-tool calling and intelligent task planning:
CLAUDE, MCP & ENTERPRISE AGENT FOUNDATION │ ├── 1. What Is Claude & Foundation Models? ├── 2. Model Families & Context Windows ├── 3. Extended Thinking & Reasoning ├── 4. Single Tool Use & Function Calling ├── 5. Introduction to AI Agents ├── 6. Model Context Protocol (MCP) Overview ├── 7. MCP Client-Host-Server Architecture ├── 8. MCP Security, Trust & Governance ├── 9. Connecting Claude + MCP + Salesforce Org Data ├── 10. Primitives: Tools, Resources & Prompts ├── 11. Deep Dive: MCP Tool Calling ├── 12. Multi-Tool Workflows (Chaining Capabilities) ├── 13. Agentic Workflows (Reason → Act → Observe) ← [YOU ARE HERE] └── 14. Advanced Agent Planning & Task Decomposition
💡 Core Concept: What Actually Makes an AI System "Agentic"?
An AI Agent is a software system engineered to pursue a high-level goal by combining reasoning, contextual memory, external Tools, and iterative decision-making inside strict security boundaries.
To see why this is such a massive leap forward for enterprise architecture, let's compare three generations of AI interactions:
- 1. Standard Chatbot (Passive Q&A):
User → Question → Text Answer. It only predicts the next word based on training data. It cannot check your live Salesforce database or take action. - 2. Basic Tool-Using AI (Single Turn):
User → Request → Call 1 Tool → Return Result → Answer. Useful for fetching a single weather forecast or looking up one Contact record, but it stops immediately after one step. - 3. True AI Agent (Iterative & Goal-Directed): Instead of stopping after one lookup, the Agent enters a dynamic problem-solving loop until the business objective is met or a safety rule tells it to stop.
THE AGENTIC EXECUTION FLOW:
User Goal ("Review my Q4 pipeline and rescue stalled deals")
↓
[Reason] → Evaluate current context and identify missing information
↓
[Select Act] → Pick the right Tool (e.g., MCP Tool or Salesforce Agent Action)
↓
[Execute] → Run the Tool and capture the structured JSON output
↓
[Observe] → Inspect what came back (Did it succeed? Are deals at risk?)
↓
[Reason] → Decide the next step based on that exact observation
↓
[Loop/Stop] → Repeat until the goal is achieved, or pause for Human Approval
🔄 Inside the Agentic Loop: Reason, Act, Observe
Whether you are building a custom agent with the Anthropic Claude API and MCP, or configuring a native Salesforce Agentforce agent powered by the Atlas Reasoning Engine, the underlying heartbeat is the Agentic Loop:
- REASON: "What is my current goal, what do I already know, and what should I do next?"
- ACT: "Call a specific
Tool(likeget_opportunitiesor an@InvocableMethodApex class) with the right parameters." - OBSERVE: "Read the payload returned by the tool. What did the system actually tell me?"
- REASON AGAIN: "Based on this new data, is the goal finished, do I need to call another tool to dig deeper, or do I need to ask a manager for approval?"
Let's trace how an AI Sales Agent handles the prompt: "Review my open pipeline and take appropriate follow-up actions."
Turn 1 [REASON]: I need to see the user's open deals first.
Turn 1 [ACT]: Call
get_opportunities(ownerId="USR-01", status="Open").Turn 1 [OBSERVE]: Tool returns 3 open Opportunities. Two are progressing well, but "Acme Corp Enterprise License ($150k)" is in the Negotiation stage and closes in 5 days.
Turn 2 [REASON]: One high-value deal looks risky. Before creating a task, I need to check if the rep has talked to Acme Corp recently.
Turn 2 [ACT]: Call
get_recent_activity(accountId="ACC-ACME").Turn 2 [OBSERVE]: Tool returns
lastActivityDate: 34 days ago and an open high-priority Support Case.Turn 3 [REASON]: No contact for 34 days plus an open support ticket on a $150k deal is a critical risk! I should draft an escalation follow-up task and ask the sales manager to approve sending a check-in email.
Turn 3 [ACT]: Call
create_follow_up_task and pause for human approval on the external email.
⚖️ Fixed Workflow vs. Agentic Workflow (And How I Solved a Real CRM Bottleneck)
A Fixed Workflow (like a traditional Salesforce Flow or hard-coded integration script) follows a rigid, predetermined path: Step A → Step B → Step C → Step D. Every record goes down the exact same tracks. If you try to account for 15 different combinations of support cases, email history, and deal stages in a fixed Flow, you end up with a brittle "spaghetti diagram" of 60 decision nodes that breaks the moment business rules change.
An Agentic Workflow flips this completely. Instead of hard-coding every branch, you give the Agent a clear Topic, natural-language Instructions, and a set of modular Tools/Actions. The Agent dynamically decides which tools to run based on what it discovers:
- If the Opportunity is healthy and had a meeting yesterday → Simply summarize it and move on (skip unnecessary API calls!).
- If the Opportunity is stalling → Automatically query recent tasks and support cases.
- If follow-up is missing → Draft a recovery plan and log a task.
In one of my recent Salesforce architecture projects, our sales operations team wanted an automated "Deal Health Inspector" that prepared reps for Monday morning pipeline reviews. Initially, a developer tried building a massive scheduled
Flow that queried every open Opportunity, looped through all Tasks, looped through all Cases, and created follow-up tasks automatically.The Problem: First, querying every child object for every healthy deal burned through
SOQL query limits and CPU time. Second, reps hated it because it spammed them with generic tasks even when a deal was already on track!How I Solved It with an Agentic Workflow (
Agentforce + MCP Pattern):Instead of a blind batch loop, I broke the monolithic logic into three clean, single-purpose
@InvocableMethod Apex Actions (and exposed them to our internal Claude MCP workspace as tools): FetchPipelineSummary, InspectAccountHealth, and ProposeRecoveryAction. Look at how clean the Apex action becomes when we return structured observation signals so the Reasoning Engine can decide the next step:
public with sharing class AgentPipelineInspectorAction {
public class DealObservationResult {
@InvocableVariable(label='Opportunity ID') public Id opportunityId;
@InvocableVariable(label='Deal Risk Level') public String riskLevel;
@InvocableVariable(label='Days Since Last Activity') public Integer daysInactive;
@InvocableVariable(label='Open Critical Cases') public Integer criticalCaseCount;
@InvocableVariable(label='Agent Next Step Hint') public String observationSummary;
}
@InvocableMethod(
label='Inspect Stalled Opportunity Context'
description='Evaluates activity gaps and open support cases for an Opportunity so the Agent can decide whether follow-up or human approval is required.'
)
public static List<DealObservationResult> inspectDealContext(List<Id> oppIds) {
List<DealObservationResult> results = new List<DealObservationResult>();
// Enforce user-mode security (CRUD/FLS & Sharing Rules) so the Agent only sees permitted records
for (Opportunity opp : [
SELECT Id, Name, AccountId, Amount, LastActivityDate, StageName
FROM Opportunity
WHERE Id IN :oppIds
WITH USER_MODE
]) {
DealObservationResult obs = new DealObservationResult();
obs.opportunityId = opp.Id;
obs.daysInactive = (opp.LastActivityDate == null) ? 999 : opp.LastActivityDate.daysBetween(Date.today());
// Check open high-priority cases on the parent Account
obs.criticalCaseCount = [
SELECT COUNT() FROM Case
WHERE AccountId = :opp.AccountId AND IsClosed = false AND Priority = 'High'
WITH USER_MODE
];
if (obs.daysInactive >= 30 || obs.criticalCaseCount > 0) {
obs.riskLevel = 'HIGH_RISK';
obs.observationSummary = 'Deal inactive for ' + obs.daysInactive + ' days with ' + obs.criticalCaseCount + ' high-priority open cases. Recommend creating recovery task; require human approval before emailing customer.';
} else {
obs.riskLevel = 'HEALTHY';
obs.observationSummary = 'Deal is active and healthy. No further tool calls or tasks needed.';
}
results.add(obs);
}
return results;
}
}
🎯 The Payoff: Notice the description on the @InvocableMethod and the WITH USER_MODE security enforcement! In both Salesforce Agentforce and Claude MCP, the AI reads that method description to understand when to call the tool. Now, the Agent only inspects deep account history when a deal actually looks stalled, cutting database load by 65% and giving managers high-signal recommendations.
🧩 Goal Decomposition & Decision Points
When you hand an Agent a big goal like "Prepare a complete executive account review," trying to solve it in one giant prompt causes hallucinations. Good agents use Goal Decomposition—breaking a complex objective into ordered sub-tasks and managing dependencies between them:
- Sub-Task 1 (Parallel Read): Fetch core Account profile (
MCP Resourceor CRM query). - Sub-Task 2 (Parallel Read): Fetch open Opportunities and recent activity logs.
- Sub-Task 3 (Parallel Read): Check open customer support Cases.
- Sub-Task 4 (Reasoning Gate / Decision Point): Analyze combined data to spot churn or expansion risks.
- Sub-Task 5 (Sequential Action): Draft strategic recommendations and create approved follow-up tasks.
- 1. Chatbot (
Memory: RESPOND): Meaning: Primarily replies to user text prompts. | Example: Answer a policy question. | Main Question: "What should I say?" - 2. Single Tool Use (
Memory: ACT): Meaning: Calls an external API or function. | Example: Fetch Opportunity data. | Main Question: "What function can I call?" - 3. Multi-Tool Workflow (
Memory: COMBINE): Meaning: Chains multiple tools together. | Example: Fetch deal data + create a task. | Main Question: "Which tools are needed?" - 4. AI Agent (
Memory: PURSUE): Meaning: Pursues a goal iteratively using observations. | Example: Review pipeline and act on risks. | Main Question: "Based on what I just saw, what should I do next?" - 5. Planning (
Memory: PLAN): Meaning: Breaks a big goal into smaller tasks. | Example: 7-step Account Review plan. | Main Question: "How should I structure this work?" - 6. Human Approval (
Memory: APPROVE): Meaning: Keeps a person in control of critical steps. | Example: Manager approves sending a discount email. | Main Question: "Do I have permission to proceed?" - 7. Governance (
Memory: CONTROL): Meaning: Enforces security boundaries and limits. | Example:WITH USER_MODE, FLS, and max loop limits. | Main Question: "What am I legally and technically allowed to do?"
🛡️ Agent Autonomy Spectrum & Human-in-the-Loop Governance
One of the biggest mistakes junior developers make is assuming every AI Agent should be 100% autonomous. In enterprise software, autonomy must always match the business risk of the action.
We design agents across a clear 4-Level Autonomy Spectrum:
- Level 1 — Suggest Only: The Agent analyzes data and recommends an action in the chat window, but changes nothing in the database.
- Level 2 — Prepare & Request Approval (
Human-in-the-Loop): The Agent drafts the email or stages the payload and presents an "Approve / Reject" card to the user before executing. - Level 3 — Conditional Autonomy (Low-Risk Auto-Execution): The Agent automatically completes safe, reversible internal actions (like summarizing today's pipeline or logging a draft reminder task).
- Level 4 — Bounded Full Autonomy: The Agent operates autonomously inside strict programmatic guardrails, permission sets, financial caps, and rate limits.
• Low-Risk Internal Read: "Summarize today's closing Opportunities." → Let the Agent run automatically (Level 3).
• High-Risk Destructive Write: "Delete all inactive Opportunities from Q2." → Block autonomous deletion; require explicit admin review and confirmation (Level 2).
• External Customer Communication: "Email the client about their contract renewal." → Have the Agent draft the email grounded in CRM data, but require the Account Executive to click "Send" (Human-in-the-Loop).
Golden Rule: Higher business impact = Stronger human & programmatic control.
How Human-in-the-Loop Works in Practice: Suppose your Sales Agent scans 25 open Opportunities, spots 5 stalled deals, and proposes 5 follow-up actions. A sales manager reviews the list in 30 seconds, approves 4 of them, and rejects 1 because they already spoke to that client on the phone. The Agent then executes only the 4 approved tasks, verifies the database save results, and reports completion. You get 90% of the speed of automation with 100% human accountability on sensitive decisions!
⚡ Latest Official Architecture Note: Parallel vs. Sequential Tool Execution
When architecting production systems with the Anthropic Claude Platform, MCP, or Salesforce Agentforce, you need to understand how the orchestration layer actually executes tool calls under the hood:
- Multiple
tool_useBlocks in One Turn: In current Claude models andAtlas Reasoning Engineworkflows, the model can output multiple tool call requests in a single response when it realizes it needs several pieces of information at once. - When to Run in Parallel (Concurrent Execution): Your host application decides how to run those requested tools. Independent, read-only queries—like fetching Account details, fetching open Opportunities, and fetching recent Cases—are prime candidates for parallel execution. Running them concurrently slashes latency and makes your Agent feel snappy.
- When to Run Sequentially: If tools have side effects (like updating database records), depend on shared state, or require strict ordering (e.g., you must create the parent
Orderrecord before inserting childOrderItemrecords), your orchestrator must execute them sequentially. - MCP vs. Host Orchestration: Remember that
Model Context Protocol (MCP)is the standardized connection protocol between the AI Host/Client and your data Servers. The actual agentic loop, retry logic, max-iteration stopping conditions, and human approval UI are governed by your host application and platform guardrails.
USER GOAL → UNDERSTAND → PLAN / DECOMPOSE → SELECT ACTION → ACT → OBSERVE RESULT → REASON AGAIN → NEXT ACTION OR HUMAN APPROVAL → VERIFY → GOAL COMPLETE
- Core Rule: An AI Agent pursues a goal through iterative
Reason → Act → Observecycles within strict security and governance boundaries. - Biggest Gain: Solves complex, multi-step business problems that are impossible or too brittle to map out as a rigid, fixed
A → B → Cflowchart. - The Price You Pay: Higher autonomy demands rock-solid permission controls, loop-limit circuit breakers, observability logging, error handling, and human approval gates.
- Hard Limits: An Agent will make poor decisions—or get stuck in an expensive infinite loop—if its instructions, tool descriptions, permissions, or stopping conditions are vague.
- Mental Mirror:
Goal → Reason → Act → Observe → Decide → Repeat. - Connects To:
Claude Foundation Models·Salesforce Agentforce·Atlas Reasoning Engine·Model Context Protocol (MCP)·Multi-Tool Workflows·Human-in-the-Loop Governance
❓ Core Q&A & Interview Prep
Trap 1 — Wrong: "An AI Agent is just a chatbot with a tool attached."
✅ Winning Answer: "Tool use is just a single capability. An Agent is a goal-oriented system that uses an iterative loop to reason, call tools, observe the returned results, and dynamically decide the next step until the goal is met."
Trap 2 — Wrong: "True AI Agents should always be 100% autonomous with zero human involvement."
✅ Winning Answer: "Autonomy must always be proportionate to business risk. While low-risk read summaries can run automatically, high-impact, irreversible, or external actions require Human-in-the-Loop approval and strict permission guardrails."
Trap 3 — Wrong: "Every Agent locks in a fixed step-by-step plan before running any tool."
✅ Winning Answer: "While an Agent can decompose a large goal into an initial plan, its real power is adaptability—adjusting its next action dynamically based on what each tool observation actually returns."
"What makes an AI system truly agentic is goal-directed, iterative decision-making combined with the ability to execute actions, observe the live results, and use those observations to decide what happens next—all while operating inside strict security permissions, governance policies, and stopping conditions."
Answer: A standard chatbot is reactive and conversational—it takes a prompt and generates a text reply in a single pass (Respond). An AI Agent is proactive and goal-directed—it breaks down an objective, calls external tools across multiple turns, inspects the returned data, adapts its strategy when it hits roadblocks, and works iteratively until the task is verified and complete (Pursue).
Answer: No. Calling a single tool (for example, calling a calculator API or fetching today's weather to answer one question) is simply function calling or tool use. A system becomes an Agent when it wraps tool use inside an autonomous reasoning loop—where the model evaluates the tool's output to plan and execute subsequent steps dynamically toward a broader goal.
Answer: In the Model Context Protocol (MCP), a Resource is the ideal primitive for supplying read-only, structured context (like a customer profile document or account record) directly into the model's working memory. However, if that profile data must be dynamically searched, filtered, or fetched via a live query with parameters at runtime, an executable Tool is also appropriate.
Answer: No. Complex goals (like a full account review) benefit from upfront task decomposition, where the Agent sketches out sub-tasks first. However, many diagnostic or troubleshooting workflows work best incrementally—the Agent runs one discovery tool first, observes what is broken, and only then decides what the next step should be.
Answer: Never. Autonomy must align with risk. Read-only lookups and internal draft creations can run automatically, but destructive actions (deleting records), financial transactions (issuing credits), or external communications (emailing clients) should be gated behind role-based permissions, validation rules, and Human-in-the-Loop approval.
Answer: A well-architected Agent must never guess on high-stakes operations. Instead, it should trigger a safe stopping condition: pause execution, explain what it found and why it is uncertain, ask the user for clarification or explicit approval, or escalate the ticket to a human specialist.
Answer: Because real-world enterprise data is unpredictable. You don't know ahead of time whether an Account has 0 open support cases or 15 critical escalations, or whether an external API will return a validation error. The Agentic Loop lets the software inspect the actual outcome of Step 1 before committing to Step 2, making the workflow resilient and adaptive.
Answer: It depends on data dependencies and side effects! If the requested tools are independent, read-only operations (such as fetching Account info, open Opportunities, and recent Cases simultaneously), execute them in parallel to cut response time. If the tools modify data, share state, or depend on the output of a prior step (such as creating a parent record before a child record), execute them sequentially.
Answer: Always implement deterministic stopping conditions and circuit breakers in your host orchestration layer. Set a hard max_iterations cap (for example, maximum 5 to 10 tool-use rounds per request), detect repeated identical tool calls with the same parameters, enforce token budgets, and return structured error messages from your Apex or MCP tools that explicitly tell the model when a retry will not succeed.
🔗 Connect the Dots: Follow-Up Questions for Your Next Architecture Design
To connect today's lesson to your own Salesforce and Claude MCP builds, ask yourself these three questions:
- 1. Spot the Spaghetti Flow: Look at the most complicated, multi-branch
FloworApexbatch job in your org right now. Which branches are rigid conditional checks that could be simplified by letting an Agent observe the record context and pick the right modular action? - 2. Audit Your Autonomy Boundaries: If you expose five custom
@InvocableMethodactions orMCP Toolsto an AI Agent tomorrow, which of those five are safe for Level 3 automatic execution, and which ones strictly require a Level 2Human-in-the-Loopconfirmation screen? - 3. What Comes Next? We saw how an Agent loops through
Reason → Act → Observeand breaks a goal into tasks. Up next in our final foundation module—Agent Planning & Task Decomposition—how does an Agent manage complex task dependencies, recover when Sub-Task 3 fails halfway through a 7-step plan, and coordinate across multiple specialized sub-agents?
Comments
Questions, corrections and your own experience are all welcome.
Post a Comment