This guide describes how to set up a Google Cloud project to start using
Gemini Enterprise Agent Platform Vision.

## Set up your project

<br />

> [!NOTE]
> **Roles** : Depending on your use case, the `project.editor` role may be more appropriate. If you grant the `visionai.editor` role alone to your policy binding, you need to grant additional roles for certain operations. For example, you need to add `bigquery.dataEditor` to use a BigQuery connector, `cloudfunctions.developer` to use Cloud Run functions, etc.

Certain tasks require you to use additional
Google Cloud products in addition to Agent Platform Vision. You might
need to perform additional setup tasks to use other Google Cloud products.

## Gemini Enterprise Agent Platform Vision SDK

The Agent Platform Vision Software Development Kit (SDK) contains tools and
libraries for you to develop programs and custom workflows with
Agent Platform Vision.

These tools refer to a set of binary source files that help your productivity
when you use or develop solutions using Agent Platform Vision. You can also add
these binary source files into your scripting to help manage larger scale
deployments. The command line interface (CLI) `vaictl` is an example in this
category.

Libraries refers to a set of programming APIs that you can use to
programmatically manage, control, and perform I/O of different forms with
Agent Platform Vision. The C++ programming API is an example in this category.

The code for both tools and libraries are open source and we welcome developers
to build them directly. For tools, we also offer prebuilt binary files on
specific platforms that you can download for direct use. We also offer Docker
images for cases when your platform is not directly supported.

## Prerequisites

Consider these prerequisites before you use the Gemini Enterprise Agent Platform Vision SDK.

### Supported platforms

We only directly support x86 machines running a Debian-based Linux
distribution. We also offer a Docker image with tools already built and
installed if you use a different platform.

### Additional software requirements

Most of the third party software dependencies the Gemini Enterprise Agent Platform Vision SDK requires are
automatically managed when you install the prebuilt binaries. However, to use
certain aspects of the SDK features and workflows you must install additional
dependencies. This section lists these exceptions and how to download and
install them.

#### Python SDK

The Python pip package installs all of its dependencies automatically.
However, your basic underlying Python installation must meet
the following conditions:

- Python \>= 3.8.

#### Build from source dependencies

Most users can use the prebuilt SDK binaries for their workflow.
If you want to develop and build the SDK from source, you must also make sure
your system meets the following requirements.

