- Have your own Speech-to-Text (STT) and Text-to-Speech (TTS) service.
- Adding GenerativeAgent to a text only channel like SMS or web site chat.
- Listening and Handling GenerativeAgent events. Create a single SSE stream where events from all conversations are sent.
-
Connecting your chat system and trigger GenerativeAgent.
- Create a conversation
- Add Messages
- Analyze a conversation

Before you Begin
Before you start integrating to GenerativeAgent, you need to:- Get your API Key Id and Secret
- Ensure your API key has been configured to access GenerativeAgent APIs. Reach out to your ASAPP team if you unsure.
- Configure Tasks and Functions.
Step 1: Listen and Handle GenerativeAgent Events
GenerativeAgent sends you events during the conversation. All events for all conversations being evaluated by GenerativeAgent are sent through the single Server-Sent-Event (SSE) stream.. To create the SSE stream URL, POST to/streams
:
streamId
. You will use this later to send the GenerativeAgent events to this SSE stream.
You need to listen and handle these events to enable GenerativeAgent to interact with your users.
Step 2: Create a Conversation
Aconversation
represents a thread of messages between an end user and one or more agents. GenerativeAgent evaluates and responds in a given conversation.
Create a conversation
providing your Ids for the conversation and customer:
id
. Save the conversation id as it is used when calling GenerativeAgent
Step 3: Add messages
Whether you are implementing a text based channel or using your own transcription, provide the utterances from your users by creatingmessages
. A message
represents a single communication within a conversation.
Create a message
providing the text of what your user said:
You can provide a single message as part of the
/analyze
call if that better works with the design of your system.Step 4: Analyze conversation with GenerativeAgent
Once you have the SSE stream connected and are sending messages, you need to engage GenerativeAgent with a given conversation. To have GenerativeAgent analyze a conversation, make a POST request to/analyze
:
streamId
created when you started the SSE Stream.
GenerativeAgent evaluates the conversation at that moment of time to determine a response. GenerativeAgent is not aware of any additional messages that are sent while processing.
A successful response returns a 200 and the conversation Id.
Analyze with Message
You have the option to send a message when calling analyze.Add Input Variables and Task context
As the conversation goes, it is possible to give GenerativeAgent more context of the conversation by using thetaskName
and inputVariables
attributes.
You can also simulate Tasks and Input Variables in the Previewer