Skip to content

Commit 5accf02

Browse files
authored
Adding fields to ces Example related to other resources (#15723)
1 parent d8157da commit 5accf02

File tree

3 files changed

+503
-3
lines changed

3 files changed

+503
-3
lines changed

mmv1/products/ces/Example.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ examples:
2929
app_display_name: 'my-app'
3030
example_id: 'example-id'
3131
app_id: 'app-id'
32+
base_agent_id: 'base-agent-id'
33+
child_agent_id: 'child-agent-id'
34+
toolset_id: 'toolset-id'
3235
autogen_status: RXhhbXBsZQ==
3336
parameters:
3437
- name: location
@@ -63,6 +66,12 @@ properties:
6366
type: String
6467
description: Display name of the example.
6568
required: true
69+
- name: entryAgent
70+
type: String
71+
description: |-
72+
The agent that initially handles the conversation. If not specified, the
73+
example represents a conversation that is handled by the root agent.
74+
Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
6675
- name: etag
6776
type: Fingerprint
6877
description: |-
@@ -88,6 +97,23 @@ properties:
8897
item_type:
8998
type: NestedObject
9099
properties:
100+
- name: agentTransfer
101+
type: NestedObject
102+
description: |-
103+
Represents an event indicating the transfer of a conversation to a different
104+
agent.
105+
properties:
106+
- name: displayName
107+
type: String
108+
description: Display name of the agent.
109+
output: true
110+
- name: targetAgent
111+
type: String
112+
description: |-
113+
The agent to which the conversation is being transferred. The agent will
114+
handle the conversation from this point forward.
115+
Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
116+
required: true
91117
- name: image
92118
type: NestedObject
93119
description: Represents an image input or output in the conversation.
@@ -108,6 +134,88 @@ properties:
108134
- name: text
109135
type: String
110136
description: Text data.
137+
- name: toolCall
138+
type: NestedObject
139+
description: Request for the client or the agent to execute the specified tool.
140+
properties:
141+
- name: args
142+
type: String
143+
description: The input parameters and values for the tool in JSON object format.
144+
custom_flatten: 'templates/terraform/custom_flatten/json_schema.tmpl'
145+
custom_expand: 'templates/terraform/custom_expand/json_schema.tmpl'
146+
validation:
147+
function: 'validation.StringIsJSON'
148+
- name: displayName
149+
type: String
150+
description: Display name of the tool.
151+
output: true
152+
- name: id
153+
type: String
154+
description: |-
155+
The unique identifier of the tool call. If populated, the client should
156+
return the execution result with the matching ID in
157+
ToolResponse.
158+
- name: tool
159+
type: String
160+
description: |-
161+
The name of the tool to execute.
162+
Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
163+
- name: toolsetTool
164+
type: NestedObject
165+
description: A tool that is created from a toolset.
166+
properties:
167+
- name: toolset
168+
type: String
169+
description: |-
170+
The resource name of the Toolset from which this tool is derived.
171+
Format:
172+
`projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
173+
required: true
174+
- name: toolId
175+
description: |-
176+
The tool ID to filter the tools to retrieve the schema for.
177+
- name: toolResponse
178+
type: NestedObject
179+
description: The execution result of a specific tool from the client or the agent.
180+
properties:
181+
- name: displayName
182+
type: String
183+
description: Display name of the tool.
184+
output: true
185+
- name: id
186+
type: String
187+
description: The matching ID of the tool call the response is for.
188+
- name: response
189+
type: String
190+
description: |-
191+
The tool execution result in JSON object format.
192+
Use "output" key to specify tool response and "error" key to specify
193+
error details (if any). If "output" and "error" keys are not specified,
194+
then whole "response" is treated as tool execution result.
195+
required: true
196+
custom_flatten: 'templates/terraform/custom_flatten/json_schema.tmpl'
197+
custom_expand: 'templates/terraform/custom_expand/json_schema.tmpl'
198+
validation:
199+
function: 'validation.StringIsJSON'
200+
- name: tool
201+
type: String
202+
description: |-
203+
The name of the tool to execute.
204+
Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
205+
- name: toolsetTool
206+
type: NestedObject
207+
description: A tool that is created from a toolset.
208+
properties:
209+
- name: toolset
210+
type: String
211+
description: |-
212+
The resource name of the Toolset from which this tool is derived.
213+
Format:
214+
`projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
215+
required: true
216+
- name: toolId
217+
description: |-
218+
The tool ID to filter the tools to retrieve the schema for.
111219
- name: updatedVariables
112220
type: String
113221
description: |-

mmv1/templates/terraform/examples/ces_example_basic.tf.tmpl

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,99 @@ resource "google_ces_app" "my-app" {
77
}
88
}
99

