Glumes ITSalesforce Ecosystem Experts
Back to Blog
Artificial Intelligence

How Agentforce Is Changing the Future of CRM

Glumes TeamJune 28, 20269 min read

What Agentforce actually is

Agentforce is Salesforce's runtime for autonomous, reasoning-based agents that live inside the platform. Under the hood every agent is a bundle of four things:

  • Topics — the business jobs the agent can handle
  • Actions — Apex, Flow, Prompt Templates, or API calls invoked by the LLM
  • Guardrails — a system prompt, scope rules, and Einstein Trust Layer policies
  • Channels — where it runs (Slack, Experience Cloud, WhatsApp, Voice, in-app)

The reasoning engine is Atlas — a plan-then-act loop that decomposes a user request into steps, picks the right actions, executes them via Apex/Flow/HTTP, and grounds every answer in Data Cloud.

Anatomy of a custom action

Any Apex @InvocableMethod can be registered as an Agent Action. The key is a clean, LLM-friendly schema — the model reads your descriptions to decide when to call it.

public with sharing class GetOpenOpportunitiesAction {
  public class Request {
    @InvocableVariable(required=true label='Account Id')
    public Id accountId;
  }
  public class Response {
    @InvocableVariable public List<Opportunity> opportunities;
  }

  @InvocableMethod(
    label='Get Open Opportunities'
    description='Returns all open opportunities for a given Account Id.')
  public static List<Response> run(List<Request> reqs) {
    List<Response> out = new List<Response>();
    for (Request r : reqs) {
      Response resp = new Response();
      resp.opportunities = [
        SELECT Id, Name, Amount, StageName, CloseDate
        FROM Opportunity
        WHERE AccountId = :r.accountId AND IsClosed = false
        WITH USER_MODE
      ];
      out.add(resp);
    }
    return out;
  }
}

Notes that trip teams up:

  1. Use WITH USER_MODE — the agent runs as the invoking user and RLS/CRUD must apply.
  2. description on every @InvocableVariable is not documentation — it's the tool schema the LLM sees.
  3. Return typed sObjects, not JSON blobs — Agentforce serializes them and Data Cloud can enrich the response.

Wiring an agent end-to-end

User utterance
  → Topic classification (Atlas)
    → Plan (which Actions, in what order)
      → Execute Actions (Apex / Flow / MuleSoft / Prompt Template)
        → Ground response in Data Cloud / CRM
          → Trust Layer (PII masking, toxicity, audit) → reply

Testing before you ship

Use the Agent Builder → Preview to trace every decision. For CI, drive the Bot Runtime API with a fixture set:

curl -X POST https://api.salesforce.com/einstein/ai-agent/runtime/v1/agents/$AGENT_ID/sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message":{"sequenceId":1,"type":"Text","text":"Show me open pipeline for Acme"}}'

Assert on plan.steps[] — not just the final text — so a regression in tool selection fails your build.

When to reach for Agentforce vs. a plain LLM

ScenarioUse
Grounded in CRM data, PII in scopeAgentforce
One-off summarization of a public docPrompt Template / OpenAI directly
Multi-step business workflowAgentforce Actions
Deterministic automation onlyFlow — skip the LLM

Takeaways for engineering teams

  • Model your agent as a small set of well-described actions. Fewer, sharper tools beat a giant registry.
  • Every action must be idempotent and enforce sharing.
  • Put PII masking and topic scope in the Trust Layer, not in the prompt.
  • Wire Data Cloud early — the moment your agent needs cross-object context, unified profiles save you weeks.
AgentforceAISalesforce

Related articles