Skip to main content

Google ADK plugin for Sprites: persistent, stateful Linux sandboxes with checkpoint/restore for AI agents.

Project description

sprites-adk

Google ADK integration for Sprites — persistent, stateful Linux sandboxes for AI agents, with checkpoint/restore, from Fly.io.

Most agent sandboxes are ephemeral: the environment vanishes when the session ends. A Sprite is a stateful Linux microVM that suspends when idle and keeps everything — files, packages, databases, running services — so your agent can resume yesterday's environment today. And because Sprites support checkpoints, your agent can snapshot the whole environment before a risky change and roll back if it goes wrong.

Installation

pip install sprites-adk

You'll need a Sprites API token (get started):

export SPRITES_TOKEN=...

Quickstart

from google.adk.agents import Agent
from sprites_adk import SpritesPlugin

plugin = SpritesPlugin()  # or SpritesPlugin(sprite_name="my-project") for a persistent env

root_agent = Agent(
    model="gemini-flash-latest",
    name="sprite_agent",
    instruction="Run code and commands in the Sprite sandbox, not locally.",
    tools=plugin.get_tools(),
)

Pass the plugin to your runner to get lifecycle callbacks and error handling:

runner = InMemoryRunner(agent=root_agent, plugins=[plugin])

Two modes

SpritesPlugin() SpritesPlugin(sprite_name="my-project")
Sprite name auto-generated adk-… yours
Reused across sessions no yes — full state persists
Destroyed on plugin.close() yes no

The Sprite is created lazily on first tool use; constructing the agent needs no network. Sprites suspend automatically when idle — a parked environment costs (almost) nothing.

Tools

Tool Description
execute_command_in_sprite Run a shell command (cwd, timeout supported)
execute_code_in_sprite Run a Python / JavaScript / bash snippet
write_file_to_sprite Write a text file (parents auto-created)
read_file_from_sprite Read a text file
create_sprite_checkpoint Snapshot the entire environment
list_sprite_checkpoints List checkpoints, newest first
restore_sprite_checkpoint Roll back to a checkpoint (destructive, requires confirm=true)

All tools return structured dicts (success, stdout/stderr/exit_code, …); failures come back as {"success": false, "error": ...} so the agent can adapt instead of crashing the run.

File reads and writes run as commands inside the Sprite (via base64, so quotes/newlines/unicode survive) rather than through a separate filesystem API. That keeps them consistent with everything else the agent does — in particular, files written this way are correctly reverted by restore_sprite_checkpoint. write_file_to_sprite is capped at 256 KB; generate larger files with a command inside the Sprite. /tmp is tmpfs and is not captured by checkpoints.

A note on restore

restore_sprite_checkpoint rewinds the whole environment and permanently discards anything newer than the checkpoint. The tool refuses to run unless confirm=true is passed, and its description instructs the model to get explicit user confirmation first.

Configuration

SpritesPlugin(
    token=None,                # default: $SPRITES_TOKEN
    sprite_name=None,          # default: auto-generated "adk-…"
    plugin_name="sprites_plugin",
    base_url="https://api.sprites.dev",
    destroy_on_close=None,     # default: True if unnamed, False if named
    client_timeout=600.0,      # HTTP timeout for Sprites API calls
)

Examples

Attribution

So Fly.io can estimate how much Sprites usage is agent-driven, this plugin declares itself as ADK by setting FLY_INVOKED_BY=google-adk (only if unset — an explicit value is never overwritten). Sprites API calls then carry a coarse, privacy-safe client-signals marker (agent=google-adk). It's advisory only — never used for gating or rate-limiting — and you can opt out by setting FLY_INVOKED_BY to your own value.

Resources

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sprites_adk-0.2.0.tar.gz (473.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sprites_adk-0.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file sprites_adk-0.2.0.tar.gz.

File metadata

  • Download URL: sprites_adk-0.2.0.tar.gz
  • Upload date:
  • Size: 473.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sprites_adk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5b5e1394d77efa45f1c0cbabf5340741da7b1bbe9401044496847e5177d6bfe0
MD5 29dbf4b7b71c99e16f9ee49fdaad78d0
BLAKE2b-256 5950ccb4647d9f411dd128855c70c60929e97da216f4af5617ecdb86070bca97

See more details on using hashes here.

Provenance

The following attestation bundles were made for sprites_adk-0.2.0.tar.gz:

Publisher: publish.yml on superfly/sprites-adk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sprites_adk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sprites_adk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sprites_adk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b52403def0a648578945aeaf819d1086ee6f32a7f036d0b9f55645179cb3443
MD5 721c98c962c707b2329168c8420e8691
BLAKE2b-256 dd375c880e22886a7fb696352b7b89c3e1b151b3a90da7dd6b89d6b5ee46111d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sprites_adk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on superfly/sprites-adk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page