Skip to content

hud63/agentforce-support-agent

Repository files navigation

🤖 Agentforce Support Agent

Production-style Salesforce Agentforce agents built with Agent Script: a customer-service agent that triages, classifies, resolves, and escalates support cases end-to-end, plus a second agent demonstrating clean subagent routing.

Bridges the declarative (no-code routing) and pro-code (Apex + Flow actions) halves of Agentforce, with full CLI deployment automation and an Experience Cloud web-chat front door.


The problem this solves

  • An 8-person support team with 24-hour response times was losing customers to slow replies.
  • Most inbound was repetitive (order status, policy lookups, account verification), the kind of work that doesn't need a human.
  • The real opportunity was letting an agent absorb the repetitive ~60% so people focus on the complex 40% that needs judgment (disputes, damaged shipments, escalations).
  • The hard part wasn't speed, it was trust: the agent had to be right on policy, scoped to current data, and traceable, or it just creates new cleanup.
  • This agent uses deterministic actions for what must be correct (classification, case creation, escalation), LLM reasoning for the conversation, and a structured handoff to humans when it should step back.

What it does

Customer Service Agent (the golden path):

  • Triages an inbound issue, capturing customer ID + description.
  • Classifies the issue via an Apex @InvocableMethod (IssueClassifier).
  • Searches the knowledge base (Flow) for a solution.
  • Creates / updates support cases in Salesforce.
  • Escalates unresolved cases to a specialist queue.
  • Sends a satisfaction survey after resolution.
  • Serves all of this through an Experience Cloud site + Embedded Messaging web-chat widget, with a human-agent fallback queue.

Local Info Agent (reference implementation): a resort concierge showing pure subagent routing (weather / events / resort hours / off-topic / ambiguous) with before_reasoning guardrails and no Apex, just clean Agent Script patterns.


Architecture

                    Web chat (Experience Cloud + Embedded Messaging)
                                     │
                                     ▼
                          ┌────────────────────┐
                          │   agent_router     │   (Agent Script)
                          └─────────┬──────────┘
        ┌──────────────┬───────────┼───────────┬──────────────┐
        ▼              ▼           ▼           ▼              ▼
     triage     classification  resolution  escalation     closure
        │              │           │           │              │
   @utils.set    apex://Issue  flow://Search flow://Escalate flow://SendSurvey
   Variables     Classifier    KnowledgeBase   Case
                                     │
                                     ▼
                       Salesforce records (Case, Contact, Survey Log)

Agent Script binds each step to a concrete action (apex://IssueClassifier, flow://FetchCustomer, flow://SearchKnowledgeBase) with conditional transitions (available when @variables.issue_type) and before_reasoning blocks that force mandatory actions before the LLM decides anything.


Tech stack

Layer Tooling
Agent definition Agent Script (.agent, YAML-style) on Agentforce
Business logic Apex invocable classes (IssueClassifier, WeatherService)
Automation Flows (fetch customer, KB search, create/update/escalate case, survey)
Front door Experience Cloud site + Embedded Messaging web chat
Deploy Salesforce CLI (sf, API v66) + PowerShell orchestration
Routing genAiPlannerBundles / genAiPromptTemplates

Project structure

agentforce-support-agent/
├── customer-service-agent-golden-path/        # Full deployable: triage, resolve, escalate
│   ├── force-app/main/default/
│   │   ├── aiAuthoringBundles/CustomerService_Agent/   # Agent Script definition (5 subagents)
│   │   ├── classes/IssueClassifier.cls(+Test)          # Apex issue classification
│   │   ├── flows/                                      # FetchCustomer, SearchKnowledgeBase,
│   │   │                                               #   UpdateCase, EscalateCase, Survey
│   │   ├── objects/                                    # ASR_Survey_Log__c + custom fields
│   │   ├── messagingChannels / EmbeddedServiceConfig / experiences/   # Web-chat front door
│   │   └── permissionsets/                             # Agent runtime access
│   ├── scripts/publish-customer-service-agent.ps1     # End-to-end deploy + activate
│   ├── WEB_CHAT_GOLDEN_PATH.md                         # Web-chat integration guide
│   └── README.md
├── force-app/main/default/                     # Local Info Agent (subagent-routing demo)
│   ├── aiAuthoringBundles/Local_Info_Agent/    # Agent Script
│   ├── genAiPlannerBundles/ genAiPromptTemplates/
│   └── classes/  (WeatherService, CurrentDate)
└── Local Info Agent Deployment Guide.md

Key engineering decisions

  • Deterministic where it must be correct. Issue classification, case creation, and escalation are Apex/Flow actions, not left to the model, so policy-critical steps are reliable and auditable.
  • before_reasoning guardrails. Mandatory actions execute before the LLM reasons, so the agent can't skip a required step or answer off-topic.
  • Subagent routing over a monolith. A central agent_router hands off to focused subagents (triage, resolution, escalation, closure), keeping each prompt tight.
  • Reproducible deployment. A PowerShell script sequences the deploy correctly (Apex, Flows, permission sets, authoring bundle, publish, activate), then queries BotVersion to confirm activation, so there's no clicking through setup.
  • Meet users where they are. Embedded Messaging on an Experience Cloud site, with a human-fallback queue, so adoption needs no behavior change.

Deploy (outline)

# From the golden-path package, authenticated to a Dev Hub / scratch or sandbox org:
sf project deploy start --source-dir force-app
.\scripts\publish-customer-service-agent.ps1   # publishes + activates the agent
# then wire Embedded Messaging per WEB_CHAT_GOLDEN_PATH.md

Note: Portfolio extract. No credentials are committed; deployment uses your own Salesforce CLI auth, and demo usernames/IDs are sandbox (testdrive.org / agentforce.com) placeholders.

About

Salesforce Agentforce customer-service agent (Agent Script + Apex + Flows) that triages, classifies, resolves, and escalates cases, with Experience Cloud web chat

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors