or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

app-platform.mdhealth-check.mdindex.mdlive-video-analytics.mdstreaming.mdstreams-management.mdtypes.mdwarehouse.md

app-platform.mddocs/

0

# Application Platform

1

2

Complete lifecycle management for Vision AI applications including creation, deployment, scaling, processor configuration, and stream input management. The AppPlatform service provides the foundation for building and running video analytics applications on Google Cloud.

3

4

## Capabilities

5

6

### Application Management

7

8

Create, deploy, and manage Vision AI applications with full lifecycle control including configuration updates and scaling.

9

10

```python { .api }

11

def list_applications(self, parent: str, page_size: int = None, page_token: str = None, filter: str = None, order_by: str = None) -> ListApplicationsResponse:

12

"""

13

Lists applications in a project and location.

14

15

Args:

16

parent (str): Required. Parent resource path "projects/{project}/locations/{location}"

17

page_size (int): Maximum number of applications to return

18

page_token (str): Token for pagination

19

filter (str): Filter expression for applications

20

order_by (str): Sort order for results

21

22

Returns:

23

ListApplicationsResponse: Response with applications and next page token

24

"""

25

26

def get_application(self, name: str) -> Application:

27

"""

28

Retrieves a specific application.

29

30

Args:

31

name (str): Required. Application resource path

32

"projects/{project}/locations/{location}/applications/{application}"

33

34

Returns:

35

Application: The application resource

36

"""

37

38

def create_application(self, parent: str, application: Application, application_id: str) -> Operation:

39

"""

40

Creates a new Vision AI application.

41

42

Args:

43

parent (str): Required. Parent resource path "projects/{project}/locations/{location}"

44

application (Application): Required. Application configuration

45

application_id (str): Required. ID for the new application

46

47

Returns:

48

Operation: Long-running operation for application creation

49

"""

50

51

def update_application(self, application: Application, update_mask: FieldMask = None) -> Operation:

52

"""

53

Updates an existing application configuration.

54

55

Args:

56

application (Application): Required. Updated application configuration

57

update_mask (FieldMask): Fields to update

58

59

Returns:

60

Operation: Long-running operation for application update

61

"""

62

63

def delete_application(self, name: str, force: bool = None) -> Operation:

64

"""

65

Deletes a Vision AI application.

66

67

Args:

68

name (str): Required. Application resource path

69

force (bool): Force deletion even if application is deployed

70

71

Returns:

72

Operation: Long-running operation for deletion

73

"""

74

75

def deploy_application(self, name: str) -> Operation:

76

"""

77

Deploys an application to start processing video streams.

78

79

Args:

80

name (str): Required. Application resource path to deploy

81

82

Returns:

83

Operation: Long-running operation for deployment

84

"""

85

86

def undeploy_application(self, name: str) -> Operation:

87

"""

88

Undeploys a running application to stop processing.

89

90

Args:

91

name (str): Required. Application resource path to undeploy

92

93

Returns:

94

Operation: Long-running operation for undeployment

95

"""

96

```

97

98

### Stream Input Management

99

100

Configure and manage video stream inputs for applications including adding, removing, and updating stream sources.

101

102

```python { .api }

103

def add_application_stream_input(self, name: str, application_stream_inputs: List[ApplicationStreamInput]) -> Operation:

104

"""

105

Adds stream input sources to a deployed application.

106

107

Args:

108

name (str): Required. Application resource path

109

application_stream_inputs (List[ApplicationStreamInput]): Stream inputs to add

110

111

Returns:

112

Operation: Long-running operation for adding stream inputs

113

"""

114

115

def remove_application_stream_input(self, name: str, target_stream_inputs: List[RemoveApplicationStreamInputRequestTargetStreamInput]) -> Operation:

116

"""

117

Removes stream input sources from a deployed application.

118

119

Args:

120

name (str): Required. Application resource path

121

target_stream_inputs (List[RemoveApplicationStreamInputRequestTargetStreamInput]):

122

Stream inputs to remove

123

124

Returns:

125

Operation: Long-running operation for removing stream inputs

126

"""

127

128

def update_application_stream_input(self, name: str, application_stream_inputs: List[ApplicationStreamInput]) -> Operation:

129

"""

130

Updates stream input configuration for a deployed application.

131

132

Args:

133

name (str): Required. Application resource path

134

application_stream_inputs (List[ApplicationStreamInput]): Updated stream input configs

135

136

Returns:

137

Operation: Long-running operation for updating stream inputs

138

"""

139

```

140

141

### Instance Management

142

143

Manage application instances including creation, scaling, and configuration updates for deployed applications.

144

145

```python { .api }

146

def list_instances(self, parent: str, page_size: int = None, page_token: str = None, filter: str = None, order_by: str = None) -> ListInstancesResponse:

147

"""

148

Lists instances of an application.

149

150

Args:

151

parent (str): Required. Application resource path

152

page_size (int): Maximum number of instances to return

153

page_token (str): Token for pagination

154

filter (str): Filter expression for instances

155

order_by (str): Sort order for results

156

157

Returns:

158

ListInstancesResponse: Response with instances and pagination

159

"""

160

161

def get_instance(self, name: str) -> Instance:

162

"""

163

Retrieves specific instance details.

164

165

Args:

166

name (str): Required. Instance resource path

167

"projects/{project}/locations/{location}/applications/{application}/instances/{instance}"

168

169

Returns:

170

Instance: The instance resource with status and configuration

171

"""

172

173

def create_application_instances(self, name: str, application_instances: List[ApplicationInstance]) -> Operation:

174

"""

175

Creates new instances for an application.

176

177

Args:

178

name (str): Required. Application resource path

179

application_instances (List[ApplicationInstance]): Instance configurations to create

180

181

Returns:

182

Operation: Long-running operation for instance creation

183

"""

184

185

def delete_application_instances(self, name: str, instance_ids: List[str]) -> Operation:

186

"""

187

Deletes application instances.

188

189

Args:

190

name (str): Required. Application resource path

191

instance_ids (List[str]): IDs of instances to delete

192

193

Returns:

194

Operation: Long-running operation for instance deletion

195

"""

196

197

def update_application_instances(self, name: str, application_instances: List[UpdateApplicationInstancesRequestUpdateApplicationInstance]) -> Operation:

198

"""

199

Updates configuration for application instances.

200

201

Args:

202

name (str): Required. Application resource path

203

application_instances (List[UpdateApplicationInstancesRequestUpdateApplicationInstance]):

204

Instance updates to apply

205

206

Returns:

207

Operation: Long-running operation for instance updates

208

"""

209

```

210

211

### Draft Management

212

213

Manage application drafts for development, testing, and version control before production deployment.

214

215

```python { .api }

216

def list_drafts(self, parent: str, page_size: int = None, page_token: str = None, filter: str = None, order_by: str = None) -> ListDraftsResponse:

217

"""

218

Lists drafts for an application.

219

220

Args:

221

parent (str): Required. Application resource path

222

page_size (int): Maximum number of drafts to return

223

page_token (str): Token for pagination

224

filter (str): Filter expression for drafts

225

order_by (str): Sort order for results

226

227

Returns:

228

ListDraftsResponse: Response with drafts and pagination

229

"""

230

231

def get_draft(self, name: str) -> Draft:

232

"""

233

Retrieves a specific draft configuration.

234

235

Args:

236

name (str): Required. Draft resource path

237

"projects/{project}/locations/{location}/applications/{application}/drafts/{draft}"

238

239

Returns:

240

Draft: The draft resource with configuration

241

"""

242

243

def create_draft(self, parent: str, draft: Draft, draft_id: str) -> Operation:

244

"""

245

Creates a new draft version of an application.

246

247

Args:

248

parent (str): Required. Application resource path

249

draft (Draft): Required. Draft configuration

250

draft_id (str): Required. ID for the new draft

251

252

Returns:

253

Operation: Long-running operation for draft creation

254

"""

255

256

def update_draft(self, draft: Draft, update_mask: FieldMask = None) -> Operation:

257

"""

258

Updates an existing draft configuration.

259

260

Args:

261

draft (Draft): Required. Updated draft configuration

262

update_mask (FieldMask): Fields to update

263

264

Returns:

265

Operation: Long-running operation for draft update

266

"""

267

268

def delete_draft(self, name: str) -> Operation:

269

"""

270

Deletes an application draft.

271

272

Args:

273

name (str): Required. Draft resource path to delete

274

275

Returns:

276

Operation: Long-running operation for draft deletion

277

"""

278

```

