From 60bb5e5cf4142539dc07fc33c078e65616e6f5d4 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 19:27:13 +0000 Subject: [PATCH 01/18] Scaffold the Gemini Managed Agents page --- docs.json | 1 + integrations/gemini-managed-agents.mdx | 111 +++++++++++++++++++++++++ integrations/index.mdx | 1 + 3 files changed, 113 insertions(+) create mode 100644 integrations/gemini-managed-agents.mdx diff --git a/docs.json b/docs.json index c913f24..a8a3832 100644 --- a/docs.json +++ b/docs.json @@ -68,6 +68,7 @@ "integrations/agent-plugins", "integrations/agent-sdks", "integrations/claude-managed-agents", + "integrations/gemini-managed-agents", "integrations/cursor-cloud-agents", "integrations/cortex-code", "integrations/platform-integrations" diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx new file mode 100644 index 0000000..2328cce --- /dev/null +++ b/integrations/gemini-managed-agents.mdx @@ -0,0 +1,111 @@ +--- +title: Gemini Managed Agents +description: "Run Gemini API Managed Agents tool calls in a per-session Sprite: bring your own sandbox, a worker, Tasks keep-alive and cleanup." +--- + +{/* + SCAFFOLD. Modeled on integrations/claude-managed-agents.mdx. + Fill every TODO from Gemini's Bring Your Own Sandbox guide before merging. + Sections marked "carries over" are Sprites behavior and should only need + names changed. Header image and lifecycle diagrams: TODO, ask Annie. +*/} + +{/* TODO: Gemini's product name, overview URL, and BYOS guide URL. Confirm they are live at launch. */} +[Gemini API Managed Agents](TODO) let Google run the agent loop and the model while the agent's tools (the filesystem it reads and writes, the commands it runs) execute in a sandbox you control. With [Bring Your Own Sandbox](TODO), you run each session inside a Sprite, so the agent's code, filesystem, and network egress never leave your infrastructure. + +## How it works + +{/* TODO: confirm Gemini's model matches: queue of work items, a worker claims each, a runner in the sandbox executes tools and reports results. Rewrite to Gemini's terms. */} +When a session is assigned to your sandbox, Gemini queues a work item. A worker you run claims the item and starts a per-session Sprite that runs Gemini's tool runner. Tool inputs and outputs flow back to Gemini so the model can see results; everything the tools touch stays in the Sprite. + +{/* TODO: Alex says the environment key works much the same way. Confirm the credential name and that the main Gemini API key never needs to reach the Sprite. */} +The runner authenticates with an **environment key**, the only credential it needs. Your Gemini API key never reaches the Sprite. + +## Before you begin + +You need: + +- A **Gemini API key** (`GEMINI_API_KEY`?) to set up the sandbox and start sessions. It stays off the Sprite. {/* TODO: env var name */} +- A **Sprites API token** (`org-slug/org-id/token-id/token-value`). Export it as `SPRITE_TOKEN`. +- A **Gemini managed agent**. {/* TODO: link to Gemini's quickstart; what ID to note */} +- A **worker runtime** on the worker host. {/* TODO: languages and packages Gemini's SDK supports */} + +## Set up the environment + +### Register your sandbox + +{/* TODO: Gemini's API call or console steps to register a self-hosted sandbox. Note what ID it returns. */} + +```bash +# TODO +``` + +### Generate an environment key + +{/* TODO: where the key is generated, and the env vars the worker reads */} + +```bash +export TODO_ENVIRONMENT_ID="..." +export TODO_ENVIRONMENT_KEY="..." +``` + +## Run the worker + +### Spawn a Sprite per session + +{/* Carries over from the Claude page. Swap the runner, the SDK install, and the env var names. */} +The worker creates a Sprite, uploads Gemini's runner, installs the SDK, and launches it as a Sprite [service](/concepts/services) rather than a detached `nohup` process. A service is supervised: the Sprite owns it, so it survives beyond the request that created it and is restored on wake. Because a service that exits is otherwise restarted, the one-shot worker stops itself on completion so it is not brought back up. + +The environment variables are written to a file the service sources rather than passed as service arguments, so the environment key never appears in process listings. The service deletes the file right after sourcing it, so the key isn't left on the Sprite's disk. + + +A service is supervised, but it does not hold the Sprite in an active state: once a session is underway the runner takes no inbound traffic, so a bare service counts as quiet and the [Sprite would pause](/concepts/lifecycle) after a short idle window, stalling a long session mid-turn. That is why the service command registers a [Task](/keeping-sprites-running) and heartbeats it while the runner works: the task holds the Sprite active for the length of the session, and its short expiry is the crash-safety net that lets the Sprite pause again if the runner dies without cleaning up. + + +{/* TODO: sprite_sandbox code. Start from the Claude page's spawn() and find_live(): keep the Sprites API calls, the env-file pattern, and the Task heartbeat service command; replace RUNNER_SRC, the pip package, the env var names, and the Sprite name prefix (gemini-agent-). Python first; add TypeScript only if there's time to test it. */} + +```python Python expandable +# sprite_sandbox.py +# TODO +``` + +### Claim work items + +{/* TODO: Gemini's poller or webhook API. Note the lease/auto-stop equivalent: the poller must not release the item out from under the Sprite. */} + +```python Python expandable +# sprites_poller.py +# TODO +``` + +## Start a session + +{/* TODO: create a session against the sandbox and send a first message, using Gemini's SDK. Where do relative paths land (workdir)? */} + +```python Python +# TODO +``` + +## Clean up + +{/* Carries over. Only the Sprite name prefix changes. */} +Each session gets its own `gemini-agent-*` Sprite, and those Sprites outlive the session. An idle Sprite [pauses](/concepts/lifecycle), which stops compute billing, but its filesystem persists and keeps accruing storage cost until you delete it, so a busy environment builds up a fleet of paused Sprites. Reap each one once its session finishes, on a session-end event or with a periodic sweep, by calling [`DELETE /v1/sprites/{name}`](/api/sprites#delete-sprite). Copy anything you need out of the workspace first (for example via the filesystem API), because deleting a Sprite deletes its checkpoints too. + +## Troubleshooting + +{/* Sprites rows carry over. Add Gemini-side rows (queue never drains, bad key) from their guide or from testing. */} + +| Symptom | Likely cause | Check / fix | +|---|---|---| +| Session created, but no Sprite ever appears | No worker is claiming the work item | TODO: Gemini's queue status check. | +| Sprite is created, but the session dies within seconds | The SDK install failed inside the Sprite (for example a network policy blocking the package index), or the environment key is invalid | Read the service log, below. | +| Not sure where to look first | The runner logs to stdout | Read `/.sprite/logs/services/agent-runner.log` inside the Sprite, via `exec` or the filesystem API. | +| Service shows `failed (exit 143)` or `stopped` right after a session finishes | Expected. That's the terminal state of the self-stop pattern, not a failure. | Nothing to fix. | +| A long session stalls mid-turn | The keep-alive task is missing or has expired, so the Sprite paused | Inside the Sprite, `sprite-env curl -s /v1/tasks` should show the `agent-runner` task with a future `expires_at` while a session is active. | + +## See also + +- [Bring Your Own Sandbox](TODO): Gemini's reference for the sandbox contract. +- [Claude Managed Agents](/integrations/claude-managed-agents): the same pattern for Anthropic's Managed Agents. +- [Services](/concepts/services): supervised long-running processes inside a Sprite. +- [Checkpoints](/concepts/checkpoints): snapshot a prepared Sprite to skip cold-start setup. diff --git a/integrations/index.mdx b/integrations/index.mdx index ea2cf3c..6f06e35 100644 --- a/integrations/index.mdx +++ b/integrations/index.mdx @@ -52,6 +52,7 @@ Use these adapters when your application owns the agent loop and needs to create | --- | --- | --- | | Anthropic Connectors Directory | A hosted Sprites connector for Claude | [Platform integrations](/integrations/platform-integrations/#anthropic-connectors-directory) | | Claude Managed Agents | A self-hosted sandbox worker backed by Sprites | [Claude Managed Agents guide](/integrations/claude-managed-agents/) | +| Gemini API Managed Agents | A Bring Your Own Sandbox worker backed by Sprites | [Gemini Managed Agents guide](/integrations/gemini-managed-agents/) | | Mistral AI | MCP connector setup reference for Mistral Studio | [Remote MCP Server](/integrations/remote-mcp/#client-setup) | | QM by Y Combinator | A Sprites sandbox backend in a QM deployment | [Platform integrations](/integrations/platform-integrations/#qm-by-y-combinator) | From 9c53e778a93cc7d8a2961d9ba4d141452cce1bf8 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 22:29:39 +0000 Subject: [PATCH 02/18] Rewrite the Gemini page around Google's BYOS guide --- integrations/gemini-managed-agents.mdx | 180 +++++++++++++++++-------- integrations/index.mdx | 2 +- 2 files changed, 124 insertions(+), 58 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 2328cce..734ad8d 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -1,111 +1,177 @@ --- -title: Gemini Managed Agents -description: "Run Gemini API Managed Agents tool calls in a per-session Sprite: bring your own sandbox, a worker, Tasks keep-alive and cleanup." +title: Gemini API Managed Agents +description: "Run Gemini API Managed Agents shell and file tools in a Sprite with Bring Your Own Sandbox: create an environment, connect a Sprite, keep it running." --- {/* - SCAFFOLD. Modeled on integrations/claude-managed-agents.mdx. - Fill every TODO from Gemini's Bring Your Own Sandbox guide before merging. - Sections marked "carries over" are Sprites behavior and should only need - names changed. Header image and lifecycle diagrams: TODO, ask Annie. + DRAFT for the Gemini BYOS launch. Source: Mariano Cocirio's guide, emailed 10 Nov 2026. + Open items before merge: + - TODO(links): Gemini overview and BYOS docs URLs, live at launch. + - TODO(test): nothing here has been run. Needs the gemini-api CLI (repo not public yet) + and a key with Managed Agents enabled. + - TODO(confirm): does `environments connect` need to stay up between interactions? + The keep-alive section assumes yes. + - TODO(image): header image, ask Annie. */} -{/* TODO: Gemini's product name, overview URL, and BYOS guide URL. Confirm they are live at launch. */} -[Gemini API Managed Agents](TODO) let Google run the agent loop and the model while the agent's tools (the filesystem it reads and writes, the commands it runs) execute in a sandbox you control. With [Bring Your Own Sandbox](TODO), you run each session inside a Sprite, so the agent's code, filesystem, and network egress never leave your infrastructure. +[Gemini API Managed Agents](TODO) run the agent loop and the model on Google's side. With [Bring Your Own Sandbox](TODO), the agent's shell and file tools execute in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, filesystem, and network egress stay on a Firecracker microVM in your Fly.io organization. ## How it works -{/* TODO: confirm Gemini's model matches: queue of work items, a worker claims each, a runner in the sandbox executes tools and reports results. Rewrite to Gemini's terms. */} -When a session is assigned to your sandbox, Gemini queues a work item. A worker you run claims the item and starts a per-session Sprite that runs Gemini's tool runner. Tool inputs and outputs flow back to Gemini so the model can see results; everything the tools touch stays in the Sprite. +You create a self-hosted environment in the Gemini API. A Sprite runs the `gemini-api` CLI's connector, which links the Sprite to that environment using an environment key. When you send the agent an interaction that targets the environment, its tool calls run inside the Sprite and the results go back to Gemini. -{/* TODO: Alex says the environment key works much the same way. Confirm the credential name and that the main Gemini API key never needs to reach the Sprite. */} -The runner authenticates with an **environment key**, the only credential it needs. Your Gemini API key never reaches the Sprite. +The connector authenticates with the **environment key** only. Your Gemini API key stays on your own machine and never reaches the Sprite. ## Before you begin You need: -- A **Gemini API key** (`GEMINI_API_KEY`?) to set up the sandbox and start sessions. It stays off the Sprite. {/* TODO: env var name */} -- A **Sprites API token** (`org-slug/org-id/token-id/token-value`). Export it as `SPRITE_TOKEN`. -- A **Gemini managed agent**. {/* TODO: link to Gemini's quickstart; what ID to note */} -- A **worker runtime** on the worker host. {/* TODO: languages and packages Gemini's SDK supports */} +- A **Gemini API key** with access to Managed Agents, exported as `GEMINI_API_KEY`. +- The **`gemini-api` CLI** on your local machine, to send interactions. {/* TODO: local install command */} +- The **`sprite` CLI**, installed and logged in: -## Set up the environment +```bash +curl -fsSL https://sprites.dev/install.sh | sh +sprite login +``` -### Register your sandbox +## Create a self-hosted environment + +```bash +curl -fsSL -X POST \ + "https://generativelanguage.googleapis.com/v1beta/environments" \ + -H "x-goog-api-key: $GEMINI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"mode": "self_hosted"}' +``` -{/* TODO: Gemini's API call or console steps to register a self-hosted sandbox. Note what ID it returns. */} +Export the environment ID and key from the response: ```bash -# TODO +export GEMINI_ENVIRONMENT_ID="environments/..." +export GEMINI_ENVIRONMENT_KEY="ek_..." ``` -### Generate an environment key + +The environment key is returned only once, when the environment is created. Store it somewhere safe. + + +## Connect a Sprite -{/* TODO: where the key is generated, and the env vars the worker reads */} +### Create the Sprite and install the CLI ```bash -export TODO_ENVIRONMENT_ID="..." -export TODO_ENVIRONMENT_KEY="..." +sprite create --skip-console gemini-byos + +sprite exec -s gemini-byos -- bash -c \ + "curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash" ``` -## Run the worker +### Store the environment key + +Write the key to a file only your user can read. The connector service reads it from there, so the key never appears in a command line or process listing. -### Spawn a Sprite per session +```bash +sprite exec -s gemini-byos --env "GEMINI_ENVIRONMENT_KEY=$GEMINI_ENVIRONMENT_KEY" -- bash -c \ + 'umask 077; printf "GEMINI_ENVIRONMENT_KEY=%s\n" "$GEMINI_ENVIRONMENT_KEY" > ~/.gemini-env' +``` -{/* Carries over from the Claude page. Swap the runner, the SDK install, and the env var names. */} -The worker creates a Sprite, uploads Gemini's runner, installs the SDK, and launches it as a Sprite [service](/concepts/services) rather than a detached `nohup` process. A service is supervised: the Sprite owns it, so it survives beyond the request that created it and is restored on wake. Because a service that exits is otherwise restarted, the one-shot worker stops itself on completion so it is not brought back up. +### Run the connector as a service -The environment variables are written to a file the service sources rather than passed as service arguments, so the environment key never appears in process listings. The service deletes the file right after sourcing it, so the key isn't left on the Sprite's disk. +You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends, and the Sprite [pauses](/concepts/lifecycle) when it goes idle. A connector only makes outbound connections, so the Sprite has no inbound traffic to keep it awake. Run the connector as a Sprite [service](/concepts/services) instead, so it restarts if it crashes, and have it hold a [Task](/keeping-sprites-running) so the Sprite stays active while it is connected. - -A service is supervised, but it does not hold the Sprite in an active state: once a session is underway the runner takes no inbound traffic, so a bare service counts as quiet and the [Sprite would pause](/concepts/lifecycle) after a short idle window, stalling a long session mid-turn. That is why the service command registers a [Task](/keeping-sprites-running) and heartbeats it while the runner works: the task holds the Sprite active for the length of the session, and its short expiry is the crash-safety net that lets the Sprite pause again if the runner dies without cleaning up. - +Write the start script: -{/* TODO: sprite_sandbox code. Start from the Claude page's spawn() and find_live(): keep the Sprites API calls, the env-file pattern, and the Task heartbeat service command; replace RUNNER_SRC, the pip package, the env var names, and the Sprite name prefix (gemini-agent-). Python first; add TypeScript only if there's time to test it. */} +```bash +sprite exec -s gemini-byos -- bash -c 'cat > ~/gemini-connect.sh <<"EOF" +#!/usr/bin/env bash +set -a; . "$HOME/.gemini-env"; set +a +export PATH="$HOME/.local/bin:$PATH" + +# Hold the Sprite active: a 5-minute task, refreshed every minute. +( while true; do + sprite-env curl -X PUT /v1/tasks/gemini-connect -d "{\"expire\": \"5m\"}" >/dev/null 2>&1 + sleep 60 + done ) & +heartbeat=$! +trap "kill $heartbeat 2>/dev/null; sprite-env curl -X DELETE /v1/tasks/gemini-connect >/dev/null 2>&1" EXIT + +gemini-api environments connect +EOF +chmod +x ~/gemini-connect.sh' +``` -```python Python expandable -# sprite_sandbox.py -# TODO +Then create the service: + +```bash +sprite exec -s gemini-byos -- \ + sprite-env services create gemini-connect --cmd /home/sprite/gemini-connect.sh ``` -### Claim work items +{/* TODO(test): confirm services run with HOME=/home/sprite so the install path and ~/.gemini-env resolve. */} -{/* TODO: Gemini's poller or webhook API. Note the lease/auto-stop equivalent: the poller must not release the item out from under the Sprite. */} +The connector's output goes to `/.sprite/logs/services/gemini-connect.log`. -```python Python expandable -# sprites_poller.py -# TODO + +While the connector runs, the task keeps the Sprite active, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` and start it again when you need it. If the connector crashes without cleaning up, the task expires within five minutes and the Sprite can pause. + + +## Run an interaction + +From your local machine, send the agent an interaction that targets your environment: + +```bash +gemini-api agent run \ + "Create hello.txt and run uname -a in bash." \ + --agent antigravity-preview-05-2026 \ + --body "{\"environment\": \"$GEMINI_ENVIRONMENT_ID\"}" ``` -## Start a session +The agent's commands run on the Sprite, and `hello.txt` stays on its disk. + +{/* TODO(test): which directory does hello.txt land in? */} + +## Use a Fly Machine instead -{/* TODO: create a session against the sandbox and send a first message, using Gemini's SDK. Where do relative paths land (workdir)? */} +To use a plain [Fly Machine](https://fly.io/docs/machines/) instead of a Sprite, store the key as an app secret rather than passing it with `-e`. That keeps it out of the Machine's config: -```python Python -# TODO +```bash +export FLY_APP="your-fly-app" +fly apps create "$FLY_APP" || true +fly secrets set -a "$FLY_APP" --stage GEMINI_ENVIRONMENT_KEY="$GEMINI_ENVIRONMENT_KEY" + +fly machine run ubuntu:24.04 -a "$FLY_APP" -- bash -c \ + "apt-get update && apt-get install -y curl ca-certificates && \ + curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash && \ + PATH=\"\$HOME/.local/bin:\$PATH\" gemini-api environments connect" ``` +{/* TODO(test): confirm a staged secret reaches a Machine started with fly machine run. */} + +A Machine runs until its process exits, so it doesn't need a keep-alive, but it bills the whole time it runs. It also reinstalls the CLI every time it starts. + ## Clean up -{/* Carries over. Only the Sprite name prefix changes. */} -Each session gets its own `gemini-agent-*` Sprite, and those Sprites outlive the session. An idle Sprite [pauses](/concepts/lifecycle), which stops compute billing, but its filesystem persists and keeps accruing storage cost until you delete it, so a busy environment builds up a fleet of paused Sprites. Reap each one once its session finishes, on a session-end event or with a periodic sweep, by calling [`DELETE /v1/sprites/{name}`](/api/sprites#delete-sprite). Copy anything you need out of the workspace first (for example via the filesystem API), because deleting a Sprite deletes its checkpoints too. +Deleting a Sprite deletes its disk and checkpoints, so copy out anything the agent wrote that you want to keep first. -## Troubleshooting +```bash +sprite destroy -s gemini-byos --force + +# Or, for a Fly Machine: +fly apps destroy "$FLY_APP" --yes +``` -{/* Sprites rows carry over. Add Gemini-side rows (queue never drains, bad key) from their guide or from testing. */} +## Troubleshooting | Symptom | Likely cause | Check / fix | |---|---|---| -| Session created, but no Sprite ever appears | No worker is claiming the work item | TODO: Gemini's queue status check. | -| Sprite is created, but the session dies within seconds | The SDK install failed inside the Sprite (for example a network policy blocking the package index), or the environment key is invalid | Read the service log, below. | -| Not sure where to look first | The runner logs to stdout | Read `/.sprite/logs/services/agent-runner.log` inside the Sprite, via `exec` or the filesystem API. | -| Service shows `failed (exit 143)` or `stopped` right after a session finishes | Expected. That's the terminal state of the self-stop pattern, not a failure. | Nothing to fix. | -| A long session stalls mid-turn | The keep-alive task is missing or has expired, so the Sprite paused | Inside the Sprite, `sprite-env curl -s /v1/tasks` should show the `agent-runner` task with a future `expires_at` while a session is active. | +| Interactions hang, then time out | The connector isn't running, or the Sprite paused | `sprite exec -s gemini-byos -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | +| The connector exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | +| `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | ## See also -- [Bring Your Own Sandbox](TODO): Gemini's reference for the sandbox contract. -- [Claude Managed Agents](/integrations/claude-managed-agents): the same pattern for Anthropic's Managed Agents. +- [Bring Your Own Sandbox](TODO): Google's reference for Gemini API self-hosted environments. +- [Claude Managed Agents](/integrations/claude-managed-agents): the same idea for Anthropic's Managed Agents. - [Services](/concepts/services): supervised long-running processes inside a Sprite. -- [Checkpoints](/concepts/checkpoints): snapshot a prepared Sprite to skip cold-start setup. +- [Keeping Sprites running](/keeping-sprites-running): the Tasks API and the heartbeat pattern. diff --git a/integrations/index.mdx b/integrations/index.mdx index 6f06e35..9e6a6cf 100644 --- a/integrations/index.mdx +++ b/integrations/index.mdx @@ -52,7 +52,7 @@ Use these adapters when your application owns the agent loop and needs to create | --- | --- | --- | | Anthropic Connectors Directory | A hosted Sprites connector for Claude | [Platform integrations](/integrations/platform-integrations/#anthropic-connectors-directory) | | Claude Managed Agents | A self-hosted sandbox worker backed by Sprites | [Claude Managed Agents guide](/integrations/claude-managed-agents/) | -| Gemini API Managed Agents | A Bring Your Own Sandbox worker backed by Sprites | [Gemini Managed Agents guide](/integrations/gemini-managed-agents/) | +| Gemini API Managed Agents | A Sprite as a Bring Your Own Sandbox environment | [Gemini API Managed Agents guide](/integrations/gemini-managed-agents/) | | Mistral AI | MCP connector setup reference for Mistral Studio | [Remote MCP Server](/integrations/remote-mcp/#client-setup) | | QM by Y Combinator | A Sprites sandbox backend in a QM deployment | [Platform integrations](/integrations/platform-integrations/#qm-by-y-combinator) | From d25ac8905505f38bd6b4573b066187d965177fdd Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 22:34:37 +0000 Subject: [PATCH 03/18] Restore --no-stdin on the scripted sprite exec calls --- integrations/gemini-managed-agents.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 734ad8d..939b3e7 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -63,7 +63,7 @@ The environment key is returned only once, when the environment is created. Stor ```bash sprite create --skip-console gemini-byos -sprite exec -s gemini-byos -- bash -c \ +sprite exec -s gemini-byos --no-stdin -- bash -c \ "curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash" ``` @@ -72,7 +72,7 @@ sprite exec -s gemini-byos -- bash -c \ Write the key to a file only your user can read. The connector service reads it from there, so the key never appears in a command line or process listing. ```bash -sprite exec -s gemini-byos --env "GEMINI_ENVIRONMENT_KEY=$GEMINI_ENVIRONMENT_KEY" -- bash -c \ +sprite exec -s gemini-byos --no-stdin --env "GEMINI_ENVIRONMENT_KEY=$GEMINI_ENVIRONMENT_KEY" -- bash -c \ 'umask 077; printf "GEMINI_ENVIRONMENT_KEY=%s\n" "$GEMINI_ENVIRONMENT_KEY" > ~/.gemini-env' ``` @@ -83,7 +83,7 @@ You can run `gemini-api environments connect` directly with `sprite exec`, but i Write the start script: ```bash -sprite exec -s gemini-byos -- bash -c 'cat > ~/gemini-connect.sh <<"EOF" +sprite exec -s gemini-byos --no-stdin -- bash -c 'cat > ~/gemini-connect.sh <<"EOF" #!/usr/bin/env bash set -a; . "$HOME/.gemini-env"; set +a export PATH="$HOME/.local/bin:$PATH" @@ -104,7 +104,7 @@ chmod +x ~/gemini-connect.sh' Then create the service: ```bash -sprite exec -s gemini-byos -- \ +sprite exec -s gemini-byos --no-stdin -- \ sprite-env services create gemini-connect --cmd /home/sprite/gemini-connect.sh ``` From a106ef5f36b0db699b27f69073e9b40913405f79 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 22:52:38 +0000 Subject: [PATCH 04/18] Update the Gemini page from Google's published example --- integrations/gemini-managed-agents.mdx | 75 +++++++++++++++----------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 939b3e7..023146d 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -4,30 +4,36 @@ description: "Run Gemini API Managed Agents shell and file tools in a Sprite wit --- {/* - DRAFT for the Gemini BYOS launch. Source: Mariano Cocirio's guide, emailed 10 Nov 2026. + DRAFT for the Gemini BYOS launch, 11 Nov 2026. + Sources: Google's Fly example (google-gemini/gemini-api-cli, docs/self-hosted/providers/fly-machines) + and their self-hosted README. Open items before merge: - - TODO(links): Gemini overview and BYOS docs URLs, live at launch. - - TODO(test): nothing here has been run. Needs the gemini-api CLI (repo not public yet) - and a key with Managed Agents enabled. - - TODO(confirm): does `environments connect` need to stay up between interactions? - The keep-alive section assumes yes. + - TODO(test): nothing here has been run. Needs a Gemini API key with Managed Agents enabled. + - TODO(links): swap the GitHub self-hosted README for an ai.google.dev page if one goes live at launch. - TODO(image): header image, ask Annie. */} -[Gemini API Managed Agents](TODO) run the agent loop and the model on Google's side. With [Bring Your Own Sandbox](TODO), the agent's shell and file tools execute in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, filesystem, and network egress stay on a Firecracker microVM in your Fly.io organization. +Gemini API Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. ## How it works -You create a self-hosted environment in the Gemini API. A Sprite runs the `gemini-api` CLI's connector, which links the Sprite to that environment using an environment key. When you send the agent an interaction that targets the environment, its tool calls run inside the Sprite and the results go back to Gemini. +You create a self-hosted environment in the Gemini API. Inside a Sprite, the `gemini-api` CLI runs `environments connect`, a worker that polls Gemini for work over outbound HTTPS. When you send the agent an interaction that targets your environment, the worker picks it up, runs the agent's tool calls inside the Sprite, and sends the results back. -The connector authenticates with the **environment key** only. Your Gemini API key stays on your own machine and never reaches the Sprite. +The worker authenticates with the **environment key** only. Your Gemini API key stays on your own machine and never reaches the Sprite. + +Because the worker polls, it only receives work while it is running. The [Run the worker as a service](#run-the-worker-as-a-service) step keeps it running and keeps the Sprite awake. ## Before you begin You need: -- A **Gemini API key** with access to Managed Agents, exported as `GEMINI_API_KEY`. -- The **`gemini-api` CLI** on your local machine, to send interactions. {/* TODO: local install command */} +- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key) with access to Managed Agents, exported as `GEMINI_API_KEY`. +- The **`gemini-api` CLI** on your local machine, to send interactions: + +```bash +curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash +``` + - The **`sprite` CLI**, installed and logged in: ```bash @@ -61,32 +67,33 @@ The environment key is returned only once, when the environment is created. Stor ### Create the Sprite and install the CLI ```bash -sprite create --skip-console gemini-byos +sprite create --skip-console gemini-self-hosted -sprite exec -s gemini-byos --no-stdin -- bash -c \ +sprite exec -s gemini-self-hosted --no-stdin -- bash -c \ "curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash" ``` ### Store the environment key -Write the key to a file only your user can read. The connector service reads it from there, so the key never appears in a command line or process listing. +Write the key to a file only your user can read. The worker reads it from there, so the key never appears in a command line or process listing. ```bash -sprite exec -s gemini-byos --no-stdin --env "GEMINI_ENVIRONMENT_KEY=$GEMINI_ENVIRONMENT_KEY" -- bash -c \ +sprite exec -s gemini-self-hosted --no-stdin --env "GEMINI_ENVIRONMENT_KEY=$GEMINI_ENVIRONMENT_KEY" -- bash -c \ 'umask 077; printf "GEMINI_ENVIRONMENT_KEY=%s\n" "$GEMINI_ENVIRONMENT_KEY" > ~/.gemini-env' ``` -### Run the connector as a service +### Run the worker as a service -You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends, and the Sprite [pauses](/concepts/lifecycle) when it goes idle. A connector only makes outbound connections, so the Sprite has no inbound traffic to keep it awake. Run the connector as a Sprite [service](/concepts/services) instead, so it restarts if it crashes, and have it hold a [Task](/keeping-sprites-running) so the Sprite stays active while it is connected. +You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends. The Sprite also [pauses](/concepts/lifecycle) when it goes idle, and outbound polling doesn't count as activity, so a paused Sprite stops picking up work. Run the worker as a Sprite [service](/concepts/services) instead, so it restarts if it crashes, and have it hold a [Task](/keeping-sprites-running) so the Sprite stays active while the worker runs. -Write the start script: +Write the start script. It gives the agent `~/workspace` as its working directory; without `--root-dir` and `--workdir`, the worker uses whatever directory it starts in. ```bash -sprite exec -s gemini-byos --no-stdin -- bash -c 'cat > ~/gemini-connect.sh <<"EOF" +sprite exec -s gemini-self-hosted --no-stdin -- bash -c 'cat > ~/gemini-connect.sh <<"EOF" #!/usr/bin/env bash set -a; . "$HOME/.gemini-env"; set +a export PATH="$HOME/.local/bin:$PATH" +mkdir -p "$HOME/workspace" # Hold the Sprite active: a 5-minute task, refreshed every minute. ( while true; do @@ -96,7 +103,7 @@ export PATH="$HOME/.local/bin:$PATH" heartbeat=$! trap "kill $heartbeat 2>/dev/null; sprite-env curl -X DELETE /v1/tasks/gemini-connect >/dev/null 2>&1" EXIT -gemini-api environments connect +gemini-api environments connect --root-dir "$HOME/workspace" --workdir "$HOME/workspace" EOF chmod +x ~/gemini-connect.sh' ``` @@ -104,16 +111,16 @@ chmod +x ~/gemini-connect.sh' Then create the service: ```bash -sprite exec -s gemini-byos --no-stdin -- \ +sprite exec -s gemini-self-hosted --no-stdin -- \ sprite-env services create gemini-connect --cmd /home/sprite/gemini-connect.sh ``` {/* TODO(test): confirm services run with HOME=/home/sprite so the install path and ~/.gemini-env resolve. */} -The connector's output goes to `/.sprite/logs/services/gemini-connect.log`. +The worker's output goes to `/.sprite/logs/services/gemini-connect.log`. -While the connector runs, the task keeps the Sprite active, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` and start it again when you need it. If the connector crashes without cleaning up, the task expires within five minutes and the Sprite can pause. +A connected Sprite stays active the whole time the worker runs, including while it waits for work, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` (the Sprite then pauses) and start it again with `sprite-env services start gemini-connect` when you need it. If the worker crashes without cleaning up, the task expires within five minutes and the Sprite can pause. ## Run an interaction @@ -127,9 +134,11 @@ gemini-api agent run \ --body "{\"environment\": \"$GEMINI_ENVIRONMENT_ID\"}" ``` -The agent's commands run on the Sprite, and `hello.txt` stays on its disk. +The agent's commands run on the Sprite, and `hello.txt` lands in `~/workspace` on the Sprite's disk. -{/* TODO(test): which directory does hello.txt land in? */} + +The file tools are confined to `--root-dir`, but `execute_bash` is not: shell commands can reach anything the Sprite's user can. The Sprite itself is the isolation boundary, so give each environment its own Sprite. + ## Use a Fly Machine instead @@ -143,19 +152,20 @@ fly secrets set -a "$FLY_APP" --stage GEMINI_ENVIRONMENT_KEY="$GEMINI_ENVIRONMEN fly machine run ubuntu:24.04 -a "$FLY_APP" -- bash -c \ "apt-get update && apt-get install -y curl ca-certificates && \ curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash && \ - PATH=\"\$HOME/.local/bin:\$PATH\" gemini-api environments connect" + mkdir -p /workspace && \ + PATH=\"\$HOME/.local/bin:\$PATH\" gemini-api environments connect --root-dir /workspace --workdir /workspace" ``` {/* TODO(test): confirm a staged secret reaches a Machine started with fly machine run. */} -A Machine runs until its process exits, so it doesn't need a keep-alive, but it bills the whole time it runs. It also reinstalls the CLI every time it starts. +A Machine runs until its process exits, so it doesn't need a keep-alive, but it is billed the whole time it runs. It also reinstalls the CLI every time it starts. ## Clean up -Deleting a Sprite deletes its disk and checkpoints, so copy out anything the agent wrote that you want to keep first. +Deleting a Sprite deletes its disk and checkpoints, so copy out anything in `~/workspace` you want to keep first. ```bash -sprite destroy -s gemini-byos --force +sprite destroy -s gemini-self-hosted --force # Or, for a Fly Machine: fly apps destroy "$FLY_APP" --yes @@ -165,13 +175,14 @@ fly apps destroy "$FLY_APP" --yes | Symptom | Likely cause | Check / fix | |---|---|---| -| Interactions hang, then time out | The connector isn't running, or the Sprite paused | `sprite exec -s gemini-byos -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | -| The connector exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | +| Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | +| The worker exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | | `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | ## See also -- [Bring Your Own Sandbox](TODO): Google's reference for Gemini API self-hosted environments. +- [Self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md): Google's reference for the worker, its flags, and its tools. +- [Google's Fly.io example](https://github.com/google-gemini/gemini-api-cli/tree/main/docs/self-hosted/providers/fly-machines): the minimal version of this setup. - [Claude Managed Agents](/integrations/claude-managed-agents): the same idea for Anthropic's Managed Agents. - [Services](/concepts/services): supervised long-running processes inside a Sprite. - [Keeping Sprites running](/keeping-sprites-running): the Tasks API and the heartbeat pattern. From 9f78e4b84c6f65cb19ca11b25e0acf47e2e82f93 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 22:55:38 +0000 Subject: [PATCH 05/18] Use keep-awake on the Gemini page: Sprites 2.0 has no Tasks API --- integrations/gemini-managed-agents.mdx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 023146d..348a7db 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -8,7 +8,9 @@ description: "Run Gemini API Managed Agents shell and file tools in a Sprite wit Sources: Google's Fly example (google-gemini/gemini-api-cli, docs/self-hosted/providers/fly-machines) and their self-hosted README. Open items before merge: - - TODO(test): nothing here has been run. Needs a Gemini API key with Managed Agents enabled. + - TODO(test): Sprite side tested 10 Nov on a Sprites 2.0 Sprite (install, key file, service, HOME, + keep-awake hold and release). connect itself untested: needs a key with Managed Agents enabled. + - Uses sprite-env keep-awake, which only Sprites 2.0 has. Sprites 1.0 used the Tasks API instead. - TODO(links): swap the GitHub self-hosted README for an ai.google.dev page if one goes live at launch. - TODO(image): header image, ask Annie. */} @@ -84,7 +86,7 @@ sprite exec -s gemini-self-hosted --no-stdin --env "GEMINI_ENVIRONMENT_KEY=$GEMI ### Run the worker as a service -You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends. The Sprite also [pauses](/concepts/lifecycle) when it goes idle, and outbound polling doesn't count as activity, so a paused Sprite stops picking up work. Run the worker as a Sprite [service](/concepts/services) instead, so it restarts if it crashes, and have it hold a [Task](/keeping-sprites-running) so the Sprite stays active while the worker runs. +You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends. The Sprite also [pauses](/concepts/lifecycle) when it goes idle, and outbound polling doesn't count as activity, so a paused Sprite stops picking up work. Run the worker as a Sprite [service](/concepts/services) instead, so it restarts if it crashes. A service alone doesn't keep a Sprite awake, so the start script also renews `sprite-env keep-awake` while the worker runs. Write the start script. It gives the agent `~/workspace` as its working directory; without `--root-dir` and `--workdir`, the worker uses whatever directory it starts in. @@ -95,13 +97,13 @@ set -a; . "$HOME/.gemini-env"; set +a export PATH="$HOME/.local/bin:$PATH" mkdir -p "$HOME/workspace" -# Hold the Sprite active: a 5-minute task, refreshed every minute. +# Keep the Sprite awake: hold for 5 minutes, renewed every minute. ( while true; do - sprite-env curl -X PUT /v1/tasks/gemini-connect -d "{\"expire\": \"5m\"}" >/dev/null 2>&1 + sprite-env keep-awake --for 5m >/dev/null 2>&1 sleep 60 done ) & heartbeat=$! -trap "kill $heartbeat 2>/dev/null; sprite-env curl -X DELETE /v1/tasks/gemini-connect >/dev/null 2>&1" EXIT +trap "kill $heartbeat 2>/dev/null; sprite-env keep-awake --release >/dev/null 2>&1" EXIT gemini-api environments connect --root-dir "$HOME/workspace" --workdir "$HOME/workspace" EOF @@ -115,12 +117,10 @@ sprite exec -s gemini-self-hosted --no-stdin -- \ sprite-env services create gemini-connect --cmd /home/sprite/gemini-connect.sh ``` -{/* TODO(test): confirm services run with HOME=/home/sprite so the install path and ~/.gemini-env resolve. */} - The worker's output goes to `/.sprite/logs/services/gemini-connect.log`. -A connected Sprite stays active the whole time the worker runs, including while it waits for work, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` (the Sprite then pauses) and start it again with `sprite-env services start gemini-connect` when you need it. If the worker crashes without cleaning up, the task expires within five minutes and the Sprite can pause. +A connected Sprite stays active the whole time the worker runs, including while it waits for work, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` (the Sprite then pauses) and start it again with `sprite-env services start gemini-connect` when you need it. If the worker crashes without cleaning up, the hold lapses within five minutes and the Sprite can pause. ## Run an interaction @@ -175,7 +175,7 @@ fly apps destroy "$FLY_APP" --yes | Symptom | Likely cause | Check / fix | |---|---|---| -| Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | +| Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env keep-awake status` should show a `keep_awake_until_ms` value, not `null`. | | The worker exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | | `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | @@ -185,4 +185,3 @@ fly apps destroy "$FLY_APP" --yes - [Google's Fly.io example](https://github.com/google-gemini/gemini-api-cli/tree/main/docs/self-hosted/providers/fly-machines): the minimal version of this setup. - [Claude Managed Agents](/integrations/claude-managed-agents): the same idea for Anthropic's Managed Agents. - [Services](/concepts/services): supervised long-running processes inside a Sprite. -- [Keeping Sprites running](/keeping-sprites-running): the Tasks API and the heartbeat pattern. From 3e2627bf334a1f4321b4d4eed3b5d0c683f45ef6 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 22:57:08 +0000 Subject: [PATCH 06/18] Revert "Use keep-awake on the Gemini page: Sprites 2.0 has no Tasks API" This reverts commit 9f78e4b84c6f65cb19ca11b25e0acf47e2e82f93. --- integrations/gemini-managed-agents.mdx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 348a7db..023146d 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -8,9 +8,7 @@ description: "Run Gemini API Managed Agents shell and file tools in a Sprite wit Sources: Google's Fly example (google-gemini/gemini-api-cli, docs/self-hosted/providers/fly-machines) and their self-hosted README. Open items before merge: - - TODO(test): Sprite side tested 10 Nov on a Sprites 2.0 Sprite (install, key file, service, HOME, - keep-awake hold and release). connect itself untested: needs a key with Managed Agents enabled. - - Uses sprite-env keep-awake, which only Sprites 2.0 has. Sprites 1.0 used the Tasks API instead. + - TODO(test): nothing here has been run. Needs a Gemini API key with Managed Agents enabled. - TODO(links): swap the GitHub self-hosted README for an ai.google.dev page if one goes live at launch. - TODO(image): header image, ask Annie. */} @@ -86,7 +84,7 @@ sprite exec -s gemini-self-hosted --no-stdin --env "GEMINI_ENVIRONMENT_KEY=$GEMI ### Run the worker as a service -You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends. The Sprite also [pauses](/concepts/lifecycle) when it goes idle, and outbound polling doesn't count as activity, so a paused Sprite stops picking up work. Run the worker as a Sprite [service](/concepts/services) instead, so it restarts if it crashes. A service alone doesn't keep a Sprite awake, so the start script also renews `sprite-env keep-awake` while the worker runs. +You can run `gemini-api environments connect` directly with `sprite exec`, but it stops when that command ends. The Sprite also [pauses](/concepts/lifecycle) when it goes idle, and outbound polling doesn't count as activity, so a paused Sprite stops picking up work. Run the worker as a Sprite [service](/concepts/services) instead, so it restarts if it crashes, and have it hold a [Task](/keeping-sprites-running) so the Sprite stays active while the worker runs. Write the start script. It gives the agent `~/workspace` as its working directory; without `--root-dir` and `--workdir`, the worker uses whatever directory it starts in. @@ -97,13 +95,13 @@ set -a; . "$HOME/.gemini-env"; set +a export PATH="$HOME/.local/bin:$PATH" mkdir -p "$HOME/workspace" -# Keep the Sprite awake: hold for 5 minutes, renewed every minute. +# Hold the Sprite active: a 5-minute task, refreshed every minute. ( while true; do - sprite-env keep-awake --for 5m >/dev/null 2>&1 + sprite-env curl -X PUT /v1/tasks/gemini-connect -d "{\"expire\": \"5m\"}" >/dev/null 2>&1 sleep 60 done ) & heartbeat=$! -trap "kill $heartbeat 2>/dev/null; sprite-env keep-awake --release >/dev/null 2>&1" EXIT +trap "kill $heartbeat 2>/dev/null; sprite-env curl -X DELETE /v1/tasks/gemini-connect >/dev/null 2>&1" EXIT gemini-api environments connect --root-dir "$HOME/workspace" --workdir "$HOME/workspace" EOF @@ -117,10 +115,12 @@ sprite exec -s gemini-self-hosted --no-stdin -- \ sprite-env services create gemini-connect --cmd /home/sprite/gemini-connect.sh ``` +{/* TODO(test): confirm services run with HOME=/home/sprite so the install path and ~/.gemini-env resolve. */} + The worker's output goes to `/.sprite/logs/services/gemini-connect.log`. -A connected Sprite stays active the whole time the worker runs, including while it waits for work, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` (the Sprite then pauses) and start it again with `sprite-env services start gemini-connect` when you need it. If the worker crashes without cleaning up, the hold lapses within five minutes and the Sprite can pause. +A connected Sprite stays active the whole time the worker runs, including while it waits for work, and an active Sprite is billed for compute. To stop billing between uses, stop the service with `sprite-env services stop gemini-connect` (the Sprite then pauses) and start it again with `sprite-env services start gemini-connect` when you need it. If the worker crashes without cleaning up, the task expires within five minutes and the Sprite can pause. ## Run an interaction @@ -175,7 +175,7 @@ fly apps destroy "$FLY_APP" --yes | Symptom | Likely cause | Check / fix | |---|---|---| -| Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env keep-awake status` should show a `keep_awake_until_ms` value, not `null`. | +| Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | | The worker exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | | `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | @@ -185,3 +185,4 @@ fly apps destroy "$FLY_APP" --yes - [Google's Fly.io example](https://github.com/google-gemini/gemini-api-cli/tree/main/docs/self-hosted/providers/fly-machines): the minimal version of this setup. - [Claude Managed Agents](/integrations/claude-managed-agents): the same idea for Anthropic's Managed Agents. - [Services](/concepts/services): supervised long-running processes inside a Sprite. +- [Keeping Sprites running](/keeping-sprites-running): the Tasks API and the heartbeat pattern. From c1b3832e461643ba4e452c73a7a6becce374d52d Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 22:57:15 +0000 Subject: [PATCH 07/18] Record what the Gemini page's Sprite steps were tested on --- integrations/gemini-managed-agents.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 023146d..71a0413 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -8,7 +8,10 @@ description: "Run Gemini API Managed Agents shell and file tools in a Sprite wit Sources: Google's Fly example (google-gemini/gemini-api-cli, docs/self-hosted/providers/fly-machines) and their self-hosted README. Open items before merge: - - TODO(test): nothing here has been run. Needs a Gemini API key with Managed Agents enabled. + - Tested 10 Nov: CLI install, key file and worker service (runs as sprite, HOME=/home/sprite, + reads the key) on a Sprite; Task hold and release on Sprites 1. + - TODO(test): connect itself, which needs a Gemini API key with Managed Agents enabled. + - Sprites 2.0 has no Tasks API (sprite-env keep-awake instead). Revisit at its release. - TODO(links): swap the GitHub self-hosted README for an ai.google.dev page if one goes live at launch. - TODO(image): header image, ask Annie. */} @@ -115,8 +118,6 @@ sprite exec -s gemini-self-hosted --no-stdin -- \ sprite-env services create gemini-connect --cmd /home/sprite/gemini-connect.sh ``` -{/* TODO(test): confirm services run with HOME=/home/sprite so the install path and ~/.gemini-env resolve. */} - The worker's output goes to `/.sprite/logs/services/gemini-connect.log`. From 80a164497d088658da630e86c894df90640311bc Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 23:11:52 +0000 Subject: [PATCH 08/18] Add a callout for Google's example and a troubleshooting intro --- integrations/gemini-managed-agents.mdx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 71a0413..4e108f6 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -26,6 +26,10 @@ The worker authenticates with the **environment key** only. Your Gemini API key Because the worker polls, it only receives work while it is running. The [Run the worker as a service](#run-the-worker-as-a-service) step keeps it running and keeps the Sprite awake. + +[Google's Fly.io example](https://github.com/google-gemini/gemini-api-cli/tree/main/docs/self-hosted/providers/fly-machines) in the `gemini-api` CLI repository is the minimal version of this setup, with the same environment, install, and interaction steps. This guide adds the service and keep-alive that let the worker run unattended. + + ## Before you begin You need: @@ -174,6 +178,8 @@ fly apps destroy "$FLY_APP" --yes ## Troubleshooting +Most failures here show up as interactions that never complete. Check the worker's service log first; it usually tells you whether the worker, the key, or the CLI install is at fault. + | Symptom | Likely cause | Check / fix | |---|---|---| | Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | From 6bc61ada1d5eccdf23c8f57732fe6c980794c2f5 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 23:12:20 +0000 Subject: [PATCH 09/18] Drop Google's example from See also; the callout links it --- integrations/gemini-managed-agents.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 4e108f6..f15fff8 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -189,7 +189,6 @@ Most failures here show up as interactions that never complete. Check the worker ## See also - [Self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md): Google's reference for the worker, its flags, and its tools. -- [Google's Fly.io example](https://github.com/google-gemini/gemini-api-cli/tree/main/docs/self-hosted/providers/fly-machines): the minimal version of this setup. - [Claude Managed Agents](/integrations/claude-managed-agents): the same idea for Anthropic's Managed Agents. - [Services](/concepts/services): supervised long-running processes inside a Sprite. - [Keeping Sprites running](/keeping-sprites-running): the Tasks API and the heartbeat pattern. From f3df2251dfdeb1732dd5ee9bdb16fa62a914ce94 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Tue, 10 Nov 2026 23:15:27 +0000 Subject: [PATCH 10/18] Make Google's example a card under the intro --- integrations/gemini-managed-agents.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index f15fff8..51e3250 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -18,6 +18,10 @@ description: "Run Gemini API Managed Agents shell and file tools in a Sprite wit Gemini API Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. + + The minimal version of this setup, from the `gemini-api` CLI repository. This guide adds the service and keep-alive that let the worker run unattended. + + ## How it works You create a self-hosted environment in the Gemini API. Inside a Sprite, the `gemini-api` CLI runs `environments connect`, a worker that polls Gemini for work over outbound HTTPS. When you send the agent an interaction that targets your environment, the worker picks it up, runs the agent's tool calls inside the Sprite, and sends the results back. @@ -26,10 +30,6 @@ The worker authenticates with the **environment key** only. Your Gemini API key Because the worker polls, it only receives work while it is running. The [Run the worker as a service](#run-the-worker-as-a-service) step keeps it running and keeps the Sprite awake. - -[Google's Fly.io example](https://github.com/google-gemini/gemini-api-cli/tree/main/docs/self-hosted/providers/fly-machines) in the `gemini-api` CLI repository is the minimal version of this setup, with the same environment, install, and interaction steps. This guide adds the service and keep-alive that let the worker run unattended. - - ## Before you begin You need: From b9f8321fe6c4eea0c87d1b32bad99f762cbb44e5 Mon Sep 17 00:00:00 2001 From: Kyle McLaren Date: Wed, 11 Nov 2026 12:16:12 +0000 Subject: [PATCH 11/18] Rename to Gemini Managed Agents --- integrations/gemini-managed-agents.mdx | 6 +++--- integrations/index.mdx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 51e3250..9cc44e8 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -1,6 +1,6 @@ --- -title: Gemini API Managed Agents -description: "Run Gemini API Managed Agents shell and file tools in a Sprite with Bring Your Own Sandbox: create an environment, connect a Sprite, keep it running." +title: Gemini Managed Agents +description: "Run Gemini Managed Agents shell and file tools in a Sprite with Bring Your Own Sandbox: create an environment, connect a Sprite, keep it running." --- {/* @@ -16,7 +16,7 @@ description: "Run Gemini API Managed Agents shell and file tools in a Sprite wit - TODO(image): header image, ask Annie. */} -Gemini API Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. +Gemini Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. The minimal version of this setup, from the `gemini-api` CLI repository. This guide adds the service and keep-alive that let the worker run unattended. diff --git a/integrations/index.mdx b/integrations/index.mdx index 9e6a6cf..a45eaf3 100644 --- a/integrations/index.mdx +++ b/integrations/index.mdx @@ -52,7 +52,7 @@ Use these adapters when your application owns the agent loop and needs to create | --- | --- | --- | | Anthropic Connectors Directory | A hosted Sprites connector for Claude | [Platform integrations](/integrations/platform-integrations/#anthropic-connectors-directory) | | Claude Managed Agents | A self-hosted sandbox worker backed by Sprites | [Claude Managed Agents guide](/integrations/claude-managed-agents/) | -| Gemini API Managed Agents | A Sprite as a Bring Your Own Sandbox environment | [Gemini API Managed Agents guide](/integrations/gemini-managed-agents/) | +| Gemini Managed Agents | A Sprite as a Bring Your Own Sandbox environment | [Gemini Managed Agents guide](/integrations/gemini-managed-agents/) | | Mistral AI | MCP connector setup reference for Mistral Studio | [Remote MCP Server](/integrations/remote-mcp/#client-setup) | | QM by Y Combinator | A Sprites sandbox backend in a QM deployment | [Platform integrations](/integrations/platform-integrations/#qm-by-y-combinator) | From 453b48060853c7748f1277e252d29014fcfd0bee Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 16:07:28 +0000 Subject: [PATCH 12/18] Use the launch agent name and AI Studio link; fix environment ID placeholders and fly apps create --- integrations/gemini-managed-agents.mdx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 9cc44e8..420ee4e 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -10,16 +10,16 @@ description: "Run Gemini Managed Agents shell and file tools in a Sprite with Br Open items before merge: - Tested 10 Nov: CLI install, key file and worker service (runs as sprite, HOME=/home/sprite, reads the key) on a Sprite; Task hold and release on Sprites 1. - - TODO(test): connect itself, which needs a Gemini API key with Managed Agents enabled. + - TODO(test): connect and an interaction end to end. Any Gemini API key works (Mariano, 11 Nov); + Kyle tested 11 Nov without a billing-enabled key. - Sprites 2.0 has no Tasks API (sprite-env keep-awake instead). Revisit at its release. - - TODO(links): swap the GitHub self-hosted README for an ai.google.dev page if one goes live at launch. - TODO(image): header image, ask Annie. */} -Gemini Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://github.com/google-gemini/gemini-api-cli/blob/main/docs/self-hosted/README.md) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. +Gemini Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://aistudio.google.com/docs/agent-environment#self-hosted-environments) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. - The minimal version of this setup, from the `gemini-api` CLI repository. This guide adds the service and keep-alive that let the worker run unattended. + The same setup as a quick start, from the `gemini-api` CLI repository. ## How it works @@ -34,7 +34,7 @@ Because the worker polls, it only receives work while it is running. The [Run th You need: -- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key) with access to Managed Agents, exported as `GEMINI_API_KEY`. +- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key), exported as `GEMINI_API_KEY`. - The **`gemini-api` CLI** on your local machine, to send interactions: ```bash @@ -61,8 +61,8 @@ curl -fsSL -X POST \ Export the environment ID and key from the response: ```bash -export GEMINI_ENVIRONMENT_ID="environments/..." -export GEMINI_ENVIRONMENT_KEY="ek_..." +export GEMINI_ENVIRONMENT_ID="..." # "id" from the response +export GEMINI_ENVIRONMENT_KEY="..." # "environment_key" from the response ``` @@ -135,7 +135,7 @@ From your local machine, send the agent an interaction that targets your environ ```bash gemini-api agent run \ "Create hello.txt and run uname -a in bash." \ - --agent antigravity-preview-05-2026 \ + --agent antigravity-preview-09-2026 \ --body "{\"environment\": \"$GEMINI_ENVIRONMENT_ID\"}" ``` @@ -151,7 +151,7 @@ To use a plain [Fly Machine](https://fly.io/docs/machines/) instead of a Sprite, ```bash export FLY_APP="your-fly-app" -fly apps create "$FLY_APP" || true +fly apps create "$FLY_APP" -o your-org # skip if the app already exists fly secrets set -a "$FLY_APP" --stage GEMINI_ENVIRONMENT_KEY="$GEMINI_ENVIRONMENT_KEY" fly machine run ubuntu:24.04 -a "$FLY_APP" -- bash -c \ From fa29fe7a1323b0d4ecf2fab677710eedf2950e15 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 16:10:47 +0000 Subject: [PATCH 13/18] Drop Sprites 2.0 note from draft comments --- integrations/gemini-managed-agents.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 420ee4e..f68e896 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -9,10 +9,9 @@ description: "Run Gemini Managed Agents shell and file tools in a Sprite with Br and their self-hosted README. Open items before merge: - Tested 10 Nov: CLI install, key file and worker service (runs as sprite, HOME=/home/sprite, - reads the key) on a Sprite; Task hold and release on Sprites 1. + reads the key) on a Sprite; Task hold and release. - TODO(test): connect and an interaction end to end. Any Gemini API key works (Mariano, 11 Nov); Kyle tested 11 Nov without a billing-enabled key. - - Sprites 2.0 has no Tasks API (sprite-env keep-awake instead). Revisit at its release. - TODO(image): header image, ask Annie. */} From bb83c1f5d21efd2e1f8af7feb2e0847ddfec65ca Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 16:48:16 +0000 Subject: [PATCH 14/18] Require a billing-enabled key, add a 403 troubleshooting row, drop the Machine secret TODO --- integrations/gemini-managed-agents.mdx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index f68e896..1dcea87 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -10,8 +10,8 @@ description: "Run Gemini Managed Agents shell and file tools in a Sprite with Br Open items before merge: - Tested 10 Nov: CLI install, key file and worker service (runs as sprite, HOME=/home/sprite, reads the key) on a Sprite; Task hold and release. - - TODO(test): connect and an interaction end to end. Any Gemini API key works (Mariano, 11 Nov); - Kyle tested 11 Nov without a billing-enabled key. + - Kyle tested 11 Nov: Sprite and Machine setup OK, staged secret reaches the Machine. + - TODO(test): an interaction end to end, which needs a key from a project with billing. - TODO(image): header image, ask Annie. */} @@ -33,7 +33,7 @@ Because the worker polls, it only receives work while it is running. The [Run th You need: -- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key), exported as `GEMINI_API_KEY`. +- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key) from a project with [billing](https://ai.google.dev/gemini-api/docs/billing) turned on, exported as `GEMINI_API_KEY`. Without billing, model and agent calls return 403. - The **`gemini-api` CLI** on your local machine, to send interactions: ```bash @@ -160,8 +160,6 @@ fly machine run ubuntu:24.04 -a "$FLY_APP" -- bash -c \ PATH=\"\$HOME/.local/bin:\$PATH\" gemini-api environments connect --root-dir /workspace --workdir /workspace" ``` -{/* TODO(test): confirm a staged secret reaches a Machine started with fly machine run. */} - A Machine runs until its process exits, so it doesn't need a keep-alive, but it is billed the whole time it runs. It also reinstalls the CLI every time it starts. ## Clean up @@ -184,6 +182,7 @@ Most failures here show up as interactions that never complete. Check the worker | Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | | The worker exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | | `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | +| `gemini-api agent run` returns 403 | The API key's project doesn't have billing turned on | Turn on billing for the project, or use a key from a project that has it. | ## See also From 41969eac09ab31141bf4b56ec619c11df6dc7487 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 17:04:46 +0000 Subject: [PATCH 15/18] Move draft notes to the PR --- integrations/gemini-managed-agents.mdx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 1dcea87..4af576a 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -3,18 +3,6 @@ title: Gemini Managed Agents description: "Run Gemini Managed Agents shell and file tools in a Sprite with Bring Your Own Sandbox: create an environment, connect a Sprite, keep it running." --- -{/* - DRAFT for the Gemini BYOS launch, 11 Nov 2026. - Sources: Google's Fly example (google-gemini/gemini-api-cli, docs/self-hosted/providers/fly-machines) - and their self-hosted README. - Open items before merge: - - Tested 10 Nov: CLI install, key file and worker service (runs as sprite, HOME=/home/sprite, - reads the key) on a Sprite; Task hold and release. - - Kyle tested 11 Nov: Sprite and Machine setup OK, staged secret reaches the Machine. - - TODO(test): an interaction end to end, which needs a key from a project with billing. - - TODO(image): header image, ask Annie. -*/} - Gemini Managed Agents run the agent loop and the model on Google's side. With [self-hosted environments](https://aistudio.google.com/docs/agent-environment#self-hosted-environments) (Bring Your Own Sandbox), the agent's shell and file tools run in a sandbox you control instead. Connect a Sprite as that sandbox and the agent's commands, files, and network egress stay on a Firecracker microVM in your Fly.io organization. From 2a08e1fbcebe3fa9591a9c1ec4da66ad656eb48d Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 17:09:21 +0000 Subject: [PATCH 16/18] Billing is only needed for Gemini 4 Argon and Carbon; the default Flash model has a free tier --- integrations/gemini-managed-agents.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 4af576a..64ce57e 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -21,7 +21,7 @@ Because the worker polls, it only receives work while it is running. The [Run th You need: -- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key) from a project with [billing](https://ai.google.dev/gemini-api/docs/billing) turned on, exported as `GEMINI_API_KEY`. Without billing, model and agent calls return 403. +- A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key), exported as `GEMINI_API_KEY`. The agent's default model, Gemini 3.8 Flash, works on the free tier. To use Gemini 4 Argon or Carbon, the key's project needs [billing](https://ai.google.dev/gemini-api/docs/billing) turned on. - The **`gemini-api` CLI** on your local machine, to send interactions: ```bash @@ -170,7 +170,7 @@ Most failures here show up as interactions that never complete. Check the worker | Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | | The worker exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | | `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | -| `gemini-api agent run` returns 403 | The API key's project doesn't have billing turned on | Turn on billing for the project, or use a key from a project that has it. | +| `gemini-api agent run` returns 403 | The interaction uses a model that needs billing, such as Gemini 4 Argon or Carbon, and the key's project is on the free tier | Use the default model, or turn on billing for the project. | ## See also From 252fd005e5aa440b1d732324bd9ef11993e9dd52 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 17:43:54 +0000 Subject: [PATCH 17/18] Add sprite upgrade note, interaction timing, and --no-stdin troubleshooting row --- integrations/gemini-managed-agents.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 64ce57e..3947c08 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -35,6 +35,8 @@ curl -fsSL https://sprites.dev/install.sh | sh sprite login ``` +If you already have the `sprite` CLI, run `sprite upgrade`. This guide uses `sprite exec --no-stdin`, which needs version 2026-09-02 or later. + ## Create a self-hosted environment ```bash @@ -128,6 +130,12 @@ gemini-api agent run \ The agent's commands run on the Sprite, and `hello.txt` lands in `~/workspace` on the Sprite's disk. +An interaction can take several minutes, most of it spent waiting on the model between tool calls. `gemini-api agent run` streams the reply as it arrives. To watch the agent's tool calls on the Sprite side, follow the service log: + +```bash +sprite exec -s gemini-self-hosted -- tail -f /.sprite/logs/services/gemini-connect.log +``` + The file tools are confined to `--root-dir`, but `execute_bash` is not: shell commands can reach anything the Sprite's user can. The Sprite itself is the isolation boundary, so give each environment its own Sprite. @@ -170,6 +178,7 @@ Most failures here show up as interactions that never complete. Check the worker | Interactions hang, then time out | The worker isn't running, or the Sprite paused | `sprite exec -s gemini-self-hosted -- sprite-env services list` should show `gemini-connect` running. `sprite-env curl -s /v1/tasks` should show the `gemini-connect` task with a future `expires_at`. | | The worker exits right after it starts | The environment key is wrong, or `~/.gemini-env` is missing | Read `/.sprite/logs/services/gemini-connect.log`. | | `gemini-api: command not found` in the log | The CLI install failed, or it installed somewhere other than `~/.local/bin` | Rerun the install step and check its output. | +| `Error: unknown flag: --no-stdin` | Your `sprite` CLI is older than 2026-09-02 | Run `sprite upgrade`. | | `gemini-api agent run` returns 403 | The interaction uses a model that needs billing, such as Gemini 4 Argon or Carbon, and the key's project is on the free tier | Use the default model, or turn on billing for the project. | ## See also From fb6ac1daa9e721c24d15247ea1a0c347609d61c6 Mon Sep 17 00:00:00 2001 From: Kristin Martin Date: Wed, 11 Nov 2026 09:56:33 -0800 Subject: [PATCH 18/18] Update installation instructions for Gemini and Sprite CLIs Added instructions for installing the 'gemini-api' and 'sprite' CLIs, including handling PATH issues. --- integrations/gemini-managed-agents.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integrations/gemini-managed-agents.mdx b/integrations/gemini-managed-agents.mdx index 3947c08..fbb6e69 100644 --- a/integrations/gemini-managed-agents.mdx +++ b/integrations/gemini-managed-agents.mdx @@ -22,12 +22,15 @@ Because the worker polls, it only receives work while it is running. The [Run th You need: - A [Gemini API key](https://ai.google.dev/gemini-api/docs/api-key), exported as `GEMINI_API_KEY`. The agent's default model, Gemini 3.8 Flash, works on the free tier. To use Gemini 4 Argon or Carbon, the key's project needs [billing](https://ai.google.dev/gemini-api/docs/billing) turned on. + - The **`gemini-api` CLI** on your local machine, to send interactions: ```bash curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash ``` +If the installer warns that `~/.local/bin` isn't in your PATH, add it as the warning suggests, or run the CLI as `~/.local/bin/gemini-api`. + - The **`sprite` CLI**, installed and logged in: ```bash