- Install Bazel. For installation instructions, see the [Bazel documentation](https://bazel.build/install/ubuntu).
- On Ubuntu 20.04, you also need several system dependencies. You can install
  them with the following command:

  ```bash
  apt-get install -y --no-install-recommends \
      autoconf \
      automake \
      build-essential \
      ca-certificates \
      flex \
      bison \
      python3 \
      nasm \
      libjpeg-dev
  ```

## Get prebuilt binaries

The `vaictl` tool is the ready-made binary tool that can be used to
control Agent Platform Vision, as well as to send and receive data that it processes.

This section shows ways for you to download and install this tool.

### Install the Debian package

You have two options for using the `vaictl` command-line tool, which you
need to work with I/O (stream data):

- Install the command-line tool locally (OS: Debian GNU/Linux, CPU architecture: x86_64) *or*
- Run the commands in a Docker image that has all dependencies installed.

Use the following steps to get the `vaictl` command-line tool:

### Download package

For direct installations, we only support Debian/Ubuntu
distributions.

You can also download this Debian package from the
[Gemini Enterprise Agent Platform Vision SDK GitHub releases page](https://github.com/google/visionai/releases).

1. (Optional) Remove prior versions of `vaictl`.

   Before you can install the `vaictl` command-line tool,
   you must delete any prior versions of the tool on your machine:

   ```
   sudo apt-get remove visionai
   ```
2. Download the required package. You can download the package from the [GitHub releases page](https://github.com/google/visionai/releases), or use the following command:

   ```
   wget https://github.com/google/visionai/releases/download/v0.0.5/visionai_0.0-5_amd64.deb
   ```
3. After downloading the package, run the following command in the directory you downloaded the file:

   ```
   sudo apt install ./visionai_0.0-5_amd64.deb
   ```
4. Verify installation:

   ```
   vaictl --help
   ```

### Get Docker

You can get a Docker image that has the Gemini Enterprise Agent Platform Vision SDK and all its
dependencies already pre-installed. This Docker image is available at
`gcr.io/visionai-public-images/vaictl`.

1. Download the image from Container Registry:

   ```
   docker pull gcr.io/visionai-public-images/vaictl
   ```
2. Run an interactive container terminal.

   ```
   docker run -it --rm gcr.io/visionai-public-images/vaictl /bin/bash
   ```
3. Verify functionality:

   ```
   vaictl --help
   ```

### Get the source code

The Gemini Enterprise Agent Platform Vision SDK is open-source and publicly available on
[GitHub](https://github.com/google/visionai).

While the SDK depends on the service API definitions, this dependency is
already automatically managed by [Bazel](https://github.com/bazelbuild/bazel) and you don't
need to explicitly acquire it. However, if you need direct access to the
service APIs, you can get them on the
[`googleapis` GitHub repository](https://github.com/googleapis/googleapis/tree/master/google/cloud/visionai/v1).

## The Python programming SDK

Agent Platform Vision also supports a Python SDK. To program with this SDK,
just make sure that you have met the basic [Python SDK
dependencies](https://docs.cloud.google.com/vision-ai/docs/cloud-environment#python-version) before you [install the Python
SDK](https://docs.cloud.google.com/vision-ai/docs/cloud-environment#get-python-sdk).

For SDK reference information, see the
[Python SDK reference](https://docs.cloud.google.com/vision-ai/docs/reference/python/visionai.md.txt).

For example codes that use the Python SDK, see the
[Face blur with the Python SDK tutorial](https://docs.cloud.google.com/vision-ai/docs/face-blur-python.md.txt),
or see some examples in the source distribution in the
`visionai/python/examples/` directory.

### Get the Python SDK package

The Gemini Enterprise Agent Platform Vision SDK also contains a Python library. Download and install the
prebuilt version of the Python SDK with the following instructions.

1. Download the package.

   You can download the Python SDK package from the
   [Gemini Enterprise Agent Platform Vision SDK GitHub releases page](https://github.com/google/visionai/releases),
   or you can run the command:

   ```bash
   wget https://github.com/google/visionai/releases/download/v0.0.5/visionai-0.0.5-py3-none-any.whl
   ```
2. Optional. Create and activate a new virtual environment:

   ```bash
   python3 -m venv vaivenv
   source vaivenv/bin/activate
   ```
3. Install the package:

   ```bash
   pip3 install visionai-0.0.5-py3-none-any.whl
   ```
4. Optional. Confirm that installation worked:

   ```bash
   python3
   ```

   ```python
   import visionai
   ```
5. Optional. Deactivate your virtual environment:

   ```bash
   deactivate
   ```

## The C++ programming SDK

C++ is the first programming SDK we support. The C++ public SDK is located in
`visionai/public/streams.h`. For reference information, see the [reference
documentation](https://docs.cloud.google.com/vision-ai/docs/reference/cpp).

## What's next

- Optional: Learn how to [build and test using the C++ SDK](https://docs.cloud.google.com/vision-ai/docs/build-test-cpp.md.txt).
- Learn how to [ingest data](https://docs.cloud.google.com/vision-ai/docs/create-manage-streams.md.txt#ingest-videos) into an app and read about processing components you can add in [Build an app](https://docs.cloud.google.com/vision-ai/docs/build-app.md.txt).
- Learn about output storage and processing options in [Connect app output to a data destination](https://docs.cloud.google.com/vision-ai/docs/connect-data-destination.md.txt).
- Read about how to [Search Warehouse data in the console](https://docs.cloud.google.com/vision-ai/docs/search-streaming-warehouse.md.txt).