Agentforce SDK also supports a headless experience for Agentic Use Cases that do not require a chat style interaction. The headless experience can also be used to build your own UI entirely.
Send Messages
To send a message to the agent, you can use the sendUtterance method on the AgentConversation object.
await conversation.sendUtterance(utterance: "Hello, world!", attachment: nil)
Receive Messages
To receive messages from the agent, you can subscribe to the messages publisher on the AgentConversation object.
conversation.messages
.sink { messages in
// Handle new messages
for message in messages {
print(message.message)
}
}
.store(in: &cancellables)
A message is an instance of an AgentforceMessage which includes a message property containing the primary text response from the agent and components which may contain rich UI component definitions for the response.
<!-- **[INFORMATION NEEDED: What additional headless capabilities exist?]** - What other methods are available on AgentConversation? - How do you handle different message types? - What about conversation state management? - How do you handle errors in headless mode? - What about conversation lifecycle management? -->Next Steps
- Customization: See Theming for visual customization