import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * An example represents a sample conversation between the user and the agent(s). * * ## Example Usage * * ### Ces Example Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * const my_app = new gcp.ces.App("my-app", { * location: "us", * displayName: "my-app", * appId: "app-id", * timeZoneSettings: { * timeZone: "America/Los_Angeles", * }, * }); * const cesTool = new gcp.ces.Tool("ces_tool", { * location: "us", * app: my_app.appId, * toolId: "tool-1", * executionType: "SYNCHRONOUS", * pythonFunction: { * name: "example_function", * pythonCode: "def example_function() -> int: return 0", * }, * }); * const cesToolset = new gcp.ces.Toolset("ces_toolset", { * toolsetId: "toolset-id", * location: "us", * app: my_app.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 cesBaseAgent = new gcp.ces.Agent("ces_base_agent", { * agentId: "base-agent-id", * location: "us", * app: my_app.appId, * displayName: "base agent", * instruction: "You are a helpful assistant for this example.", * modelSettings: { * model: "gemini-2.5-flash", * temperature: 0.5, * }, * llmAgent: {}, * }); * const cesChildAgent = new gcp.ces.Agent("ces_child_agent", { * agentId: "child-agent-id", * location: "us", * app: my_app.appId, * displayName: "child agent", * instruction: "You are a helpful assistant for this example.", * modelSettings: { * model: "gemini-2.5-flash", * temperature: 0.5, * }, * llmAgent: {}, * }); * const my_example = new gcp.ces.Example("my-example", { * location: "us", * displayName: "my-example", * app: my_app.name, * exampleId: "example-id", * description: "example description", * entryAgent: pulumi.all([my_app.project, my_app.appId, cesBaseAgent.agentId]).apply(([project, appId, agentId]) => `projects/${project}/locations/us/apps/${appId}/agents/${agentId}`), * messages: [{ * chunks: [ * { * agentTransfer: { * targetAgent: pulumi.all([my_app.project, my_app.appId, cesChildAgent.agentId]).apply(([project, appId, agentId]) => `projects/${project}/locations/us/apps/${appId}/agents/${agentId}`), * }, * }, * { * image: { * mimeType: "image/png", * data: std.base64encode({ * input: "This is some fake image binary data.", * }).then(invoke => invoke.result), * }, * }, * { * text: "text_data", * }, * { * toolCall: { * args: JSON.stringify({ * arg1: "val1", * arg2: "val2", * }), * id: "tool_call_id", * tool: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/tools/${cesTool.toolId}`, * }, * }, * { * toolCall: { * args: JSON.stringify({ * arg1: "val1", * arg2: "val2", * }), * id: "tool_call_id2", * toolsetTool: { * toolset: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/toolsets/${cesToolset.toolsetId}`, * toolId: "example-id", * }, * }, * }, * { * toolResponse: { * id: "tool_call_id", * response: JSON.stringify({ * output: "example-output", * }), * tool: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/tools/${cesTool.toolId}`, * }, * }, * { * toolResponse: { * id: "tool_call_id2", * response: JSON.stringify({ * output: "example-output", * }), * toolsetTool: { * toolset: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/toolsets/${cesToolset.toolsetId}`, * toolId: "example-id", * }, * }, * }, * { * updatedVariables: JSON.stringify({ * var1: "val1", * var2: "val2", * }), * }, * ], * role: "agent", * }], * }); * ``` * * ## Import * * Example can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/apps/{{app}}/examples/{{name}}` * * `{{project}}/{{location}}/{{app}}/{{name}}` * * `{{location}}/{{app}}/{{name}}` * * When using the `pulumi import` command, Example can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:ces/example:Example default projects/{{project}}/locations/{{location}}/apps/{{app}}/examples/{{name}} * $ pulumi import gcp:ces/example:Example default {{project}}/{{location}}/{{app}}/{{name}} * $ pulumi import gcp:ces/example:Example default {{location}}/{{app}}/{{name}} * ``` */ export declare class Example extends pulumi.CustomResource { /** * Get an existing Example 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?: ExampleState, opts?: pulumi.CustomResourceOptions): Example; /** * Returns true if the given object is an instance of Example. 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 Example; /** * Resource ID segment making up resource `name`, defining the app the example belongs to. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ readonly app: pulumi.Output; /** * Timestamp when the example was created. */ readonly createTime: pulumi.Output; /** * Human-readable description of the example. */ readonly description: pulumi.Output; /** * Display name of the example. */ readonly displayName: pulumi.Output; /** * The agent that initially handles the conversation. If not specified, the * example represents a conversation that is handled by the root agent. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ readonly entryAgent: 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; /** * The ID to use for the example, which will become the final component of * the example's resource name. In Terraform, this field is required. */ readonly exampleId: pulumi.Output; /** * The example may become invalid if referencing resources are deleted. * Invalid examples will not be used as few-shot examples. */ readonly invalid: pulumi.Output; /** * Resource ID segment making up resource `name`, defining what region the parent app is in. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ readonly location: pulumi.Output; /** * The collection of messages that make up the conversation. * Structure is documented below. */ readonly messages: pulumi.Output; /** * Identifier. The unique identifier of the example. * Format: * `projects/{project}/locations/{location}/apps/{app}/examples/{example}` */ 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; /** * Timestamp when the example was last updated. */ readonly updateTime: pulumi.Output; /** * Create a Example 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: ExampleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Example resources. */ export interface ExampleState { /** * Resource ID segment making up resource `name`, defining the app the example belongs to. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ app?: pulumi.Input; /** * Timestamp when the example was created. */ createTime?: pulumi.Input; /** * Human-readable description of the example. */ description?: pulumi.Input; /** * Display name of the example. */ displayName?: pulumi.Input; /** * The agent that initially handles the conversation. If not specified, the * example represents a conversation that is handled by the root agent. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ entryAgent?: 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; /** * The ID to use for the example, which will become the final component of * the example's resource name. In Terraform, this field is required. */ exampleId?: pulumi.Input; /** * The example may become invalid if referencing resources are deleted. * Invalid examples will not be used as few-shot examples. */ invalid?: pulumi.Input; /** * Resource ID segment making up resource `name`, defining what region the parent app is in. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ location?: pulumi.Input; /** * The collection of messages that make up the conversation. * Structure is documented below. */ messages?: pulumi.Input[]>; /** * Identifier. The unique identifier of the example. * Format: * `projects/{project}/locations/{location}/apps/{app}/examples/{example}` */ 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; /** * Timestamp when the example was last updated. */ updateTime?: pulumi.Input; } /** * The set of arguments for constructing a Example resource. */ export interface ExampleArgs { /** * Resource ID segment making up resource `name`, defining the app the example belongs to. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ app: pulumi.Input; /** * Human-readable description of the example. */ description?: pulumi.Input; /** * Display name of the example. */ displayName: pulumi.Input; /** * The agent that initially handles the conversation. If not specified, the * example represents a conversation that is handled by the root agent. * Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` */ entryAgent?: pulumi.Input; /** * The ID to use for the example, which will become the final component of * the example's resource name. In Terraform, this field is required. */ exampleId: pulumi.Input; /** * Resource ID segment making up resource `name`, defining what region the parent app is in. It identifies the resource within its parent collection as described in https://google.aip.dev/122. */ location: pulumi.Input; /** * The collection of messages that make up the conversation. * Structure is documented below. */ messages?: 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; }