AI

Agentforce Explained: What Developers Actually Need to Know

Agentforce is Salesforce’s biggest bet since Lightning. It’s the platform for building autonomous AI agents that can handle tasks across your entire org — from answering customer questions to updating records, triggering flows, and making decisions.

But if you strip away the marketing, what is it actually? How does it work? And what do you, as a developer, need to know?

Let’s break it down.


The Big Picture

At its core, Agentforce is a framework with four layers:

┌─────────────────────────────────────────────┐
│              USER / CHANNEL                  │
│     (Slack, Web, Email, SMS, Portal)        │
├─────────────────────────────────────────────┤
│           ATLAS REASONING ENGINE            │
│  ┌──────────┐ ┌──────────┐ ┌────────────┐  │
│  │  Topics  │ │  Actions │ │ Guardrails │  │
│  └──────────┘ └──────────┘ └────────────┘  │
├─────────────────────────────────────────────┤
│              DATA LAYER                      │
│  ┌───────┐ ┌───────────┐ ┌──────────────┐  │
│  │  CRM  │ │ Data Cloud│ │  Knowledge   │  │
│  └───────┘ └───────────┘ └──────────────┘  │
├─────────────────────────────────────────────┤
│            ACTION LAYER                      │
│  ┌───────┐ ┌───────┐ ┌────────┐ ┌───────┐  │
│  │ Flows │ │ Apex  │ │  APIs  │ │Prompts│  │
│  └───────┘ └───────┘ └────────┘ └───────┘  │
└─────────────────────────────────────────────┘

A user sends a message. The Atlas Reasoning Engine figures out what the user wants, picks the right topic, selects the appropriate actions, checks the guardrails, pulls data from the data layer, executes actions through the action layer, and returns a response.

All of this happens autonomously. No human in the loop (unless the guardrails require one).


The Atlas Reasoning Engine

This is the brain. When a request comes in, Atlas doesn’t just pattern-match — it reasons through a multi-step process:

User says: "What's the status of my open cases
            and escalate anything older than 7 days"

Atlas Reasoning:
  1. CLASSIFY  → This is about "Case Management" (topic match)
  2. PLAN      → Two sub-tasks:
                  a) Query open cases for this user
                  b) Check age, escalate if > 7 days
  3. RETRIEVE  → Pull case data from CRM
  4. EXECUTE   → Run "Get Cases" action, then "Escalate Case" action
  5. VALIDATE  → Check guardrails (can this user escalate?)
  6. RESPOND   → "You have 3 open cases. I've escalated
                  Case #1042 (12 days old) to Tier 2."

The key insight: Atlas builds an action plan before executing anything. It can handle multi-step requests, chain actions together, and adapt when intermediate steps fail.


The Three Building Blocks

Every agent is defined by three things: Topics, Actions, and Guardrails.

1. Topics

A topic is a scope of responsibility. It tells the agent “this is your domain” with natural language instructions.

Topic: Order Management
Description: Handle customer inquiries about orders,
             shipping, returns, and refunds.

Instructions:
  - Always verify the customer's identity first
  - For returns, check if within 30-day window
  - Never process refunds over $500 without human approval
  - Use a friendly, professional tone

Trigger: When the customer asks about orders,
         shipping, tracking, returns, or refunds

An agent can have multiple topics. Atlas evaluates the user’s request and routes it to the most relevant topic. Think of topics as the “departments” of your agent.

2. Actions

Actions are the things the agent can do. They map directly to existing Salesforce automation:

Action TypeSourceExample
Flow ActionFlow Builder”Create a return case and send email”
Apex Action@InvocableMethod”Calculate shipping cost”
API ActionMuleSoft/REST”Check inventory in ERP”
Prompt ActionPrompt Builder”Generate a personalized response”

The key thing: you don’t write new code for Agentforce. You expose your existing Flows, Apex classes, and APIs as actions. The agent orchestrates them.

// This existing Apex becomes an Agentforce action
@InvocableMethod(
    label='Calculate Return Eligibility'
    description='Checks if an order is eligible for return based on purchase date and condition'
)
public static List<ReturnResult> checkEligibility(
    List<ReturnRequest> requests
) {
    // Your existing business logic
    ReturnRequest req = requests[0];

    ReturnResult result = new ReturnResult();
    result.eligible = req.purchaseDate.daysBetween(Date.today()) <= 30;
    result.reason = result.eligible
        ? 'Within 30-day return window'
        : 'Past 30-day return window';

    return new List<ReturnResult>{ result };
}

That @InvocableMethod annotation is all it takes. Atlas discovers it, understands the input/output schema from the description, and can call it autonomously.

3. Guardrails

Guardrails are the safety net. They prevent the agent from going rogue:

Guardrails for Order Management Agent:

NEVER:
  - Process refunds over $500 without human approval
  - Access medical or financial PII
  - Make promises about delivery dates not in the system
  - Respond to questions outside order management scope

ALWAYS:
  - Verify customer identity before accessing order data
  - Log all actions to the audit trail
  - Escalate to human if confidence < 80%
  - Use the Einstein Trust Layer for all LLM calls

Guardrails are enforced at runtime. If the agent’s planned action violates a guardrail, execution stops and the request is escalated.


