Integrate AI agents into your web applications
connectAgent
function:
connectAgent
returns a PromiseAgentConnectionController
object.ConnectAgentConfig
object as the second parameter to connectAgent
.
debug
: Enables debug logging for troubleshooting.customGreeting
: Overrides the default greeting used by the agent.prompt
: Appends additional instructions to the agent’s core prompt.continueConversation
: An optional conversation ID to continue a previous conversation.listeners
: Attach various listener callbacks (see Event listeners section).AgentConnectionController
from connectAgent
, you can mute or unmute the user’s microphone:
agentController.hangup()
to end the conversation from the user side.
onHangup
callback (if provided) is triggered.
connectAgent
Promise. You can handle these errors in the catch
block.
Errors that occur during the conversation are caught by the onError
listener.