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:
| Subspec | Dependencies | Use Case |
|---|---|---|
Core (default) | React-Core, AgentforceSDK | Service Agent only |
WithMobileSDK | Core + SalesforceSDKCore | Service Agent + Employee Agent auth |
AgentforceModule is a subclass of RCTEventEmitter:
| Key | Type | Purpose |
|---|---|---|
AgentforceFF_enableMultiAgent | Bool | Multi-agent feature flag |
AgentforceFF_enableMultiModalInput | Bool | Multi-modal input feature flag |
AgentforceFF_enablePDFUpload | Bool | PDF upload feature flag |
AgentforceFF_enableVoice | Bool | Voice feature flag |
EmployeeAgentId | String | Stored Employee Agent ID |
The Android implementation uses Kotlin and Gradle.
Key settings from the bridge's android/build.gradle:
| Dependency | Scope | Version | Purpose |
|---|---|---|---|
agentforce-sdk | api | 14.97.1 | Core Agentforce SDK |
SalesforceReact | compileOnly | 13.1.1 | Mobile SDK (host app provides at runtime) |
compose-bom | implementation | 2024.02.00 | Jetpack Compose BOM |
desugar_jdk_libs | coreLibraryDesugaring | 2.1.5 | Java 8+ API desugaring |
AgentforcePackage registers native modules dynamically:
The Mobile SDK check uses reflection. If not found, EmployeeAgentAuthBridge isn't registered.
| Preferences File | Keys | Purpose |
|---|---|---|
AgentforceFeatureFlags | enableMultiAgent, enableMultiModalInput, enablePDFUpload, enableVoice, enableCustomViewProvider | Feature flags |
AgentforceEmployeeAgent | employee_agent_id | Stored Employee Agent ID |
Events flow from native to JS via NativeEventEmitter:
| Event | Payload | Description |
|---|---|---|
onLogMessage | { level, message, error? } | SDK log message |
onNavigationRequest | { type, ...fields } | Navigation request from agent |