---
schema_version: "1"
id: b282a33e4b528bf7a2b412122475c9d0a057a58f99fe337d1a7042acded32017
title: AgentforceConversation
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/genai/agentforce-mobile-sdk/references/ios/agentforce-conversation-ios.md
canonical_url: https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/references/agentforce-mobile-sdk/agentforce-conversation-ios.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 509f3b387e473e32d0aab2e55d03f293bd266a6ed73cfd207e8ef30fbe1773e2
products:
  - Agentforce Mobile SDK
  - Agentforce and Einstein Generative AI
---
# AgentforceConversation

## Overview

Concrete implementation of the AgentConversation protocol providing full conversation management capabilities. It orchestrates all aspects of a conversation session including service communication, state management, message processing, and context handling. This class serves as the primary interface between application code and the underlying Agentforce service infrastructure.

## Declaration

```swift
class AgentforceConversation
```

## Properties

| Property             | Type                                             | Description                                                              |
| -------------------- | ------------------------------------------------ | ------------------------------------------------------------------------ |
| agentId              | String?                                          | The identifier of the agent handling this conversation                   |
| conversationId       | UUID                                             | Unique identifier for this conversation instance                         |
| conversationState    | Published<AgentforceConversationState>.Publisher | Publisher providing real-time conversation state updates                 |
| messages             | Published<[AgentforceMessage]>.Publisher         | Publisher providing access to the complete conversation message history  |
| sessionId            | String?                                          | The unique session identifier for this conversation                      |
| hasEnded             | Bool                                             | Indicates whether the conversation has been explicitly ended by the user |
| isHumanAgentMode     | Bool                                             | Indicates whether the conversation is with a human agent                 |
| statusEvents         | AnyPublisher<AgentforceEvent, Never>             | Publisher for status events (typing indicators, etc.)                    |
| systemEvents         | AnyPublisher<AgentforceEvent, Never>             | Publisher for system events (participant changes, escalations, etc.)     |
| deliveryStatusEvents | AnyPublisher<MessageDeliveryStatusEvent, Never>  | Publisher for delivery status events                                     |

## Methods

| Method                      | Signature                                                                      | Description                                                                             |
| --------------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| sendUtterance               | func sendUtterance(utterance: String, attachment: AgentforceAttachment?) async | Sends a user message to the agent with optional file attachments                        |
| setAdditionalContext        | func setAdditionalContext(context: [AgentforceVariable])                       | Updates the conversation context with additional variables that inform agent responses  |
| closeConversation           | func closeConversation() async throws                                          | Closes the current conversation session and clears the session ID to prevent resumption |
| endConversation             | func endConversation() async throws                                            | Ends the current conversation session                                                   |
| reset                       | func reset() async throws                                                      | Removes all messages from the conversation                                              |
| recommendedUtterances       | func recommendedUtterances() async throws -> [String]                          | Manually retrieve recommended utterances (fetches fresh data)                           |
| updateRecommendedUtterances | func updateRecommendedUtterances(recommendations: [String])                    | Updates the conversation with recommended utterances for quick user interaction         |
| downloadTranscript          | func downloadTranscript() async throws -> TranscriptResponse                   | Downloads a PDF transcript of the current conversation                                  |
