> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sazabi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini sandbox CLI

> Give the Sazabi agent the Gemini CLI (gemini) in its sandbox for AI-powered coding with Google's Gemini models.

[All Gemini integration capabilities](https://docs.sazabi.com/catalogs/integrations/gemini-cli)

## About

This CLI connection makes the Gemini CLI (`gemini`) available in the Sazabi agent's sandbox, so the agent can use Google's Gemini models for AI-powered coding. The CLI is already in the sandbox; connecting your Gemini API key authenticates it.

This page covers giving the agent the CLI. To send Gemini CLI telemetry to Sazabi instead, see [Gemini CLI agent telemetry](https://docs.sazabi.com/catalogs/log-sources/coding-agents/gemini-cli.md).

## Prerequisites

* A Sazabi project.
* A Gemini API key (`GEMINI_API_KEY`) from [Google AI Studio](https://aistudio.google.com/apikey). Create it in the Google Cloud project that should own billing and quota for the sandbox.

## Set up in the dashboard

Configure the sandbox in the dashboard under [**Settings > Sandbox CLIs**](https://app.sazabi.com/settings/sandbox-clis).

**Step 1**

### Find Gemini in the catalog

In [**Settings > Sandbox CLIs**](https://app.sazabi.com/settings/sandbox-clis), find Gemini under **Browse sandbox CLIs** and choose to connect it.

**Step 2**

### Provide credentials

Paste your key into **Gemini API key** and save. Sazabi checks the key with the Gemini API before saving, and a rejected key saves nothing. Sazabi injects it into the sandbox when the agent runs.

## Set up with the CLI

You can also configure the Gemini CLI connection with the [Sazabi CLI](https://docs.sazabi.com/reference/cli.md) (installed and authenticated; see [CLI reference](https://docs.sazabi.com/reference/cli/sandbox-clis.md)).

```bash theme={"system"}
sazabi sandbox-clis connect gemini-cli --env GEMINI_API_KEY=<your-gemini-key>
```

`connect` tests the key first, and a failed test saves nothing. To validate the key without saving, run the same command with `test` in place of `connect` (the test command also requires the `--env` flags). To read the key from a file, use `--env-file <path>`.

## Verify

In a thread, ask the agent to run `gemini -p "Reply with exactly: pong"` and show the output. The check passes when the thread shows the reply `pong`. An authentication or permission error means the key wasn't accepted; see Troubleshooting.

## Troubleshooting

**Command not found**: Confirm the Gemini CLI connection is enabled for the project under [**Settings > Sandbox CLIs**](https://app.sazabi.com/settings/sandbox-clis).

**Authentication fails**: Sazabi rejects an invalid key when you connect, so a later failure usually means the key was revoked or restricted. Create a new key in [Google AI Studio](https://aistudio.google.com/apikey), confirm it belongs to the Google Cloud project you expect, and connect it again under [**Settings > Sandbox CLIs**](https://app.sazabi.com/settings/sandbox-clis) or with `sazabi sandbox-clis connect gemini-cli`.

## Further reading

> [card] [Working with the agent](https://docs.sazabi.com/ask/better-answers.md)
>
> Put the connected CLI to work in an investigation thread.

> [card] [Set up the sandbox](https://docs.sazabi.com/ask/sandbox.md)
>
> How the sandbox works and its security model.

> [card] [Sandbox CLIs](https://docs.sazabi.com/catalogs/integrations.md#sandbox-clis)
>
> Browse the catalog and connect more tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.