@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
395 lines • 15.3 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Agent = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Description
*
* ## Example Usage
*
* ### Ces Agent Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const cesAppForAgent = new gcp.ces.App("ces_app_for_agent", {
* appId: "app-id",
* location: "us",
* description: "App used as parent for CES Agent example",
* displayName: "my-app",
* languageSettings: {
* defaultLanguageCode: "en-US",
* supportedLanguageCodes: [
* "es-ES",
* "fr-FR",
* ],
* enableMultilingualSupport: true,
* fallbackAction: "escalate",
* },
* timeZoneSettings: {
* timeZone: "America/Los_Angeles",
* },
* });
* const cesToolForAgent = new gcp.ces.Tool("ces_tool_for_agent", {
* location: "us",
* app: cesAppForAgent.appId,
* toolId: "tool-1",
* executionType: "SYNCHRONOUS",
* pythonFunction: {
* name: "example_function",
* pythonCode: "def example_function() -> int: return 0",
* },
* });
* const cesToolsetForAgent = new gcp.ces.Toolset("ces_toolset_for_agent", {
* toolsetId: "toolset-id",
* location: "us",
* app: cesAppForAgent.appId,
* displayName: "Basic toolset display name",
* openApiToolset: {
* openApiSchema: `openapi: 3.0.0
* info:
* title: My Sample API
* version: 1.0.0
* description: A simple API example
* servers:
* - url: https://api.example.com/v1
* paths: {}
* `,
* ignoreUnknownFields: false,
* tlsConfig: {
* caCerts: [{
* displayName: "example",
* cert: "ZXhhbXBsZQ==",
* }],
* },
* serviceDirectoryConfig: {
* service: "projects/example/locations/us/namespaces/namespace/services/service",
* },
* apiAuthentication: {
* serviceAgentIdTokenAuthConfig: {},
* },
* },
* });
* const cesChildAgent = new gcp.ces.Agent("ces_child_agent", {
* agentId: "child-agent-id",
* location: "us",
* app: cesAppForAgent.appId,
* displayName: "child agent",
* instruction: "You are a helpful assistant for this example.",
* modelSettings: {
* model: "gemini-3.0-flash-001",
* temperature: 0.5,
* },
* llmAgent: {},
* });
* const cesGuardrailForAgent = new gcp.ces.Guardrail("ces_guardrail_for_agent", {
* guardrailId: "guardrail-id",
* location: cesAppForAgent.location,
* app: cesAppForAgent.appId,
* displayName: "Example guardrail",
* description: "Guardrail description",
* action: {
* respondImmediately: {
* responses: [{
* text: "Text",
* disabled: false,
* }],
* },
* },
* enabled: true,
* modelSafety: {
* safetySettings: [{
* category: "HARM_CATEGORY_HATE_SPEECH",
* threshold: "BLOCK_NONE",
* }],
* },
* });
* const cesAgentBasic = new gcp.ces.Agent("ces_agent_basic", {
* agentId: "agent-id",
* location: "us",
* app: cesAppForAgent.appId,
* displayName: "my-agent",
* description: "test agent",
* instruction: "You are a helpful assistant for this example.",
* modelSettings: {
* model: "gemini-3.0-flash-001",
* temperature: 0.5,
* },
* beforeAgentCallbacks: [{
* description: "Example callback",
* disabled: true,
* pythonCode: "def before_agent_callback(callback_context): return None",
* }],
* afterAgentCallbacks: [{
* description: "Example callback",
* disabled: true,
* pythonCode: "def after_agent_callback(callback_context): return None",
* }],
* beforeModelCallbacks: [{
* description: "Example callback",
* disabled: true,
* pythonCode: "def before_model_callback(callback_context, llm_request): return None",
* }],
* afterModelCallbacks: [{
* description: "Example callback",
* disabled: true,
* pythonCode: "def after_model_callback(callback_context, llm_response): return None",
* }],
* beforeToolCallbacks: [{
* description: "Example callback",
* disabled: true,
* pythonCode: "def before_tool_callback(tool, input, callback_context): return None",
* }],
* afterToolCallbacks: [{
* description: "Example callback",
* disabled: true,
* pythonCode: "def after_tool_callback(tool, input, callback_context, tool_response): return None",
* }],
* tools: [cesToolForAgent.id],
* guardrails: [cesGuardrailForAgent.id],
* toolsets: [{
* toolset: cesToolsetForAgent.id,
* toolIds: ["testtoolid"],
* }],
* childAgents: [pulumi.all([cesAppForAgent.project, cesAppForAgent.appId, cesChildAgent.agentId]).apply(([project, appId, agentId]) => `projects/${project}/locations/us/apps/${appId}/agents/${agentId}`)],
* llmAgent: {},
* });
* ```
* ### Ces Agent Remote Dialogflow Agent
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const cesAppForAgent = new gcp.ces.App("ces_app_for_agent", {
* appId: "app-id",
* location: "us",
* description: "App used as parent for CES Agent example",
* displayName: "my-app",
* languageSettings: {
* defaultLanguageCode: "en-US",
* supportedLanguageCodes: [
* "es-ES",
* "fr-FR",
* ],
* enableMultilingualSupport: true,
* fallbackAction: "escalate",
* },
* timeZoneSettings: {
* timeZone: "America/Los_Angeles",
* },
* });
* const cesAgentRemoteDialogflowAgent = new gcp.ces.Agent("ces_agent_remote_dialogflow_agent", {
* agentId: "agent-id",
* location: "us",
* app: cesAppForAgent.appId,
* displayName: "my-agent",
* modelSettings: {
* model: "gemini-3.0-flash-001",
* temperature: 0.5,
* },
* remoteDialogflowAgent: {
* agent: "projects/example/locations/us/agents/fake-agent",
* flowId: "fake-flow",
* environmentId: "fake-env",
* inputVariableMapping: {
* example: "1",
* },
* outputVariableMapping: {
* example: "1",
* },
* },
* });
* ```
* ### Ces Agent Remote Dialogflow Agent Interruption
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const cesAppForAgent = new gcp.ces.App("ces_app_for_agent", {
* appId: "app-id",
* location: "us",
* description: "App used as parent for CES Agent example",
* displayName: "my-app",
* languageSettings: {
* defaultLanguageCode: "en-US",
* supportedLanguageCodes: [
* "es-ES",
* "fr-FR",
* ],
* enableMultilingualSupport: true,
* fallbackAction: "escalate",
* },
* timeZoneSettings: {
* timeZone: "America/Los_Angeles",
* },
* });
* const cesAgentRemoteDialogflowAgentInterruption = new gcp.ces.Agent("ces_agent_remote_dialogflow_agent_interruption", {
* agentId: "agent-id",
* location: "us",
* app: cesAppForAgent.appId,
* displayName: "my-agent",
* modelSettings: {
* model: "gemini-3.0-flash-001",
* temperature: 0.5,
* },
* remoteDialogflowAgent: {
* agent: "projects/example/locations/us/agents/fake-agent",
* flowId: "fake-flow",
* environmentId: "fake-env",
* respectResponseInterruptionSettings: true,
* inputVariableMapping: {
* example: "1",
* },
* outputVariableMapping: {
* example: "1",
* },
* },
* });
* ```
*
* ## Import
*
* Agent can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/apps/{{app}}/agents/{{name}}`
* * `{{project}}/{{location}}/{{app}}/{{name}}`
* * `{{location}}/{{app}}/{{name}}`
*
* When using the `pulumi import` command, Agent can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:ces/agent:Agent default projects/{{project}}/locations/{{location}}/apps/{{app}}/agents/{{name}}
* $ pulumi import gcp:ces/agent:Agent default {{project}}/{{location}}/{{app}}/{{name}}
* $ pulumi import gcp:ces/agent:Agent default {{location}}/{{app}}/{{name}}
* ```
*/
class Agent extends pulumi.CustomResource {
/**
* Get an existing Agent resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Agent(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:ces/agent:Agent';
/**
* Returns true if the given object is an instance of Agent. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Agent.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["afterAgentCallbacks"] = state?.afterAgentCallbacks;
resourceInputs["afterModelCallbacks"] = state?.afterModelCallbacks;
resourceInputs["afterToolCallbacks"] = state?.afterToolCallbacks;
resourceInputs["agentId"] = state?.agentId;
resourceInputs["app"] = state?.app;
resourceInputs["beforeAgentCallbacks"] = state?.beforeAgentCallbacks;
resourceInputs["beforeModelCallbacks"] = state?.beforeModelCallbacks;
resourceInputs["beforeToolCallbacks"] = state?.beforeToolCallbacks;
resourceInputs["childAgents"] = state?.childAgents;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["etag"] = state?.etag;
resourceInputs["generatedSummary"] = state?.generatedSummary;
resourceInputs["guardrails"] = state?.guardrails;
resourceInputs["instruction"] = state?.instruction;
resourceInputs["llmAgent"] = state?.llmAgent;
resourceInputs["location"] = state?.location;
resourceInputs["modelSettings"] = state?.modelSettings;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["remoteDialogflowAgent"] = state?.remoteDialogflowAgent;
resourceInputs["tools"] = state?.tools;
resourceInputs["toolsets"] = state?.toolsets;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.app === undefined && !opts.urn) {
throw new Error("Missing required property 'app'");
}
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["afterAgentCallbacks"] = args?.afterAgentCallbacks;
resourceInputs["afterModelCallbacks"] = args?.afterModelCallbacks;
resourceInputs["afterToolCallbacks"] = args?.afterToolCallbacks;
resourceInputs["agentId"] = args?.agentId;
resourceInputs["app"] = args?.app;
resourceInputs["beforeAgentCallbacks"] = args?.beforeAgentCallbacks;
resourceInputs["beforeModelCallbacks"] = args?.beforeModelCallbacks;
resourceInputs["beforeToolCallbacks"] = args?.beforeToolCallbacks;
resourceInputs["childAgents"] = args?.childAgents;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["guardrails"] = args?.guardrails;
resourceInputs["instruction"] = args?.instruction;
resourceInputs["llmAgent"] = args?.llmAgent;
resourceInputs["location"] = args?.location;
resourceInputs["modelSettings"] = args?.modelSettings;
resourceInputs["project"] = args?.project;
resourceInputs["remoteDialogflowAgent"] = args?.remoteDialogflowAgent;
resourceInputs["tools"] = args?.tools;
resourceInputs["toolsets"] = args?.toolsets;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["generatedSummary"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Agent.__pulumiType, name, resourceInputs, opts);
}
}
exports.Agent = Agent;
//# sourceMappingURL=agent.js.map