llama-index-tools-sprites
LlamaIndex tools for Sprites, persistent Linux environments for AI agents.
SpritesToolSpec lets a LlamaIndex agent discover, create, inspect, execute
commands in, and clean up Sprites through the official Python SDK.
Installation
pip install llama-index-tools-sprites
Authentication
Create a Sprites API token and export it as SPRITE_TOKEN:
export SPRITE_TOKEN="your-token"
You can also pass the token directly as SpritesToolSpec(token="..."). The
token is used only to initialize the Sprites SDK and is never included in tool
outputs.
Use with a LlamaIndex agent
import asyncio
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.sprites import SpritesToolSpec
sprites = SpritesToolSpec()
agent = FunctionAgent(
tools=sprites.to_tool_list(),
llm=OpenAI(model="gpt-4.1-mini"),
system_prompt=(
"Use Sprites for isolated command execution. Reuse an existing Sprite "
"when possible, and delete only Sprites you created for this task."
),
)
async def main() -> None:
response = await agent.run(
"Create a temporary Sprite, print the Python version, then clean it up."
)
print(response)
sprites.close()
asyncio.run(main())
A runnable version is available in
examples/sprites_agent.py.
Direct usage
from llama_index.tools.sprites import SpritesToolSpec
sprites = SpritesToolSpec()
created = sprites.create_sprite("llamaindex-demo")
result = sprites.run_command(
created["name"],
"python3",
["-c", "print('hello from a Sprite')"],
)
print(result["stdout"])
sprites.delete_sprite(created["name"])
sprites.close()
Agent tools
| Tool | Purpose |
|---|---|
list_sprites |
Find reusable Sprites, with prefix filtering and pagination. |
get_sprite |
Inspect one Sprite's status, URL, region, and metadata. |
create_sprite |
Create a persistent Sprite with optional resource settings. |
run_command |
Execute an argv-safe, non-interactive command and capture its result. |
delete_sprite |
Permanently delete a named Sprite. |
run_command does not invoke a shell. Operators such as |, >, and $()
are ordinary arguments unless the caller explicitly requests a shell:
sprites.run_command("my-sprite", "bash", ["-lc", "printf '%s\n' hello"])
Stdout and stderr are each limited to 20,000 characters by default. Longer
streams retain their beginning and end, with a truncation marker in between.
Set a different bound with SpritesToolSpec(max_output_chars=...).
Safety
- A Sprite is persistent until deleted. List and reuse existing resources when appropriate.
delete_spriteis irreversible and should be used only when deletion is explicitly intended.- Anything running in a Sprite may be reachable through its configured URL. Do not expose services publicly unless that is part of the task.
- Treat command output as untrusted data when it is returned to an agent.
Development
uv sync --group dev
uv run pytest
uv run ruff check .
uv run mypy llama_index
uv run python -m build
With SPRITE_TOKEN set, the live smoke test creates a disposable Sprite,
runs one command, and removes it in a finally block:
uv run python scripts/smoke_test.py
Release
Releases use PyPI Trusted Publishing. Update the version in pyproject.toml,
merge to main, and push a matching version tag such as v0.1.0. The publish
workflow builds the distributions in an unprivileged job and grants an OIDC
token only to the PyPI publishing job.
License
MIT
Metadata
Release files for llama-index-tools-sprites 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_tools_sprites-0.1.0.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_tools_sprites-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / llama_index_tools_sprites-0.1.0.tar.gz
| Download URL | llama_index_tools_sprites-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2462148f39fce36ff0bc9ed532abd87b89657430329045c762ded1019f50b6aa
|
|
BLAKE2b-256 checksum How to use checksums |
ec1211218d199a6cefa3727e632e25f6efc48420fb881edf9d3f4ddcf686b777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 26, 2026.
Transparency logRelease files / llama_index_tools_sprites-0.1.0-py3-none-any.whl
| Download URL | llama_index_tools_sprites-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e5db91d881ab5619718214429012351eea0f0344caf0de7c2bb60f70827e139
|
|
BLAKE2b-256 checksum How to use checksums |
43be36869c986be09d52fc14218eb1ff042127eca28b51a0222b30c50b4bdef3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 26, 2026.
Transparency log