This guide walks you through the process of connecting an agent application to
a [Google Cloud CCaaS](https://cloud.google.com/contact-center/ccai-platform/docs)
instance.

## Before you begin

1. Follow the steps on the [setup and cleanup](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/quick/setup.md.txt) page to create or configure the project you'd like to use for the deployment. This project must be associated with both your agent application and Google Cloud CCaaS instance and be in the same `region`. Check your project to make sure of the following:
   - The `Dialogflow API` is enabled.
   - The service account you will use for the deployment has the `Dialogflow API Admin` (`roles/dialogflow.admin`) permission.
2. [Create and configure](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/quick/create-agent.md.txt) a CX Agent Studio agent application to use in the deployment.
3. [Create and configure](https://docs.cloud.google.com/contact-center/ccai-platform/docs/get-started.md.txt) a Google Cloud CCaaS contact center to use in the deployment.
4. The code snippets in this guide assume that you have the [gcloud CLI installed](https://docs.cloud.google.com/sdk/docs/install) and necessary permissions configured.

## Connect an agent application to a new conversation profile

Google Cloud CCaaS uses a [conversation profile](https://docs.cloud.google.com/gemini-enterprise-cx/agent-assist/basics.md.txt#conversation_profiles)
with [`useBidiStreaming`](https://docs.cloud.google.com/dialogflow/priv/docs/reference/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.ConversationProfile)
enabled to communicate with CX Agent Studio.

### Example request

The following sample creates a conversation profile with `useBidiStreaming`:

- <var translate="no">PROJECT_ID</var>: Your Google Cloud project ID.
- <var translate="no">REGION</var>: Only `us` and `eu` multi-regions are supported.
- <var translate="no">AGENT_NAME</var>: The name of the CX Agent Studio deployment or agent you want to associate with the conversation profile.
- <var translate="no">CONVERSATION_PROFILE_NAME</var>: Replace this value with the name you want to give the conversation profile.

```
curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "X-Goog-User-Project: PROJECT_ID" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{
        "displayName": "CONVERSATION_PROFILE_NAME",
        "languageCode": "en-US",
        "useBidiStreaming": true,
        "automatedAgentConfig": {
            "agent": "AGENT_NAME"
        }
      }' \
 https://REGION-dialogflow.googleapis.com/v2beta1/projects/PROJECT_ID/locations/REGION/conversationProfiles
```

### Example response

```
{
  "name": "projects/ccaip-apps-incub-0fcb/locations/global/conversationProfiles/bAp81fGqTg-sp3TUNYTZlw",
  "displayName": "CONVERSATION_PROFILE_NAME",
  "automatedAgentConfig": {
    "agent": "projects/ccaip-apps-incub-0fcb/locations/global/apps/6afaa63d-49a3-4b89-8923-18cbe9b48ae5"
  },
  "languageCode": "en-US",
  "createTime": "2025-08-21T22:11:12.782515Z",
  "updateTime": "2025-08-21T22:11:12.782515Z",
  "useBidiStreaming": true
}
```

## Connect an agent application to a pre-existing conversation profile

The conversation profile must be associated with an agent application and
configured to enable [`useBidiStreaming`](https://docs.cloud.google.com/dialogflow/priv/docs/reference/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.ConversationProfile).

The following sample creates a conversation profile with `useBidiStreaming`:

### Connect agent application sample request

- <var translate="no">PROJECT_ID</var>: Your Google Cloud project ID.
- <var translate="no">INTEGRATION_ID</var>: Returned in the response. This is the integration ID of your new conversation profile.
- <var translate="no">REGION</var>: Only `us` and `eu` multi-regions are supported.
- <var translate="no">APP_ID</var>: The ID value of the CX Agent Studio agent application you want to associate with the conversation profile.

```
curl -X PATCH \
  -H "x-goog-user-project: PROJECT_ID" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"automatedAgentConfig": {"agent": "APP_ID"}}' "https://REGION-dialogflow.googleapis.com/v2beta1/INTEGRATION_ID?updateMask=automatedAgentConfig.agent"
```

### Connect agent application sample response

```
{
  "name": "projects/ccaip-apps-incub-0fcb/locations/us/conversationProfiles/FRDHwh2gS-O1n5SpoxKLfg",
  "displayName": "bdsac_us_polysynth_agent",
  "automatedAgentConfig": {
    "agent": "projects/ccaip-apps-incub-0fcb/locations/us/apps/6afaa63d-49a3-4b89-8923-18cbe9b48ae5"
  },
  "humanAgentAssistantConfig": {
    "humanAgentSuggestionConfig": {},
    "messageAnalysisConfig": {}
  },
  "sttConfig": {
    "model": "telephony",
    "useLongFormModel": true
  },
  "languageCode": "en-US",
  "updateTime": "2025-08-06T21:35:13.388052Z",
  "telephonySttConfig": {}
}
```

### Enable `useBidiStreaming` sample request

- <var translate="no">PROJECT_ID</var>: Your Google Cloud project ID.
- <var translate="no">INTEGRATION_ID</var>: Returned in the response. This is the integration ID of your new conversation profile.
- <var translate="no">REGION</var>: Only `us` and `eu` multi-regions are supported.

```
curl -X PATCH \
  -H "x-goog-user-project:PROJECT_ID" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{ "useBidiStreaming": true }' "https://REGION-dialogflow.googleapis.com/v2beta1/INTEGRATION_ID?updateMask=useBidiStreaming"
```

### Enable `useBidiStreaming` sample response

```
{
  "name": "projects/ccaip-apps-incub-0fcb/locations/us/conversationProfiles/FRDHwh2gS-O1n5SpoxKLfg",
  "displayName": "bdsac_us_polysynth_agent",
  "automatedAgentConfig": {
    "agent": "projects/ccaip-apps-incub-0fcb/locations/us/apps/6afaa63d-49a3-4b89-8923-18cbe9b48ae5"
  },
  "humanAgentAssistantConfig": {
    "humanAgentSuggestionConfig": {},
    "messageAnalysisConfig": {}
  },
  "sttConfig": {
    "model": "telephony",
    "useLongFormModel": true
  },
  "languageCode": "en-US",
  "updateTime": "2025-08-06T21:54:12.206269Z",
  "telephonySttConfig": {},
  "useBidiStreaming": true
}
```