10+
resource "google_ces_tool" "ces_tool" {
11+
location = "us"
12+
app = google_ces_app.my-app.app_id
13+
tool_id = "tool-1"
14+
execution_type = "SYNCHRONOUS"
15+
python_function {
16+
name = "example_function"
17+
python_code = "def example_function() -> int: return 0"
18+
}
19+
}
20+
21+
resource "google_ces_toolset" "ces_toolset" {
22+
toolset_id = "{{index $.Vars "toolset_id"}}"
23+
24+
location = "us"
25+
app = google_ces_app.my-app.app_id
26+
display_name = "Basic toolset display name"
27+
28+
open_api_toolset {
29+
open_api_schema = <<-EOT
30+
openapi: 3.0.0
31+
info:
32+
title: My Sample API
33+
version: 1.0.0
34+
description: A simple API example
35+
servers:
36+
- url: https://api.example.com/v1
37+
paths: {}
38+
EOT
39+
ignore_unknown_fields = false
40+
tls_config {
41+
ca_certs {
42+
display_name="example"
43+
cert="ZXhhbXBsZQ=="
44+
}
45+
}
46+
service_directory_config {
47+
service = "projects/example/locations/us/namespaces/namespace/services/service"
48+
}
49+
api_authentication {
50+
service_agent_id_token_auth_config {
51+
}
52+
}
53+
}
54+
}
55+
56+
resource "google_ces_agent" "ces_base_agent" {
57+
agent_id = "{{index $.Vars "base_agent_id"}}"
58+
location = "us"
59+
app = google_ces_app.my-app.app_id
60+
display_name = "base agent"
61+
62+
instruction = "You are a helpful assistant for this example."
63+
64+
model_settings {
65+
model = "gemini-2.5-flash"
66+
temperature = 0.5
67+
}
68+
69+
llm_agent {
70+
}
71+
}
72+
73+
resource "google_ces_agent" "ces_child_agent" {
74+
agent_id = "{{index $.Vars "child_agent_id"}}"
75+
location = "us"
76+
app = google_ces_app.my-app.app_id
77+
display_name = "child agent"
78+
79+
instruction = "You are a helpful assistant for this example."
80+
81+
model_settings {
82+
model = "gemini-2.5-flash"
83+
temperature = 0.5
84+
}
85+
86+
llm_agent {
87+
}
88+
}
89+
1090
resource "google_ces_example" "{{$.PrimaryResourceId}}" {
1191
location = "us"
1292
display_name = "{{index $.Vars "example_display_name"}}"
1393
app = google_ces_app.my-app.name
1494
example_id = "{{index $.Vars "example_id"}}"
1595
description = "example description"
96+
entry_agent = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/agents/${google_ces_agent.ces_base_agent.agent_id}"
1697
messages {
98+
chunks {
99+
agent_transfer {
100+
target_agent = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/agents/${google_ces_agent.ces_child_agent.agent_id}"
101+
}
102+
}
17103
chunks {
18104
image {
19105
mime_type = "image/png"
@@ -23,6 +109,50 @@ resource "google_ces_example" "{{$.PrimaryResourceId}}" {
23109
chunks {
24110
text = "text_data"
25111
}
112+
chunks {
113+
tool_call {
114+
args = jsonencode({
115+
arg1 = "val1"
116+
arg2 = "val2"
117+
})
118+
id = "tool_call_id"
119+
tool = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/tools/${google_ces_tool.ces_tool.tool_id}"
120+
}
121+
}
122+
chunks {
123+
tool_call {
124+
args = jsonencode({
125+
arg1 = "val1"
126+
arg2 = "val2"
127+
})
128+
id = "tool_call_id2"
129+
toolset_tool {
130+
toolset = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/toolsets/${google_ces_toolset.ces_toolset.toolset_id}"
131+
tool_id = "example-id"
132+
}
133+
}
134+
}
135+
chunks {
136+
tool_response {
137+
id = "tool_call_id"
138+
response = jsonencode({
139+
output = "example-output"
140+
})
141+
tool = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/tools/${google_ces_tool.ces_tool.tool_id}"
142+
}
143+
}
144+
chunks {
145+
tool_response {
146+
id = "tool_call_id2"
147+
response = jsonencode({
148+
output = "example-output"
149+
})
150+
toolset_tool {
151+
toolset = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/toolsets/${google_ces_toolset.ces_toolset.toolset_id}"
152+
tool_id = "example-id"
153+
}
154+
}
155+
}
26156
chunks {
27157
updated_variables = jsonencode({
28158
var1 = "val1"

0 commit comments

Comments
 (0)