Developer Device Platform Basics

Developer Device Platform Basics

Teaches an agent to reserve remote Android devices on Google's Developer Device Platform, open connection tunnels, check sessions and extend or cancel leases.

Skill files12 files

references/

scripts/

SKILL.md263 lines
1
---
2
name: developer-device-platform-basics
3
description: >-
4
Provides guidance and instructions on managing remote devices on Developer Device Platform (DDP).
5
Use when reserving remote Android devices, establishing connection tunnels, checking session status, or extending/cancelling leases.
6
Don't use for iOS or local device/hardware inquiries.
7
metadata:
8
version: "0.5.1"
9
category: CloudInfrastructureAndServices
10
---
11
12
# Developer Device Platform
13
14
Developer Device Platform (DDP) is a Google fully managed, global infrastructure
15
providing access to a wide variety of physical and virtual devices.
16
17
> [!WARNING] Developer Device Platform (DDP) is currently at Preview.
18
19
> [!IMPORTANT] For all devicerun and devicestreaming API operations (reserving,
20
> status checking, stopping/canceling, updating, or listing a session), always
21
> verify and use the exact instructions and curl commands provided in the linked
22
> reference `.md` files.
23
24
## Attribution
25
26
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
27
MUST read [Usage Attribution](references/attribution.md). For commands executed
28
directly in the terminal (never in generated scripts, Terraform, or user code),
29
prefix `gcloud` with
30
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:developer-device-platform-basics)"`
31
and append `agent-skills/1.0 (skill:developer-device-platform-basics)` to `User-Agent` headers.
32
33
## Authentication & Setup
34
35
**CRITICAL**: Before running any requests, you MUST ensure the environment is
36
correctly initialized by following these steps:
37
38
Before running any requests, verify if the `gcloud` executable is present. If
39
missing, refer to the official
40
[Google Cloud CLI Installation Guide](https://docs.cloud.google.com/sdk/docs/install-sdk.md.txt)
41
to install it on the current platform (Linux, macOS, Windows, etc.).
42
43
1. **Google Cloud Authentication**: Authenticate with your Google Cloud
44
credentials and configure active Application Default Credentials (ADC) for
45
the Developer Device Platform:
46
47
```bash
48
gcloud auth login --no-browser
49
gcloud auth application-default login --no-browser
50
```
51
52
2. **Enable APIs** (if not already enabled):
53
54
```bash
55
gcloud services enable devicerun.googleapis.com devicestreaming.googleapis.com testing.googleapis.com --quiet
56
```
57
58
> [!NOTE] Cloud Testing API is needed for Device Streaming API during Preview.
59
60
3. **Enable gcloud beta component**:
61
62
```bash
63
gcloud components install beta
64
```
65
66
4. **Setup Environment Variables**: Set up the required project variable and
67
access token:
68
69
```bash
70
export PROJECT_ID=$(gcloud config get project)
71
export ACCESS_TOKEN=$(gcloud auth application-default print-access-token 2>/dev/null)
72
```
73
74
5. **Python Environment**: For instructions on setting up the python virtual
75
environment, see [start_adb_forwarder.md].
76
77
## Listing Available Devices
78
79
To find the correct `modelCode` and `osVersion` to use when starting a session,
80
you can list the available devices:
81
82
1. **List Models**: Run the following command to list available Android device
83
models:
84
85
```bash
86
gcloud beta device-run devices list
87
```
88
89
Use the `ID` column to find the value for the `CATALOG_ID` parameter to
90
describe a specific device (e.g., `shiba-36`).
91
92
2. **Describe a Model**: Run the API request to get more details about a
93
specific model (e.g., supportedProducts, resolution). Always rely on the
94
exact curl command and instructions provided in [describe_device.md].
95
96
## Starting a Device Session
97
98
When the user asks to reserve or connect to a device:
99
100
1. **Check Device Availability**:
101
102
Look up `CATALOG_ID` of the device using `Listing Available Devices`
103
instructions. Check the device availability of the `CATALOG_ID` by using the
104
exact curl command and instructions provided in [describe_device.md]. The
105
device MUST contain "deviceStreaming" in "supportedProducts" to be reserved.
106
107
If no specific device is specified, use `CATALOG_ID=shiba-34` (Pixel 8 on
108
SDK 34).
109
110
If `OS_VERSION` was not specified by the user, ask the user to select a
111
version from the device list (preferring the version with the highest
112
availability {"available": "AVAILABILITY_HIGH" }).
113
114
If `OS_VERSION` is unavailable for `deviceStreaming`, do not reserve one.
115
Prompt the user for an alternative `OS_VERSION`.
116
117
2. **Extract Parameters**:
118
119
* `model_id`: `modelCode` from device details. Required.
120
* `version_id`: `osVersion` from device details. Required.
121
122
3. **Reserve Device**:
123
124
**Rule**: **Explicit User Confirmation Required**. Reserving a device incurs
125
billing charges and creates cloud resources. The agent MUST ALWAYS warn the
126
user explicitly about the billing costs that will be incurred on the active
127
Google Cloud project (e.g., `${PROJECT_ID}`). You MUST STOP and ask for
128
explicit approval before proceeding with any session creation commands.
129
130
Then, run the API request with `model_id` and `version_id` to reserve the
131
device. Always rely on the exact curl command and instructions provided in
132
[reserve_device.md].
133
134
Parse the response to get `session_name` (the session name, e.g.,
135
`projects/${PROJECT_ID}/deviceSessions/session-xxxxxx`). If reservation
136
fails, report the error.
137
138
4. **Wait for Session to be Active**:
139
140
While waiting for the device session to be provisioned, poll the session
141
status until `"state"` is `"ACTIVE"`. See [session_status.md] for the exact
142
curl command.
143
144
Repeat this check every 5 seconds to prevent hitting API rate limit. If it
145
does not become active within 2 minutes (typically under 1 minute), report
146
failure and cancel the session. Once active, extract `expireTime` from the
147
session JSON response and convert it to the user's local time in a
148
human-readable format (e.g., "June 9, 2026 at 2:44 PM PDT").
149
150
5. **Start Connection Forwarder**: Start the ADB forwarder script to forward
151
connection to the remote device. Always rely on the exact command and
152
instructions provided in [start_adb_forwarder.md]. Ensure you record the
153
**Command ID**.
154
155
6. **Wait for Online and Parse Port**: Wait for the forwarder to be online and
156
extract the listening port. Always rely on the exact logic and instructions
157
provided in [start_adb_forwarder.md].
158
159
7. **Provide Instructions to User**:
160
161
Once online, run `adb -s localhost:{port} shell getprop ro.product.model` to
162
retrieve the device model name. Then, print a message directly to the user
163
in the chat (do NOT create any artifact file) with the following
164
instructions:
165
166
### Device is ready!
167
168
```
169
Device Model: {device_model}
170
OS Version: {version_id}
171
ADB Address: localhost:{port}
172
Session Expiration: {expire_time_human_readable_local}
173
```
174
175
8. **Save Session State**: Save the `{session_name}` and `{command_id}` in your
176
conversation memory/context so you can clean it up later.
177
178
## Viewing the Device Screen of a Reserved Device
179
180
The coding agent can directly interact with the remote device using `adb`. Users
181
may use a utility to display the screen and manually control the reserved device
182
in DDP. See [view_device.md] for an example utility.
183
184
## Stopping a Device Session
185
186
When the user asks to stop, cleanup, or release the device:
187
188
1. **Identify Session**: Retrieve the active `{session_name}` and
189
`{command_id}` from your context. If you don't have them, list active
190
sessions first (see helper command below) to find the session name.
191
192
2. **Cancel Session via API**: Cancel the session via the API. Always rely on
193
the exact curl command and instructions provided in [cancel_session.md].
194
195
3. **Terminate Connection Forwarder**: Terminate the background process
196
matching `{command_id}` using your environment's process management
197
capability.
198
199
4. **Confirm**: Confirm to the user that the session has been cancelled and
200
resources released.
201
202
## Change Device Session Expiration Time
203
204
When the user asks to change the expiration time of an active device session:
205
206
**Rule**: **Explicit User Confirmation Required**. Extending a device session
207
incurs additional billing charges and creates cloud resources. The agent MUST
208
ALWAYS warn the user explicitly about the extra billing costs that will be
209
incurred on the active Google Cloud project (e.g., `${PROJECT_ID}`). You MUST
210
STOP and ask for explicit approval before proceeding with any session extension
211
commands.
212
213
1. **Extract Parameters**:
214
215
* `session_name`: The active session name.
216
* `ttl`: The new remaining duration (e.g., `3600s`). Derive the `ttl` if
217
it's provided in another format.
218
219
2. **Change Session via API**: Change the session via the API using
220
`updateMask=ttl`. Always rely on the exact curl commands and instructions
221
provided in [update_session_expiration.md].
222
223
3. **Restart Connection Forwarder**:
224
225
* Run `adb disconnect localhost:{port}` to ensure the old forwarder
226
connection is closed.
227
* Stop the old connection forwarder corresponding to `{command_id}`.
228
* Start a new connection forwarder by following Step 5 in "Starting a
229
Device Session" (calculating the new `--ttl` duration in seconds and
230
storing the newly returned Command ID).
231
232
4. **Confirm**: Confirm to the user that the session duration has been updated
233
and the connection forwarder has been restarted with the new TTL.
234
235
## Helper: List Active Sessions
236
237
To find active sessions if you lost context, always rely on the curl command and
238
instructions provided in [list_sessions.md].
239
240
## References
241
242
* [gcloud device-run CLI]
243
* [Device Streaming API]
244
* [describe_device.md]
245
* [reserve_device.md]
246
* [session_status.md]
247
* [start_adb_forwarder.md]
248
* [view_device.md]
249
* [cancel_session.md]
250
* [update_session_expiration.md]
251
* [list_sessions.md]
252
253
[gcloud device-run CLI]: https://docs.cloud.google.com/sdk/gcloud/reference/beta/device-run
254
[Device Streaming API]: https://docs.cloud.google.com/device-streaming/docs/reference/rest.md.txt
255
[describe_device.md]: references/describe_device.md
256
[reserve_device.md]: references/reserve_device.md
257
[session_status.md]: references/session_status.md
258
[start_adb_forwarder.md]: references/start_adb_forwarder.md
259
[view_device.md]: references/view_device.md
260
[cancel_session.md]: references/cancel_session.md
261
[update_session_expiration.md]: references/update_session_expiration.md
262
[list_sessions.md]: references/list_sessions.md
263

© 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…