Agent Assist backend modules basics

Agent Assist now offers backend modules, an out-of-the-box option for integrating Agent Assist into your system. Backend modules includes a Cloud Pub/Sub Interceptor service and a UI Connector service. The Interceptor processes feature-related event notifications from Dialogflow using Cloud Pub/Sub topics and then the UI Connector pushes them to the agent desktop UI. UI Connectors also support feedback signals from the agent desktop and sends them to Dialogflow.

Backend modules structure

Backend modules components

Cloud Pub/Sub

Cloud Pub/Sub topics are configured in conversation profiles. Agent Assist will then publish suggestions, new messages, and conversation lifecycle-related events to the topic. Suggestions are in the form of HumanAgentAssistantEvent, and both new messages and conversation lifecycle events in the form of ConversationEvent. For each conversation profile, these three kinds of event messages are published to different topics. For example, a conversation lifecycle event message might be {"conversation":"projects/your-project-id/locations/global/conversations/your-conversation-id","type":"CONVERSATION_STARTED"}, which indicates the start of a conversation.

Cloud Pub/Sub Interceptor

The Cloud Pub/Sub Interceptor is deployed on Cloud Run. The functionality of each container instance (server) of this Cloud Run service is identical to each other instance, including:

  • Processing event messages posted by Cloud Pub/Sub topics using HTTP requests.
  • Publishing messages received to Redis Pub/Sub channels, specific to the conversation name and the UI connector server ID. The channel format is {connector_id}:{conversation_name}.


Redis uses Memorystore for Redis. * Records the UI connector server ID information for each conversation in mapping <conversation_name, connector_id>. * Forwards event notifications published by Cloud Pub/Sub Interceptor to the corresponding UI connector server using the Redis Pub/Sub mechanism.

UI connector

UI connectors are deployed on Cloud Run. Because WebSockets connections are stateful, the agent desktop will stay connected to the same container on Cloud Run throughout the lifespan of the connection. Therefore, every UI connector server handles different conversations and subscribes to distinct Redis Pub/Sub channels ({connector_id}:*) for the conversations they handle. Tasks for each UI connector server:

  • Supports a customized authentication method for agent desktops.
  • Generates temporary JWT after authenticating agent desktops' customized tokens. When they send requests to the Dialogflow API or WebSockets connection, UI connectors validate the attached JWT instead of checking the original agent token.
  • Establishes a WebSockets connection with the authenticated agent desktop based on a given conversation name.
  • Subscribes event messages to Redis Pub/Sub channels for the conversations it handles.
  • Pushes Agent Assist events to the desktop UI as they are received.

Secret Manager

UI Connector needs a JWT secret key to generate temporary JWTs for authenticated agent desktops. This secret key is stored in the Secret Manager.


The following is an outline of directory structure in the code repository. Contact your Google representative for permissions if you are not able to access the repository.

├── cloud-pubsub-interceptor
│   ├── Dockerfile - Builds Docker image for Cloud Pub/Sub Interceptor deployment on Cloud Run
│   ├── - A starter for flask app
│   ├── requirements.txt
│   └── - Unit test code for Cloud Pub/Sub Interceptor
└── ui-connector
    ├── - Handles JWT validation and registration
    ├── - Configures variables about authentication, logging and CORS origins
    ├── - Includes dialogflow utilities for handling conversations at runtime
    ├── Dockerfile - Builds Docker image for UI Connector deployment on Cloud Run
    ├── - A starter for flask app
    ├── requirements.txt
    ├── templates
    │   └── index.html - A simple interactive demo
    └── - Unit test code for UI Connector

What's next

See the backend modules installation guide for more information about getting started with this integration method.