The Einstein Trust Layer

This is the security architecture that makes enterprise AI possible:

User Input


┌─────────────────────┐
│  DATA MASKING       │  ← PII stripped before LLM call
│  (remove SSN, CC#)  │
├─────────────────────┤
│  PROMPT DEFENSE     │  ← Injection attacks blocked
│  (sanitize input)   │
├─────────────────────┤
│  LLM CALL           │  ← No data retention by LLM provider
│  (zero retention)   │
├─────────────────────┤
│  TOXICITY CHECK     │  ← Harmful content filtered
│  (safety filter)    │
├─────────────────────┤
│  GROUNDING CHECK    │  ← Verify against CRM data
│  (fact verification)│
├─────────────────────┤
│  AUDIT LOG          │  ← Every step recorded
│  (full trace)       │
└─────────────────────┘


Agent Response

Every LLM interaction passes through this pipeline. Your sensitive data is masked before it leaves Salesforce, the LLM provider (OpenAI/Anthropic) has zero data retention, and every response is grounded against your actual CRM data before being shown to the user.


Agent Script: The New DSL (Spring ‘26)

The biggest Spring ‘26 addition is Agent Script — a new domain-specific language that combines natural language with programmatic logic:

# Agent Script Example
system_prompt: |
  You are a Salesforce support agent.
  Be concise and professional.

variables:
  customer_name: string
  case_id: string
  priority: string

topic: Case Resolution
  instructions: |
    Help customers resolve their open cases.
    Always check case status before taking action.

  if priority == "Critical":
    action: EscalateToCriticalTeam
    say: "I've escalated case {case_id} to our critical
          response team. You'll hear back within 1 hour."
  else:
    action: GetCaseDetails
    reason: "Let me check the current status."
    say: "Here's what I found for case {case_id}..."

Why does this matter? Because pure LLM-driven agents are unpredictable. An agent that “gets it right 93% of the time” sounds great — until you realize that at scale, 7% failure rate means thousands of wrong actions per day.

Agent Script gives you deterministic control over business-critical paths while still using AI for the natural language parts.


Building Your First Agent: Step by Step

Here’s the practical workflow:

Step 1: Identify the use case

Pick something narrow and well-defined. “Handle all customer interactions” is too broad. “Answer questions about order status and process simple returns” is perfect.

Step 2: Build the actions first

Before touching Agentforce Builder, make sure your automations work:

  • Create the Flows that handle the business logic
  • Write the Apex classes with @InvocableMethod
  • Set up Prompt Templates in Prompt Builder
  • Test everything independently

Step 3: Create the agent

In Agentforce Builder (Setup > Agentforce > Agents):

  1. Create a new agent
  2. Define topics with clear instructions
  3. Map actions to each topic
  4. Set guardrails
  5. Test in Agent Grid

Step 4: Test with Agent Grid

Agent Grid is a spreadsheet-like testing tool (new in Spring ‘26):

┌──────────────────────────┬─────────────────────────────┐
│ Test Input               │ Expected Output             │
├──────────────────────────┼─────────────────────────────┤
│ "What's my order status?"│ Shows order #, status, ETA  │
│ "I want to return item"  │ Checks eligibility, starts  │
│ "Cancel my subscription" │ Escalates to human (guard.) │
│ "Tell me a joke"         │ Politely declines (off-top.)│
└──────────────────────────┴─────────────────────────────┘

Run it against real CRM data. Every test case shows the agent’s reasoning chain, actions taken, and final response.

Step 5: Deploy to channels

Agents can be deployed to:

  • Salesforce UI (embedded in record pages)
  • Experience Cloud (customer portals)
  • Slack (via Slack integration)
  • API (any external application)
  • Email (auto-respond to incoming emails)

What Developers Should Do Right Now

Even if your org isn’t ready for Agentforce yet, start preparing:

  1. Add descriptions to everything. Every Flow, every Apex method, every LWC component. Atlas uses descriptions to understand what actions do. No description = invisible to the agent.

  2. Make your Apex invocable. Any method that could be useful to an agent should have @InvocableMethod with clear label and description attributes.

  3. Structure your data. Agentforce is only as good as the data it can access. Clean up your data model, set up Data Cloud connections, and organize your Knowledge articles.

  4. Think in topics, not features. Start categorizing your business processes into clear, bounded topics. This maps directly to how agents are built.


The Honest Assessment

Agentforce is impressive but it’s still maturing. Here’s my honest take:

What works well:

  • Simple Q&A over structured CRM data
  • Routing and triage workflows
  • Data lookup and summarization
  • Augmenting human agents (not replacing)

What needs time:

  • Complex multi-step reasoning (still brittle at edges)
  • Custom Agent Script is beta
  • Debugging agent behavior can be opaque
  • Cost model can be expensive at scale

My recommendation: Start with internal-facing agents (help desk, admin assistance) before customer-facing ones. The stakes are lower and you’ll learn how agents behave in your specific data environment.


Further Reading


What’s your experience with Agentforce so far? Building agents, evaluating, or waiting? React below and share your thoughts in the comments.

How did this article make you feel?

Comments

Loading comments...

Salesforce Tip

Forcenaut is a one-person project. A small coffee helps keep it going.

Buy me a coffee