Architecture Reference - React Native

Reference documentation for the architecture of the Agentforce Mobile SDK for React Native.

The React Native Agentforce SDK is a bridge to the native iOS and Android SDKs, not a reimplementation. It provides a JavaScript API that delegates to platform-specific native modules.

The iOS implementation uses Swift and CocoaPods.

The bridge is distributed as a CocoaPods podspec with two subspecs:

SubspecDependenciesUse Case
Core (default)React-Core, AgentforceSDKService Agent only
WithMobileSDKCore + SalesforceSDKCoreService Agent + Employee Agent auth

AgentforceModule is a subclass of RCTEventEmitter:

KeyTypePurpose
AgentforceFF_enableMultiAgentBoolMulti-agent feature flag
AgentforceFF_enableMultiModalInputBoolMulti-modal input feature flag
AgentforceFF_enablePDFUploadBoolPDF upload feature flag
AgentforceFF_enableVoiceBoolVoice feature flag
EmployeeAgentIdStringStored Employee Agent ID

The Android implementation uses Kotlin and Gradle.

Key settings from the bridge's android/build.gradle:

DependencyScopeVersionPurpose
agentforce-sdkapi14.97.1Core Agentforce SDK
SalesforceReactcompileOnly13.1.1Mobile SDK (host app provides at runtime)
compose-bomimplementation2024.02.00Jetpack Compose BOM
desugar_jdk_libscoreLibraryDesugaring2.1.5Java 8+ API desugaring

AgentforcePackage registers native modules dynamically:

The Mobile SDK check uses reflection. If not found, EmployeeAgentAuthBridge isn't registered.

Preferences FileKeysPurpose
AgentforceFeatureFlagsenableMultiAgent, enableMultiModalInput, enablePDFUpload, enableVoice, enableCustomViewProviderFeature flags
AgentforceEmployeeAgentemployee_agent_idStored Employee Agent ID

Events flow from native to JS via NativeEventEmitter:

EventPayloadDescription
onLogMessage{ level, message, error? }SDK log message
onNavigationRequest{ type, ...fields }Navigation request from agent