Agentforce SDK React Native Sample App
A React Native sample application demonstrating two separate apps built from a single codebase: Service Agent (customer-facing, anonymous auth) and Employee Agent (workforce, OAuth auth) using Salesforce Agentforce SDK for both iOS and Android.
🎯 Overview
This sample app demonstrates how to build two distinct apps from one codebase:
- Service Agent App: Customer-facing service with anonymous authentication, no Mobile SDK dependency
- Employee Agent App: Internal workforce app with OAuth authentication via Salesforce Mobile SDK
Both apps share >98% of code while maintaining separate identities and can be installed side-by-side on the same device.
The Agentforce Mobile SDK empowers you to integrate Salesforce's trusted AI platform directly into your mobile applications. Service Agents provide AI-powered conversational experiences for customer support scenarios, while Employee Agents enable authenticated workforce interactions.
📖 Complete Multi-App Guide - Comprehensive guide for building, installing, and deploying both apps
✨ Features
Multi-App Architecture
- Two Separate Apps - Service Agent and Employee Agent from one codebase
- Selective Installation - Install only what you need
- Independent Releases - Deploy Service Agent and Employee Agent separately
- Side-by-Side Installation - Both apps on same device
Service Agent App
- Anonymous Authentication - URL-based configuration, no login required
- Lightweight - No Mobile SDK dependency
- Customer-Facing - Optimized for public service scenarios
Employee Agent App
- OAuth Authentication - Salesforce Mobile SDK integration
- Full SDK Access - Complete Mobile SDK features for workforce apps
- Published Artifacts - Uses Mobile SDK from Maven Central & CocoaPods
Shared Features
- Service Agent Configuration - Configure and initialize the SDK with Service Agent settings
- Employee Agent Configuration - OAuth-based authenticated sessions
- Full UI Experience - Use the pre-built chat interface provided by the Agentforce SDK
- Cross-Platform - Single codebase for both iOS and Android with native SDK integration
- Persistent Configuration - Settings are saved and restored automatically
- Conversation Continuity - Conversations persist across app launches
- 98% Code Reuse - Maximum code sharing between apps
🏗️ Architecture
This repository uses a multi-target/multi-flavor approach to build two separate apps from a single codebase.
Multi-App Structure
iOS (XcodeGen + CocoaPods):
- Two Xcode targets:
ServiceAgent and EmployeeAgent
- Conditional pod installation based on target
- Service Agent: Uses
ReactNativeAgentforce/Core (no Mobile SDK)
- Employee Agent: Uses
ReactNativeAgentforce/WithMobileSDK (with Mobile SDK)
- Both apps use the UIKit scene lifecycle. The shared
SceneDelegate creates
the scene's window and attaches the React Native UI; app delegates initialize
process-level services, including Mobile SDK for Employee Agent.
- Both iOS apps use the Paper renderer through
RCTBridge/RCTRootView.
The shared Podfile disables the new architecture before autolinking so native
navigation views use the same renderer. Reinstall pods after changing this
setting; migrating to Fabric also requires updating the native app hosts.
Android (Product Flavors + Gradle):
- Two flavors:
serviceAgent and employeeAgent
- Creates 4 build variants (service/employee × debug/release)
- Service Agent: No Mobile SDK dependency
- Employee Agent: Mobile SDK via
employeeAgentImplementation
Local SDK development
Inside the SDK monorepo, both iOS and Android sample apps automatically use the
native SDK source in the same checkout. You can run the sample's normal install
and run commands, or open its iOS workspace or Android project directly after
setup. Android also supports the monorepo's outer composite build.
Standalone checkouts of this public repository use the published native SDK
versions. An incomplete detected local SDK checkout fails with a setup error;
dependency resolution or build failures do not trigger a published-version retry.
The iOS sample apps require iOS 18 or later. Their Podfiles, generated app targets,
and pod build settings share that minimum. Local iOS dependencies use the design
system's Binary subspecs and require access to the configured CocoaPods repository.
After switching between local and standalone checkouts, rerun the installation
script before building so CocoaPods updates its dependency selection.