AgentforceService

interface AgentforceService

High-level service interface providing comprehensive Agentforce backend integration and conversation orchestration for Android applications.

Interface for managing Agentforce conversations, voice interactions, and file uploads.

PropertyTypeDescription
agentIdStringAgent identifier for conversations
FunctionSignatureDescription
cancelCurrentStreamingopen fun cancelCurrentStreaming()Cancel current streaming operation
endAgentforceVoiceopen suspend fun endAgentforceVoice(sessionId: String)End realtime voice conversation for the given session. This method disconnects the LiveKit room and cleans up resources
muteMicrophoneopen suspend fun muteMicrophone(sessionId: String, mute: Boolean)Mute or unmute the microphone for the current voice session. This method controls the LiveKit room microphone state
sendMessageAndStartStreamingopen suspend fun sendMessageAndStartStreaming(sessionId: String, inputRepresentation: StreamingRequest): ReceiveChannel<AgentforceResponse>Send message and start streaming response
setAgentforceVoiceDelegateopen fun setAgentforceVoiceDelegate(delegate: AgentforceVoiceDelegate?)Set the delegate for voice callbacks
startAgentforceVoiceopen suspend fun startAgentforceVoice(sessionId: String)Start realtime voice conversation for the given session. This method handles the join API call and LiveKit room connection internally
startSessionopen suspend fun startSession(streamingCapabilities: StreamingCapabilities? = null): StartSessionResponseStart a new conversation session
submitFeedbackopen suspend fun submitFeedback(feedbackInput: CopilotFeedbackInput): BooleanSubmit feedback for the conversation
uploadFilesopen suspend fun uploadFiles(sessionId: String?, file: File?, fileName: String, mimeType: String?): MutableList<UploadResponse>?Upload files for the conversation

The primary implementation is provided by AgentforceServiceImpl:

ParameterTypeDescription
networkNetworkNetwork interface for API communication
domainString?Salesforce org domain override
sseAgentforceServerSentEventsReal-time event streaming service
credentialProviderAgentforceAuthCredentialProviderAuthentication credential management
agentforceLoggerLogger?Logging interface implementation
agentforceInstrumentationHandlerAgentforceInstrumentationHandler?Analytics and monitoring integration
configurationLocaleLocale?Internationalization configuration
agentforceConnectionInfoAgentforceConnectionInfo?Connection metadata and session information
agentIdStringDefault agent identifier for conversations
contextContext?Android application context
orgIdString?Organization identifier
  • AgentforceServiceImpl - Primary implementation
  • MIAWCoreSDKService - Core SDK service implementation
  • MIAWAPIAgentforceService - MIAW API service implementation