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

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.1.1.tar.gz (472.5 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.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sprites_adk-0.1.1.tar.gz
  • Upload date:
  • Size: 472.5 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.1.1.tar.gz
Algorithm Hash digest
SHA256 7203a510440372a45877a650804d153347052d7940c58796e5cc30d417808922
MD5 44216475960db054a18ac0a833f38d06
BLAKE2b-256 5ea526451ca7d195df621b66962554a8f0272ba1c301ca926563df7d40bcebc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sprites_adk-0.1.1.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.1.1-py3-none-any.whl.

File metadata

  • Download URL: sprites_adk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0fb02e1544596abfb7bcf1fc0b296488a3df5373a455b24caeb1bfeff5564f6
MD5 545e34a2fdf2de5bb6c0c112ab52a6b3
BLAKE2b-256 bb7bedbef5bb903a66806fbc7750bcba494f3170267b0e58e2142d52dc7ef6c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for sprites_adk-0.1.1-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