πŸ€– Salesforce Agentforce Β· Forward Deployed Engineering

A grounded, agentic sports booking concierge

A modern, multi-turn conversational assistant that turns a natural-language request into grounded sporting-event discovery and venue answers β€” powered by a single headless Agentforce Service Agent, with a custom React experience on a Salesforce Digital Experience site.

1 Headless Service Agent (Agent Script) 2 Grounded topics + router 100% Server-side auth (no browser secrets)
The problem

Discovering events, exploring venues, and understanding seating usually means hopping across listings, maps, and FAQs β€” slow and impersonal.

The approach

One conversation. The agent gathers only the missing details, retrieves options from approved data, and answers venue questions with citations β€” never inventing facts.

Why it's different

Not a scripted chatbot: deterministic topic routing + an LLM for language, with Agentforce as the orchestration and enterprise-security layer.

πŸ—ΊοΈ The Build Journey

From a customer utterance to a grounded response

Click a stage to see what happens behind the scenes. Routing is topic selection within one Service Agent β€” not delegation to separate agents.

πŸ—‚οΈ AI Project Structure

The repository, explained

The real structure. Expand folders, click a file for its purpose. Implemented components are marked built; not-yet-built ones future.

Select a file or folder

Click any node in the tree to see what it is and how it fits into the runtime.

πŸ—οΈ Technology Stack & Solution Architecture

Layered, production-oriented design

Expand each layer. The live integration path is server-side end-to-end β€” the browser never holds Salesforce credentials.

πŸ” Security & Governance

Server-side auth, least-privilege guest access

The browser never holds Salesforce credentials. An External Client App issues OAuth client-credentials tokens that a Named Credential attaches to the Apex callout β€” all server-side.

Setup steps follow the official Agent API β€” Get Started guide.

1πŸͺͺ External Client App OAuth client-credentials Β· sfap_apiβ–Έ

Create the ECA that issues access tokens via the client-credentials flow.

  1. From Setup, in the Quick Find box, enter External Client App, then select External Client Apps Manager.
  2. Select New External Client App.
  3. Specify a name β€” e.g. PW_Agent_External_API.
  4. Select Enable OAuth and use these OAuth scopes:
    • Manage user data via APIs (api)
    • Perform requests at any time (refresh_token, offline_access)
    • Access chatbot services (chatbot_api)
    • Access the Salesforce API Platform (sfap_api)
  5. Select these additional OAuth settings:
    • Enable Client Credentials Flow
    • Issue JSON Web Token (JWT)-based access tokens for named users
  6. Create the app.
  7. From your app settings, click the Policy tab › Edit.
  8. From the OAuth Flows and External Client App Enhancements section, check Enable Client Credentials Flow.
  9. Set the Run As (Username) field to the email address of a user that has at least API Only access.
2πŸ”‘ Named Credentials External Credential β†’ Named Credentialβ–Έ

Wire the OAuth chain so Apex callouts authenticate automatically β€” no secrets in code.

  1. Enter Named Credentials in the Quick Find box and click Named Credentials.
  2. Click the External Credentials tab and click New:
    1. Name: PW_Agent
    2. Authentication Protocol: OAuth 2.0
    3. Authentication Flow Type: Client Credentials with Client Secret Flow
    4. Identity Provider URL: https://[Your_Domain_Name]/services/oauth2/token
  3. Under Principals in the External Credential, click New to create a principal entry:
    1. Parameter Name: PW_Agent
    2. Enter your Consumer Key as the Client ID and your Consumer Secret as the Client Secret β€” obtain both from the ECA settings in step 1.
3πŸ›‘οΈ Permission Sets PW_Chat_Guest_Accessβ–Έ

The PW_Chat_Guest_Access permission set grants the site guest user exactly what it needs to broker a call β€” and nothing more.

  1. Apex class access: enable PW_AgentController so the guest user can invoke the controller that brokers the Agent API.
  2. UserExternalCredential read: grant Read so the guest user can resolve the external credential at callout time.
  3. External Credential Principal Access: enable the PW_Agent principal so the Named Credential can attach the issued token.
  4. Assign the permission set to the Experience site guest user.
4🧭 Guest Access Boundary & Hardening least privilegeβ–Έ

How the pieces above combine into a safe public boundary (and what to tighten for production).

  • Credentials server-side only β€” tokens are issued and attached by the Named Credential inside Apex; the browser never sees them.
  • Least privilege β€” the guest user gets only Apex class access plus the external-credential principal, nothing else.
  • Run As an API-Only user β€” the ECA executes under a constrained identity, limiting blast radius.
  • Recommended production hardening β€” per-conversation rate limiting, monitoring / trace review, tighter guest data scoping, and rotation of the Consumer Secret.
πŸ§ͺ Test Results

Verified behaviour, end to end

Two independent test layers: Agentforce Testing Center (agent reasoning, routing and guardrails) and Playwright (the React experience). Results below are collected from the actual run artifacts.

☁️ Salesforce Test Center Results

The Agentforce Testing Center results live in the repo-root test-results/ directory β€” raw JSON from sf agent test run (run 2026-10-30). Grouped by evaluation suite below.

97
Test cases
65
Cases passed
32
Cases failed
67%
Case pass rate
Routing PW_Routing_Tests
27 cases Β· 18βœ“ / 9βœ—
Discovery action PW_Discovery_Action_Tests
20 cases Β· 15βœ“ / 5βœ—
Knowledge action PW_Knowledge_Action_Tests
20 cases Β· 16βœ“ / 4βœ—
Guardrails & quality PW_Guardrail_Quality_Tests
21 cases Β· 12βœ“ / 9/b>βœ—
Probe PW_Probe
9 cases Β· 4βœ“ / 5βœ—
▢️ Playwright Results

End-to-end UI coverage of the React concierge, collected from react-src/playwright-report/. Open the full HTML report β†—

9
Tests
9
Passed
0
Failed
100%
Pass rate
concierge.spec.ts β€” 8 use cases
  • βœ“ Page loads with a usable, empty composer 1.3s
  • βœ“ Send disables on empty input, enables on type 1.4s
  • βœ“ Turn 1: greeting β†’ welcome reply 2.2s
  • βœ“ Turn 2: discovery β†’ clarifying question 2.2s
  • βœ“ Submitting shows user message + typing/disabled state 0.8s
  • βœ“ Turn 3: preferences β†’ grounded event cards 1.6s
  • βœ“ Clicking a recommendation opens/closes the modal 2.3s
  • βœ“ Turn 4: venue follow-up β†’ grounded citation 1.6s
journey.spec.ts β€” full recording
  • βœ“ Full end-to-end concierge journey (recorded) 10.7s

β–Ά Full end-to-end concierge journey β€” the complete multi-turn flow (greeting β†’ discovery β†’ preferences β†’ event cards β†’ venue citation), captured by the journey.spec.ts run.

▢️ Live Request Simulator

Multi-turn, grounded, context-aware

A guided replay of a real Riyadh conversation. Press Play next turn. The right panel shows the behind-the-scenes trace for each agent turn.

Sports Booking Concierge Premium Sports Booking

Behind the scenes

The real flow for the current agent turn.

Play a turn to see intent β†’ routing β†’ action β†’ data β†’ response.

Seat selection & venue map

Choosing seats "near the exits", an interactive seating map, holds, and completing a booking are a planned next phase β€” not yet implemented. The agent today discovers events and answers venue questions with citations.