279

280

### Processor Management

281

282

Manage custom and prebuilt processors including creation, configuration, and integration with applications.

283

284

```python { .api }

285

def list_processors(self, parent: str, page_size: int = None, page_token: str = None, filter: str = None, order_by: str = None) -> ListProcessorsResponse:

286

"""

287

Lists available processors.

288

289

Args:

290

parent (str): Required. Parent resource path "projects/{project}/locations/{location}"

291

page_size (int): Maximum number of processors to return

292

page_token (str): Token for pagination

293

filter (str): Filter expression for processors

294

order_by (str): Sort order for results

295

296

Returns:

297

ListProcessorsResponse: Response with processors and pagination

298

"""

299

300

def list_prebuilt_processors(self, parent: str, page_size: int = None, page_token: str = None) -> ListPrebuiltProcessorsResponse:

301

"""

302

Lists prebuilt processors available for use.

303

304

Args:

305

parent (str): Required. Parent resource path "projects/{project}/locations/{location}"

306

page_size (int): Maximum number to return

307

page_token (str): Token for pagination

308

309

Returns:

310

ListPrebuiltProcessorsResponse: Response with prebuilt processors

311

"""

312

313

def get_processor(self, name: str) -> Processor:

314

"""

315

Retrieves processor details and configuration.

316

317

Args:

318

name (str): Required. Processor resource path

319

"projects/{project}/locations/{location}/processors/{processor}"

320

321

Returns:

322

Processor: The processor resource with configuration

323

"""

324

325

def create_processor(self, parent: str, processor: Processor, processor_id: str) -> Operation:

326

"""

327

Creates a custom processor for video analysis.

328

329

Args:

330

parent (str): Required. Parent resource path "projects/{project}/locations/{location}"

331

processor (Processor): Required. Processor configuration

332

processor_id (str): Required. ID for the new processor

333

334

Returns:

335

Operation: Long-running operation for processor creation

336

"""

337

338

def update_processor(self, processor: Processor, update_mask: FieldMask = None) -> Operation:

339

"""

340

Updates processor configuration.

341

342

Args:

343

processor (Processor): Required. Updated processor configuration

344

update_mask (FieldMask): Fields to update

345

346

Returns:

347

Operation: Long-running operation for processor update

348

"""

349

350

def delete_processor(self, name: str) -> Operation:

351

"""

352

Deletes a custom processor.

353

354

Args:

355

name (str): Required. Processor resource path to delete

356

357

Returns:

358

Operation: Long-running operation for processor deletion

359

"""

360

```

361

362

## Types

363

364

### Application Resources

365

366

