import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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-1.5-flash", * 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-1.5-flash", * temperature: 0.5, * }, * afterAgentCallbacks: [{ * description: "Example callback", * disabled: true, * pythonCode: `def callback(context): * return {'override': False}`, * }], * beforeAgentCallbacks: [{ * description: "Example callback", * disabled: false, * pythonCode: `def callback(context): * return {'override': False}`, * }], * afterModelCallbacks: [{ * description: "Example callback", * disabled: true, * pythonCode: `def callback(context): * return {'override': False}`, * }], * beforeModelCallbacks: [{ * description: "Example callback", * disabled: true, * pythonCode: `def callback(context): * return {'override': False}`, * }], * afterToolCallbacks: [{ * description: "Example callback", * disabled: true, * pythonCode: `def callback(context): * return {'override': False}`, * }], * beforeToolCallbacks: [{ * description: "Example callback", * disabled: true, * pythonCode: `def callback(context): * return {'override': False}`, * }], * 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-1.5-flash", * temperature: 0.5, * }, * remoteDialogflowAgent: { * agent: "projects/example/locations/us/agents/fake-agent", * flowId: "fake-flow", * environmentId: "fake-env", * 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}} * ``` * * ```sh * $ pulumi import gcp:ces/agent:Agent default {{project}}/{{location}}/{{app}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:ces/agent:Agent default {{location}}/{{app}}/{{name}} * ``` */ export declare 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: string, id: pulumi.Input, state?: AgentState, opts?: pulumi.CustomResourceOptions): 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: any): obj is Agent; /** * The callbacks to execute after the agent is called. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ readonly afterAgentCallbacks: pulumi.Output; /** * The callbacks to execute after the model is called. If there are multiple * calls to the model, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ readonly afterModelCallbacks: pulumi.Output; /** * The callbacks to execute after the tool is invoked. If there are multiple * tool invocations, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ readonly afterToolCallbacks: pulumi.Output; /** * The ID to use for the agent, which will become the final component of * the agent's resource name. If not provided, a unique ID will be * automatically assigned for the agent. */ readonly agentId: pulumi.Output; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ readonly app: pulumi.Output; /** * The callbacks to execute before the agent is called. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ readonly beforeAgentCallbacks: pulumi.Output; /** * The callbacks to execute before the model is called. If there are multiple * calls to the model, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ readonly beforeModelCallbacks: pulumi.Output; /** * The callbacks to execute before the tool is invoked. If there are multiple * tool invocations, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ readonly beforeToolCallbacks: pulumi.Output; /** * List of child agents in the agent tree. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ readonly childAgents: pulumi.Output; /** * Timestamp when the agent was created. */ readonly createTime: pulumi.Output; /** * Human-readable description of the agent. */ readonly description: pulumi.Output; /** * Display name of the agent. */ readonly displayName: pulumi.Output; /** * Etag used to ensure the object hasn't changed during a read-modify-write * operation. If the etag is empty, the update will overwrite any concurrent * changes. */ readonly etag: pulumi.Output; /** * If the agent is generated by the LLM assistant, this field contains a * descriptive summary of the generation. */ readonly generatedSummary: pulumi.Output; /** * List of guardrails for the agent. * Format: * `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}` */ readonly guardrails: pulumi.Output; /** * Instructions for the LLM model to guide the agent's behavior. */ readonly instruction: pulumi.Output; /** * Default agent type. The agent uses instructions and callbacks specified in * the agent to perform the task using a large language model. */ readonly llmAgent: pulumi.Output; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ readonly location: pulumi.Output; /** * Model settings contains various configurations for the LLM model. * Structure is documented below. */ readonly modelSettings: pulumi.Output; /** * Identifier. The unique identifier of the agent. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The agent which will transfer execution to an existing remote * [Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents) * agent flow. The corresponding Dialogflow agent will process subsequent user * queries until the session ends or flow ends and the control is transferred * back to the parent CES agent. * Structure is documented below. */ readonly remoteDialogflowAgent: pulumi.Output; /** * List of available tools for the agent. * Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}` */ readonly tools: pulumi.Output; /** * List of toolsets for the agent. * Structure is documented below. */ readonly toolsets: pulumi.Output; /** * Timestamp when the agent was last updated. */ readonly updateTime: pulumi.Output; /** * Create a Agent resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: AgentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Agent resources. */ export interface AgentState { /** * The callbacks to execute after the agent is called. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ afterAgentCallbacks?: pulumi.Input[]>; /** * The callbacks to execute after the model is called. If there are multiple * calls to the model, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ afterModelCallbacks?: pulumi.Input[]>; /** * The callbacks to execute after the tool is invoked. If there are multiple * tool invocations, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ afterToolCallbacks?: pulumi.Input[]>; /** * The ID to use for the agent, which will become the final component of * the agent's resource name. If not provided, a unique ID will be * automatically assigned for the agent. */ agentId?: pulumi.Input; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ app?: pulumi.Input; /** * The callbacks to execute before the agent is called. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ beforeAgentCallbacks?: pulumi.Input[]>; /** * The callbacks to execute before the model is called. If there are multiple * calls to the model, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ beforeModelCallbacks?: pulumi.Input[]>; /** * The callbacks to execute before the tool is invoked. If there are multiple * tool invocations, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ beforeToolCallbacks?: pulumi.Input[]>; /** * List of child agents in the agent tree. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ childAgents?: pulumi.Input[]>; /** * Timestamp when the agent was created. */ createTime?: pulumi.Input; /** * Human-readable description of the agent. */ description?: pulumi.Input; /** * Display name of the agent. */ displayName?: pulumi.Input; /** * Etag used to ensure the object hasn't changed during a read-modify-write * operation. If the etag is empty, the update will overwrite any concurrent * changes. */ etag?: pulumi.Input; /** * If the agent is generated by the LLM assistant, this field contains a * descriptive summary of the generation. */ generatedSummary?: pulumi.Input; /** * List of guardrails for the agent. * Format: * `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}` */ guardrails?: pulumi.Input[]>; /** * Instructions for the LLM model to guide the agent's behavior. */ instruction?: pulumi.Input; /** * Default agent type. The agent uses instructions and callbacks specified in * the agent to perform the task using a large language model. */ llmAgent?: pulumi.Input; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ location?: pulumi.Input; /** * Model settings contains various configurations for the LLM model. * Structure is documented below. */ modelSettings?: pulumi.Input; /** * Identifier. The unique identifier of the agent. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The agent which will transfer execution to an existing remote * [Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents) * agent flow. The corresponding Dialogflow agent will process subsequent user * queries until the session ends or flow ends and the control is transferred * back to the parent CES agent. * Structure is documented below. */ remoteDialogflowAgent?: pulumi.Input; /** * List of available tools for the agent. * Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}` */ tools?: pulumi.Input[]>; /** * List of toolsets for the agent. * Structure is documented below. */ toolsets?: pulumi.Input[]>; /** * Timestamp when the agent was last updated. */ updateTime?: pulumi.Input; } /** * The set of arguments for constructing a Agent resource. */ export interface AgentArgs { /** * The callbacks to execute after the agent is called. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ afterAgentCallbacks?: pulumi.Input[]>; /** * The callbacks to execute after the model is called. If there are multiple * calls to the model, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ afterModelCallbacks?: pulumi.Input[]>; /** * The callbacks to execute after the tool is invoked. If there are multiple * tool invocations, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ afterToolCallbacks?: pulumi.Input[]>; /** * The ID to use for the agent, which will become the final component of * the agent's resource name. If not provided, a unique ID will be * automatically assigned for the agent. */ agentId?: pulumi.Input; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ app: pulumi.Input; /** * The callbacks to execute before the agent is called. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ beforeAgentCallbacks?: pulumi.Input[]>; /** * The callbacks to execute before the model is called. If there are multiple * calls to the model, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ beforeModelCallbacks?: pulumi.Input[]>; /** * The callbacks to execute before the tool is invoked. If there are multiple * tool invocations, the callback will be executed multiple times. * The provided callbacks are executed sequentially in the exact order they * are given in the list. If a callback returns an overridden response, * execution stops and any remaining callbacks are skipped. * Structure is documented below. */ beforeToolCallbacks?: pulumi.Input[]>; /** * List of child agents in the agent tree. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ childAgents?: pulumi.Input[]>; /** * Human-readable description of the agent. */ description?: pulumi.Input; /** * Display name of the agent. */ displayName: pulumi.Input; /** * List of guardrails for the agent. * Format: * `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}` */ guardrails?: pulumi.Input[]>; /** * Instructions for the LLM model to guide the agent's behavior. */ instruction?: pulumi.Input; /** * Default agent type. The agent uses instructions and callbacks specified in * the agent to perform the task using a large language model. */ llmAgent?: pulumi.Input; /** * Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ location: pulumi.Input; /** * Model settings contains various configurations for the LLM model. * Structure is documented below. */ modelSettings?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The agent which will transfer execution to an existing remote * [Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents) * agent flow. The corresponding Dialogflow agent will process subsequent user * queries until the session ends or flow ends and the control is transferred * back to the parent CES agent. * Structure is documented below. */ remoteDialogflowAgent?: pulumi.Input; /** * List of available tools for the agent. * Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}` */ tools?: pulumi.Input[]>; /** * List of toolsets for the agent. * Structure is documented below. */ toolsets?: pulumi.Input[]>; }