Gemini Managed Agents API

Gemini Managed Agents API

Shows an AI agent how to create, configure, list, update and delete managed Agent resources through the Gemini Enterprise Agent Platform REST API, including files, skills and tools.

Skill files2 files

references/

SKILL.md366 lines
1
---
2
name: gemini-agents-api
3
metadata:
4
version: "1.0.2"
5
category: AiAndMachineLearning
6
description: Manages custom Agent resources on Gemini Enterprise Agent Platform. Use when the user wants to programmatically create, configure, list, update, or delete stateful, server-managed Agent resources (including mounting files, skills, and tools) before executing conversations.
7
---
8
9
# Gemini Enterprise Agent Platform - Managed Agents API Skill
10
11
This skill provides complete instructions, REST request endpoints, and JSON payload structures to programmatically manage **custom Agent resources** on the Gemini Enterprise Agent Platform (Agent Platform).
12
13
The **Managed Agents API** forms the **Control Plane** of the platform. It allows developers to provision, retrieve, update, and delete tailored, stateful agent containers equipped with system instructions, sandboxed files, custom skill registries, and local/remote tools.
14
## Attribution
15
16
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
17
MUST read [Usage Attribution](references/attribution.md). For commands executed
18
directly in the terminal (never in generated scripts, Terraform, or user code),
19
prefix `gcloud` with
20
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gemini-agents-api)"`
21
and append `agent-skills/1.0 (skill:gemini-agents-api)` to `User-Agent` headers.
22
23
---
24
25
## 1. Authentication & Setup
26
27
All REST requests to the Control Plane must include a Bearer token derived from Application Default Credentials (ADC), and target the production global endpoint.
28
29
### 1. Setup Environment Variables
30
31
Before running requests, set up the required project variables and access token:
32
33
```bash
34
export PROJECT_ID="your-project-id"
35
export LOCATION="global"
36
export ACCESS_TOKEN=$(gcloud auth print-access-token)
37
```
38
39
> [!IMPORTANT]
40
> **API Location Support**:
41
> The `LOCATION` environment variable must be set to a regional location where the Gemini Enterprise Agent Platform's **Managed Agents API** is actively supported (e.g., `global`, or other available regional endpoints).
42
43
44
### 2. Endpoint URL
45
46
The production Agents Control Plane endpoint is:
47
48
```http
49
https://aiplatform.googleapis.com/v1beta1/projects/{PROJECT_ID}/locations/{LOCATION}/agents
50
```
51
52
---
53
54
## 2. Programmatic Agent Management (Control Plane CRUD)
55
56
### 1. Create Agent (Long-Running Operation)
57
58
To create a new agent resource, issue a `POST` request with the custom configuration. You can mount remote files, folders, or skills directly from **Google Cloud Storage** buckets into the agent container's workspace. Creating an agent is a Long-Running Operation (LRO) that spawns an asynchronous job.
59
60
* **Method**: `POST`
61
* **Endpoint**: `https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents`
62
63
#### Request Payload
64
65
```bash
66
curl -X POST "https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents" \
67
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
68
-H "Content-Type: application/json; charset=utf-8" \
69
-d '{
70
"id": "my-custom-agent",
71
"base_agent": "antigravity-preview-09-2026",
72
"description": "A professional agent configured with remote tools and mounted Cloud Storage directories.",
73
"system_instruction": "You are a helpful, domain-expert assistant.",
74
"tools": [
75
{"type": "code_execution"},
76
{"type": "filesystem"},
77
{"type": "google_search"},
78
{"type": "url_context"}
79
],
80
"base_environment": {
81
"type": "remote",
82
"sources": [
83
{
84
"type": "gcs",
85
"source": "gs://your-agent-bucket-name/skills",
86
"target": "/.agent/skills"
87
}
88
],
89
"network": {
90
"allowlist": [
91
{ "domain": "*" }
92
]
93
}
94
}
95
}'
96
```
97
98
#### LRO Operations Response
99
100
Since agent provisioning takes a few moments, the endpoint immediately returns an operation tracking object:
101
102
```json
103
{
104
"name": "projects/1234567890/locations/global/operations/operation-987654321-abcde",
105
"metadata": {
106
"@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.CreateAgentOperationMetadata",
107
"genericMetadata": {
108
"createTime": "2026-05-14T19:00:00.123456Z",
109
"updateTime": "2026-05-14T19:00:01.654321Z"
110
}
111
}
112
}
113
```
114
115
#### [Advanced] Mount Skill Registry Resources
116
117
To mount skills directly from the Skill Registry service instead of Cloud Storage, replace the Cloud Storage source item in the payload:
118
119
```json
120
"sources": [
121
{
122
"type": "skill_registry",
123
"source": "projects/your-project-id/locations/global/skills/my-math-skill/revisions/123456789012",
124
"target": "/.agent/skills"
125
}
126
]
127
```
128
129
#### [Advanced] Configuring Model Context Protocol (MCP) Servers
130
131
To configure Third-Party MCP servers for an agent, add the server metadata directly under the `"tools"` parameter array inside the creation request. The platform securely routes tool execution requests to the external MCP server.
132
133
> [!IMPORTANT]
134
> **MCP Security Explanation**: When describing MCP tool configurations, you must explain that the platform securely routes tool requests to the specified MCP server and guarantees header confidentiality by only sending custom headers/tokens to that URL.
135
136
```json
137
"tools": [
138
{
139
"type": "mcp",
140
"name": "my-mcp-server",
141
"url": "https://mcp.yourcompany.com/api",
142
"headers": {
143
"Authorization": "Bearer YOUR_MCP_AUTH_TOKEN"
144
}
145
}
146
]
147
```
148
149
* **name**: A descriptive name for the MCP server.
150
* **url**: The endpoint URL of the external MCP server.
151
* **headers**: (Optional) Custom key-value pairs containing authentication tokens (e.g. API keys, bearer tokens) required to call the server. The platform guarantees that these headers are only sent to the specified MCP server URL.
152
153
> [!TIP]
154
> **Overriding MCP at Interaction Time (Data Plane)**:
155
> You can dynamically override or supply MCP tools directly when creating a conversation interaction (Data Plane) by passing `"type": "mcp_server"` inside the `"tools"` payload of `interactions.create`. Refer to the Interactions API documentation for details.
156
157
---
158
159
### 2. Polling the LRO Status
160
161
To track the status of agent creation and obtain the final ready resource, poll the operation URL returned in the `name` field of the creation response.
162
163
* **Method**: `GET`
164
* **Endpoint**: `https://aiplatform.googleapis.com/v1beta1/{OPERATION_NAME}`
165
166
```bash
167
curl -X GET "https://aiplatform.googleapis.com/v1beta1/projects/1234567890/locations/global/operations/operation-987654321-abcde" \
168
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
169
-H "Content-Type: application/json"
170
```
171
172
#### In-Progress Response
173
174
```json
175
{
176
"name": "projects/1234567890/locations/global/operations/operation-987654321-abcde",
177
"metadata": { ... }
178
}
179
```
180
181
#### Finished Success Response
182
183
Once the container is ready, `"done": true` is set, and the completed `Agent` resource description resides inside `"response"`:
184
185
```json
186
{
187
"name": "projects/1234567890/locations/global/operations/operation-987654321-abcde",
188
"done": true,
189
"response": {
190
"@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.Agent",
191
"name": "projects/your-project-id/locations/global/agents/my-custom-agent",
192
"base_agent": "antigravity-preview-09-2026",
193
"description": "A professional agent configured with remote tools and mounted Cloud Storage directories.",
194
"system_instruction": "You are a helpful, domain-expert assistant."
195
}
196
}
197
```
198
199
---
200
201
### 3. Get Agent
202
203
Retrieve the configuration metadata, tools, and environment setup of an existing custom agent.
204
205
* **Method**: `GET`
206
* **Endpoint**: `https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents/{AGENT_ID}`
207
208
```bash
209
curl -X GET "https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/global/agents/my-custom-agent" \
210
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
211
-H "Content-Type: application/json"
212
```
213
214
#### Response Example
215
Returns the complete configured state of the custom Agent resource:
216
217
```json
218
{
219
"name": "projects/your-project-id/locations/global/agents/my-custom-agent",
220
"base_agent": "antigravity-preview-09-2026",
221
"description": "A professional agent configured with remote tools and mounted Cloud Storage directories.",
222
"system_instruction": "You are a helpful, domain-expert assistant.",
223
"tools": [
224
{"type": "code_execution"},
225
{"type": "filesystem"},
226
{"type": "google_search"},
227
{"type": "url_context"}
228
],
229
"base_environment": {
230
"type": "remote",
231
"sources": [
232
{
233
"type": "gcs",
234
"source": "gs://your-agent-bucket-name/skills",
235
"target": "/.agent/skills"
236
}
237
],
238
"network": {
239
"allowlist": [
240
{ "domain": "*" }
241
]
242
}
243
}
244
}
245
```
246
247
---
248
249
### 4. List Agents
250
251
Retrieve a list of all configured custom agents located under the target Google Cloud project.
252
253
* **Method**: `GET`
254
* **Endpoint**: `https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents`
255
256
```bash
257
curl -X GET "https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/global/agents" \
258
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
259
-H "Content-Type: application/json"
260
```
261
262
#### Response Example
263
Returns a JSON list of all configured custom Agents under the target project:
264
265
```json
266
{
267
"agents": [
268
{
269
"name": "projects/your-project-id/locations/global/agents/my-custom-agent",
270
"base_agent": "antigravity-preview-09-2026",
271
"description": "A professional agent configured with remote tools and mounted Cloud Storage directories.",
272
"system_instruction": "You are a helpful, domain-expert assistant."
273
},
274
{
275
"name": "projects/your-project-id/locations/global/agents/my-telecom-agent",
276
"base_agent": "antigravity-preview-09-2026",
277
"description": "A highly specialized telecom support agent.",
278
"system_instruction": "You are a professional telecom support agent. Follow system policies carefully."
279
}
280
]
281
}
282
```
283
284
---
285
286
### 5. Update Agent (Patching Configuration)
287
288
Modify configuration fields (such as instructions, descriptions, tools, or mounts) on a custom agent resource in place. You **must** specify the fields being updated using the `update_mask` query parameter.
289
290
> [!IMPORTANT]
291
> **Update Mask Requirement**: When demonstrating updates, you must always explicitly explain that the `update_mask` parameter is required when updating agent configurations to specify exactly which fields are being modified and avoid overwriting other configuration settings.
292
293
* **Method**: `PATCH`
294
* **Endpoint**: `https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents/{AGENT_ID}?update_mask=system_instruction`
295
296
```bash
297
curl -X PATCH "https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/global/agents/my-custom-agent?update_mask=system_instruction" \
298
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
299
-H "Content-Type: application/json" \
300
-d '{
301
"name": "my-custom-agent",
302
"system_instruction": "You are a highly specialized telecom support agent. Follow system policies carefully."
303
}'
304
```
305
306
---
307
308
### 6. Delete Agent
309
310
Delete custom Agent resources when they are no longer needed to free up backend workspace containers.
311
312
* **Method**: `DELETE`
313
* **Endpoint**: `https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/agents/{AGENT_ID}`
314
315
```bash
316
curl -X DELETE "https://aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/global/agents/my-custom-agent" \
317
-H "Authorization: Bearer ${ACCESS_TOKEN}"
318
```
319
320
#### Response Example
321
A successful deletion request returns an empty JSON response body with HTTP Status `200 OK`:
322
323
```json
324
{}
325
```
326
327
---
328
329
## 3. Interacting with Custom Agents (Data Plane)
330
331
Once you have programmatically created and provisioned your custom stateful agent using the **Control Plane** (this skill), you can execute multi-turn chat, tool execution, and streaming conversations with it using the **Data Plane** (**Interactions API**).
332
333
> [!IMPORTANT]
334
> **Interactions Reference**: When explaining or showing how to start conversations with a custom agent, you must always explicitly refer the user to the `gemini-interactions-api` skill for complete conversation and streaming options.
335
336
To interact with your custom agent:
337
338
1. Obtain your agent's resource path name (e.g., `projects/{PROJECT_ID}/locations/global/agents/{AGENT_ID}`).
339
2. Pass this resource path directly inside your data plane conversation requests under the **`agent`** parameter.
340
341
#### Python Example
342
343
```python
344
interaction = client.interactions.create(
345
agent="projects/your-project-id/locations/global/agents/my-custom-agent",
346
input="Hello! Who are you?"
347
)
348
```
349
350
#### REST / curl Example
351
352
```json
353
{
354
"agent": "projects/your-project-id/locations/global/agents/my-custom-agent",
355
"input": [{
356
"type": "user_input",
357
"content": [{"type": "text", "text": "Hello! Who are you?"}]
358
}]
359
}
360
```
361
362
Refer to the **`gemini-interactions-api`** skill for full instructions, Python
363
and TS/JS code blocks, and streaming setups to run conversations with your
364
provisioned agents.
365
366

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…