CxAgent

class CxAgent : KotlinCustomResource

Agents are best described as Natural Language Understanding (NLU) modules that transform user requests into actionable data. You can include agents in your app, product, or service to determine user intent and respond to the user in a natural way. To get more information about Agent, see:

Example Usage

Dialogflowcx Agent Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const bucket = new gcp.storage.Bucket("bucket", {
name: "dialogflowcx-bucket",
location: "US",
uniformBucketLevelAccess: true,
});
const fullAgent = new gcp.diagflow.CxAgent("full_agent", {
displayName: "dialogflowcx-agent",
location: "global",
defaultLanguageCode: "en",
supportedLanguageCodes: [
"fr",
"de",
"es",
],
timeZone: "America/New_York",
description: "Example description.",
avatarUri: "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
enableStackdriverLogging: true,
enableSpellCorrection: true,
speechToTextSettings: {
enableSpeechAdaptation: true,
},
advancedSettings: {
audioExportGcsDestination: {
uri: pulumi.interpolate`${bucket.url}/prefix-`,
},
dtmfSettings: {
enabled: true,
maxDigits: 1,
finishDigit: "#",
},
},
gitIntegrationSettings: {
githubSettings: {
displayName: "Github Repo",
repositoryUri: "https://api.github.com/repos/githubtraining/hellogitworld",
trackingBranch: "main",
accessToken: "secret-token",
branches: ["main"],
},
},
textToSpeechSettings: {
synthesizeSpeechConfigs: JSON.stringify({
en: {
voice: {
name: "en-US-Neural2-A",
},
},
fr: {
voice: {
name: "fr-CA-Neural2-A",
},
},
}),
},
});
import pulumi
import json
import pulumi_gcp as gcp
bucket = gcp.storage.Bucket("bucket",
name="dialogflowcx-bucket",
location="US",
uniform_bucket_level_access=True)
full_agent = gcp.diagflow.CxAgent("full_agent",
display_name="dialogflowcx-agent",
location="global",
default_language_code="en",
supported_language_codes=[
"fr",
"de",
"es",
],
time_zone="America/New_York",
description="Example description.",
avatar_uri="https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
enable_stackdriver_logging=True,
enable_spell_correction=True,
speech_to_text_settings={
"enable_speech_adaptation": True,
},
advanced_settings={
"audio_export_gcs_destination": {
"uri": bucket.url.apply(lambda url: f"{url}/prefix-"),
},
"dtmf_settings": {
"enabled": True,
"max_digits": 1,
"finish_digit": "#",
},
},
git_integration_settings={
"github_settings": {
"display_name": "Github Repo",
"repository_uri": "https://api.github.com/repos/githubtraining/hellogitworld",
"tracking_branch": "main",
"access_token": "secret-token",
"branches": ["main"],
},
},
text_to_speech_settings={
"synthesize_speech_configs": json.dumps({
"en": {
"voice": {
"name": "en-US-Neural2-A",
},
},
"fr": {
"voice": {
"name": "fr-CA-Neural2-A",
},
},
}),
})
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var bucket = new Gcp.Storage.Bucket("bucket", new()
{
Name = "dialogflowcx-bucket",
Location = "US",
UniformBucketLevelAccess = true,
});
var fullAgent = new Gcp.Diagflow.CxAgent("full_agent", new()
{
DisplayName = "dialogflowcx-agent",
Location = "global",
DefaultLanguageCode = "en",
SupportedLanguageCodes = new[]
{
"fr",
"de",
"es",
},
TimeZone = "America/New_York",
Description = "Example description.",
AvatarUri = "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
EnableStackdriverLogging = true,
EnableSpellCorrection = true,
SpeechToTextSettings = new Gcp.Diagflow.Inputs.CxAgentSpeechToTextSettingsArgs
{
EnableSpeechAdaptation = true,
},
AdvancedSettings = new Gcp.Diagflow.Inputs.CxAgentAdvancedSettingsArgs
{
AudioExportGcsDestination = new Gcp.Diagflow.Inputs.CxAgentAdvancedSettingsAudioExportGcsDestinationArgs
{
Uri = bucket.Url.Apply(url => $"{url}/prefix-"),
},
DtmfSettings = new Gcp.Diagflow.Inputs.CxAgentAdvancedSettingsDtmfSettingsArgs
{
Enabled = true,
MaxDigits = 1,
FinishDigit = "#",
},
},
GitIntegrationSettings = new Gcp.Diagflow.Inputs.CxAgentGitIntegrationSettingsArgs
{
GithubSettings = new Gcp.Diagflow.Inputs.CxAgentGitIntegrationSettingsGithubSettingsArgs
{
DisplayName = "Github Repo",
RepositoryUri = "https://api.github.com/repos/githubtraining/hellogitworld",
TrackingBranch = "main",
AccessToken = "secret-token",
Branches = new[]
{
"main",
},
},
},
TextToSpeechSettings = new Gcp.Diagflow.Inputs.CxAgentTextToSpeechSettingsArgs
{
SynthesizeSpeechConfigs = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["en"] = new Dictionary<string, object?>
{
["voice"] = new Dictionary<string, object?>
{
["name"] = "en-US-Neural2-A",
},
},
["fr"] = new Dictionary<string, object?>
{
["voice"] = new Dictionary<string, object?>
{
["name"] = "fr-CA-Neural2-A",
},
},
}),
},
});
});
package main
import (
"encoding/json"
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/diagflow"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
Name: pulumi.String("dialogflowcx-bucket"),
Location: pulumi.String("US"),
UniformBucketLevelAccess: pulumi.Bool(true),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"en": map[string]interface{}{
"voice": map[string]interface{}{
"name": "en-US-Neural2-A",
},
},
"fr": map[string]interface{}{
"voice": map[string]interface{}{
"name": "fr-CA-Neural2-A",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = diagflow.NewCxAgent(ctx, "full_agent", &diagflow.CxAgentArgs{
DisplayName: pulumi.String("dialogflowcx-agent"),
Location: pulumi.String("global"),
DefaultLanguageCode: pulumi.String("en"),
SupportedLanguageCodes: pulumi.StringArray{
pulumi.String("fr"),
pulumi.String("de"),
pulumi.String("es"),
},
TimeZone: pulumi.String("America/New_York"),
Description: pulumi.String("Example description."),
AvatarUri: pulumi.String("https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png"),
EnableStackdriverLogging: pulumi.Bool(true),
EnableSpellCorrection: pulumi.Bool(true),
SpeechToTextSettings: &diagflow.CxAgentSpeechToTextSettingsArgs{
EnableSpeechAdaptation: pulumi.Bool(true),
},
AdvancedSettings: &diagflow.CxAgentAdvancedSettingsArgs{
AudioExportGcsDestination: &diagflow.CxAgentAdvancedSettingsAudioExportGcsDestinationArgs{
Uri: bucket.Url.ApplyT(func(url string) (string, error) {
return fmt.Sprintf("%v/prefix-", url), nil
}).(pulumi.StringOutput),
},
DtmfSettings: &diagflow.CxAgentAdvancedSettingsDtmfSettingsArgs{
Enabled: pulumi.Bool(true),
MaxDigits: pulumi.Int(1),
FinishDigit: pulumi.String("#"),
},
},
GitIntegrationSettings: &diagflow.CxAgentGitIntegrationSettingsArgs{
GithubSettings: &diagflow.CxAgentGitIntegrationSettingsGithubSettingsArgs{
DisplayName: pulumi.String("Github Repo"),
RepositoryUri: pulumi.String("https://api.github.com/repos/githubtraining/hellogitworld"),
TrackingBranch: pulumi.String("main"),
AccessToken: pulumi.String("secret-token"),
Branches: pulumi.StringArray{
pulumi.String("main"),
},
},
},
TextToSpeechSettings: &diagflow.CxAgentTextToSpeechSettingsArgs{
SynthesizeSpeechConfigs: pulumi.String(json0),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.diagflow.CxAgent;
import com.pulumi.gcp.diagflow.CxAgentArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentSpeechToTextSettingsArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentAdvancedSettingsArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentAdvancedSettingsAudioExportGcsDestinationArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentAdvancedSettingsDtmfSettingsArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentGitIntegrationSettingsArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentGitIntegrationSettingsGithubSettingsArgs;
import com.pulumi.gcp.diagflow.inputs.CxAgentTextToSpeechSettingsArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var bucket = new Bucket("bucket", BucketArgs.builder()
.name("dialogflowcx-bucket")
.location("US")
.uniformBucketLevelAccess(true)
.build());
var fullAgent = new CxAgent("fullAgent", CxAgentArgs.builder()
.displayName("dialogflowcx-agent")
.location("global")
.defaultLanguageCode("en")
.supportedLanguageCodes(
"fr",
"de",
"es")
.timeZone("America/New_York")
.description("Example description.")
.avatarUri("https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png")
.enableStackdriverLogging(true)
.enableSpellCorrection(true)
.speechToTextSettings(CxAgentSpeechToTextSettingsArgs.builder()
.enableSpeechAdaptation(true)
.build())
.advancedSettings(CxAgentAdvancedSettingsArgs.builder()
.audioExportGcsDestination(CxAgentAdvancedSettingsAudioExportGcsDestinationArgs.builder()
.uri(bucket.url().applyValue(url -> String.format("%s/prefix-", url)))
.build())
.dtmfSettings(CxAgentAdvancedSettingsDtmfSettingsArgs.builder()
.enabled(true)
.maxDigits(1)
.finishDigit("#")
.build())
.build())
.gitIntegrationSettings(CxAgentGitIntegrationSettingsArgs.builder()
.githubSettings(CxAgentGitIntegrationSettingsGithubSettingsArgs.builder()
.displayName("Github Repo")
.repositoryUri("https://api.github.com/repos/githubtraining/hellogitworld")
.trackingBranch("main")
.accessToken("secret-token")
.branches("main")
.build())
.build())
.textToSpeechSettings(CxAgentTextToSpeechSettingsArgs.builder()
.synthesizeSpeechConfigs(serializeJson(
jsonObject(
jsonProperty("en", jsonObject(
jsonProperty("voice", jsonObject(
jsonProperty("name", "en-US-Neural2-A")
))
)),
jsonProperty("fr", jsonObject(
jsonProperty("voice", jsonObject(
jsonProperty("name", "fr-CA-Neural2-A")
))
))
)))
.build())
.build());
}
}
resources:
bucket:
type: gcp:storage:Bucket
properties:
name: dialogflowcx-bucket
location: US
uniformBucketLevelAccess: true
fullAgent:
type: gcp:diagflow:CxAgent
name: full_agent
properties:
displayName: dialogflowcx-agent
location: global
defaultLanguageCode: en
supportedLanguageCodes:
- fr
- de
- es
timeZone: America/New_York
description: Example description.
avatarUri: https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png
enableStackdriverLogging: true
enableSpellCorrection: true
speechToTextSettings:
enableSpeechAdaptation: true
advancedSettings:
audioExportGcsDestination:
uri: ${bucket.url}/prefix-
dtmfSettings:
enabled: true
maxDigits: 1
finishDigit: '#'
gitIntegrationSettings:
githubSettings:
displayName: Github Repo
repositoryUri: https://api.github.com/repos/githubtraining/hellogitworld
trackingBranch: main
accessToken: secret-token
branches:
- main
textToSpeechSettings:
synthesizeSpeechConfigs:
fn::toJSON:
en:
voice:
name: en-US-Neural2-A
fr:
voice:
name: fr-CA-Neural2-A

Import

Agent can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/agents/{{name}}

  • {{project}}/{{location}}/{{name}}

  • {{location}}/{{name}} When using the pulumi import command, Agent can be imported using one of the formats above. For example:

$ pulumi import gcp:diagflow/cxAgent:CxAgent default projects/{{project}}/locations/{{location}}/agents/{{name}}
$ pulumi import gcp:diagflow/cxAgent:CxAgent default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:diagflow/cxAgent:CxAgent default {{location}}/{{name}}

Properties

Link copied to clipboard

Hierarchical advanced settings for this agent. The settings exposed at the lower level overrides the settings exposed at the higher level. Hierarchy: Agent->Flow->Page->Fulfillment/Parameter. Structure is documented below.

Link copied to clipboard
val avatarUri: Output<String>?

The URI of the agent's avatar. Avatars are used throughout the Dialogflow console and in the self-hosted Web Demo integration.

Link copied to clipboard

The default language of the agent as a language tag. See Language Support for a list of the currently supported language codes. This field cannot be updated after creation.

Link copied to clipboard
val description: Output<String>?

The description of this agent. The maximum length is 500 characters. If exceeded, the request is rejected.

Link copied to clipboard
val displayName: Output<String>

The human-readable name of the agent, unique within the location.

Link copied to clipboard

Indicates if automatic spell correction is enabled in detect intent requests.

Link copied to clipboard

Determines whether this agent should log conversation queries.

Link copied to clipboard

Git integration settings for this agent. Structure is documented below.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val location: Output<String>

The name of the location this agent is located in.

Link copied to clipboard
val name: Output<String>

The unique identifier of the agent.

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val securitySettings: Output<String>?

Name of the SecuritySettings reference for the agent. Format: projects//locations//securitySettings/.

Link copied to clipboard

Settings related to speech recognition. Structure is documented below.

Link copied to clipboard
val startFlow: Output<String>

Name of the start flow in this agent. A start flow will be automatically created when the agent is created, and can only be deleted by deleting the agent. Format: projects//locations//agents//flows/.

Link copied to clipboard

The list of all languages supported by this agent (except for the default_language_code).

Link copied to clipboard

Settings related to speech synthesizing. Structure is documented below.

Link copied to clipboard
val timeZone: Output<String>

The time zone of this agent from the time zone database, e.g., America/New_York, Europe/Paris.

Link copied to clipboard
val urn: Output<String>