Skip to main content

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

Metadata

Release files for sprites-adk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sprites-adk 0.2.0
File Size Uploaded
sprites_adk-0.2.0.tar.gz 473.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sprites-adk 0.2.0
File Interpreter ABI Platform
sprites_adk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 484.8 kB

Release files / sprites_adk-0.2.0.tar.gz

Download URL sprites_adk-0.2.0.tar.gz
Size 473.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5b5e1394d77efa45f1c0cbabf5340741da7b1bbe9401044496847e5177d6bfe0
BLAKE2b-256 checksum
How to use checksums
5950ccb4647d9f411dd128855c70c60929e97da216f4af5617ecdb86070bca97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release files / sprites_adk-0.2.0-py3-none-any.whl

Download URL sprites_adk-0.2.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b52403def0a648578945aeaf819d1086ee6f32a7f036d0b9f55645179cb3443
BLAKE2b-256 checksum
How to use checksums
dd375c880e22886a7fb696352b7b89c3e1b151b3a90da7dd6b89d6b5ee46111d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page