```python { .api }

367

class Application:

368

"""Vision AI application configuration."""

369

name: str # Resource name

370

display_name: str # Human-readable name

371

description: str # Application description

372

application_configs: ApplicationConfigs # Configuration settings

373

runtime_info: ApplicationRuntimeInfo # Runtime status information

374

state: ApplicationState # Current application state

375

create_time: Timestamp # Creation timestamp

376

update_time: Timestamp # Last update timestamp

377

378

class ApplicationConfigs:

379

"""Application configuration settings."""

380

nodes: List[Node] # Processing nodes in application graph

381

event_delivery_config: ApplicationEventDeliveryConfig # Event delivery settings

382

383

class Node:

384

"""Processing node in application graph."""

385

name: str # Node name

386

display_name: str # Human-readable name

387

node_config: ProcessorConfig # Node processing configuration

388

processor: str # Processor resource name

389

parents: List[InputEdge] # Input connections

390

391

class ProcessorConfig:

392

"""Configuration for a processor node."""

393

vertex_automl_vision_config: VertexAutoMLVisionConfig

394

vertex_automl_video_config: VertexAutoMLVideoConfig

395

vertex_custom_config: VertexCustomConfig

396

general_object_detection_config: GeneralObjectDetectionConfig

397

person_blur_config: PersonBlurConfig

398

occupancy_count_config: OccupancyCountConfig

399

person_vehicle_detection_config: PersonVehicleDetectionConfig

400

personal_protective_equipment_detection_config: PersonalProtectiveEquipmentDetectionConfig

401

video_stream_input_config: VideoStreamInputConfig

402

ai_enabled_devices_input_config: AIEnabledDevicesInputConfig

403

media_warehouse_config: MediaWarehouseConfig

404

gcs_output_config: GcsOutputConfig

405

bigquery_config: BigQueryConfig

406

407

class ApplicationInstance:

408

"""Application instance configuration."""

409

instance_id: str # Instance identifier

410

input_resources: List[InputResource] # Input resource mappings

411

output_resources: List[OutputResource] # Output resource mappings

412

processor_to_input_resource_binding: List[ProcessorIOSpec] # Processor bindings

413

414

class Draft:

415

"""Application draft version."""

416

name: str # Resource name

417

application_configs: ApplicationConfigs # Draft configuration

418

create_time: Timestamp # Creation timestamp

419

update_time: Timestamp # Last update timestamp

420

421

class Processor:

422

"""Custom processor definition."""

423

name: str # Resource name

424

display_name: str # Human-readable name

425

description: str # Processor description

426

processor_type: ProcessorType # Type of processor

427

model_type: ModelType # ML model type

428

custom_processor_source_info: CustomProcessorSourceInfo # Source information

429

state: ProcessorState # Current processor state

430

processor_io_spec: ProcessorIOSpec # Input/output specifications

431

configuration_typeurl: str # Configuration type URL

432

supported_annotation_types: List[StreamAnnotationType] # Supported annotations

433

supports_post_processing: bool # Post-processing support

434

create_time: Timestamp # Creation timestamp

435

update_time: Timestamp # Last update timestamp

436

437

class ProcessorIOSpec:

438

"""Processor input/output specifications."""

439

graph_input_channel_specs: List[GraphInputChannelSpec] # Input channel specs

440

graph_output_channel_specs: List[GraphOutputChannelSpec] # Output channel specs

441

instance_resource_input_binding_specs: List[InstanceResourceInputBindingSpec] # Input bindings

442

instance_resource_output_binding_specs: List[InstanceResourceOutputBindingSpec] # Output bindings

443

444

class ApplicationStreamInput:

445

"""Stream input configuration for applications."""

446

stream_with_annotation: str # Stream resource with annotations

447

```

448

449

### Stream Input Types

450

451

```python { .api }

452

class VideoStreamInputConfig:

453

"""Video stream input configuration."""

454

streams: List[str] # Stream resource names

455

streams_with_annotation: List[str] # Streams with annotation data

456

457

class AIEnabledDevicesInputConfig:

458

"""AI-enabled devices input configuration."""

459

pass # Configuration for AI-enabled device inputs

460

461

class InputResource:

462

"""Input resource specification."""

463

input_resource_key: str # Resource key identifier

464

input_resource_binding: InputResourceBinding # Resource binding configuration

465

466

class InputResourceBinding:

467

"""Resource binding configuration."""

468

resource_type: InputResourceBindingResourceType # Type of resource

469

resource: str # Resource identifier

470

471

class OutputResource:

472

"""Output resource specification."""

473

output_resource_key: str # Resource key identifier

474

output_resource_binding: OutputResourceBinding # Resource binding configuration

475

476

class OutputResourceBinding:

477

"""Output resource binding configuration."""

478

resource_type: OutputResourceBindingResourceType # Type of resource

479

resource: str # Resource identifier

480

```

481

482

### Enums

483

484

```python { .api }

485

class ApplicationState(Enum):

486

"""Application deployment states."""

487

STATE_UNSPECIFIED = 0

488

CREATED = 1 # Application created but not deployed

489

DEPLOYING = 2 # Deployment in progress

490

DEPLOYED = 3 # Successfully deployed and running

491

UNDEPLOYING = 4 # Undeployment in progress

492

DELETED = 5 # Application deleted

493

ERROR = 6 # Error state

494

495

class ProcessorType(Enum):

496

"""Types of processors."""

497

PROCESSOR_TYPE_UNSPECIFIED = 0

498

PRETRAINED_VERTEX_AI = 1 # Pretrained Vertex AI model

499

CUSTOM_PROCESSOR = 2 # Custom processor

500

CONNECTOR_LVA = 3 # Live video analytics connector

501

CONNECTOR_STREAM = 4 # Stream connector

502

503

class ProcessorState(Enum):

504

"""Processor states."""

505

STATE_UNSPECIFIED = 0

506

CREATING = 1 # Processor being created

507

ACTIVE = 2 # Processor ready for use

508

DELETING = 3 # Processor being deleted

509

FAILED = 4 # Processor creation failed

510

511

class ModelType(Enum):

512

"""ML model types."""

513

MODEL_TYPE_UNSPECIFIED = 0

514

IMAGE_CLASSIFICATION = 1 # Image classification model

515

OBJECT_DETECTION = 2 # Object detection model

516

VIDEO_CLASSIFICATION = 3 # Video classification model

517

VIDEO_OBJECT_TRACKING = 4 # Video object tracking model

518

VIDEO_ACTION_RECOGNITION = 5 # Video action recognition model

519

OCCUPANCY_COUNTING = 6 # Occupancy counting model

520

PERSON_BLUR = 7 # Person blurring model

521

VERTEX_CUSTOM = 8 # Custom Vertex AI model

522

```

523

524

## Usage Examples

525

526

### Basic Application Lifecycle

527

528

```python

529

from google.cloud import visionai_v1

530

531

# Create client

532

client = visionai_v1.AppPlatformClient()

533

534

# Define paths

535

parent = "projects/my-project/locations/us-central1"

536

app_name = f"{parent}/applications/my-video-app"

537

538

# Create application

539

application = visionai_v1.Application(

540

display_name="My Video Analytics App",

541

description="Real-time video analysis application"

542

)

543

544

create_op = client.create_application(

545

parent=parent,

546

application=application,

547

application_id="my-video-app"

548

)

549

550

# Wait for creation to complete

551

created_app = create_op.result()

552

553

# Deploy application

554

deploy_op = client.deploy_application(name=app_name)

555

deploy_op.result() # Wait for deployment

556

557

# Add stream input

558

stream_inputs = [

559

visionai_v1.ApplicationStreamInput(

560

stream_with_annotation="projects/my-project/locations/us-central1/clusters/my-cluster/streams/camera-1"

561

)

562

]

563

564

add_input_op = client.add_application_stream_input(

565

name=app_name,

566

application_stream_inputs=stream_inputs

567

)

568

add_input_op.result()

569

```

570

571

### Processor Management

572

573

```python

574

# List available prebuilt processors

575

prebuilt = client.list_prebuilt_processors(parent=parent)

576

for processor in prebuilt:

577

print(f"Available: {processor.display_name}")

578

579

# Create custom processor

580

custom_processor = visionai_v1.Processor(

581

display_name="Custom Object Detector",

582

description="Custom trained object detection model",

583

processor_type=visionai_v1.ProcessorType.CUSTOM_PROCESSOR,

584

model_type=visionai_v1.ModelType.OBJECT_DETECTION

585

)

586

587

create_processor_op = client.create_processor(

588

parent=parent,

589

processor=custom_processor,

590

processor_id="custom-detector"

591

)

592

593

processor = create_processor_op.result()

594

```