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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_tools_sprites-0.1.0.tar.gz.
File metadata
- Download URL: llama_index_tools_sprites-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2462148f39fce36ff0bc9ed532abd87b89657430329045c762ded1019f50b6aa
|
|
| MD5 |
2e4f3f8a3a15cc78701d8a48cf8b6fcc
|
|
| BLAKE2b-256 |
ec1211218d199a6cefa3727e632e25f6efc48420fb881edf9d3f4ddcf686b777
|
Provenance
The following attestation bundles were made for llama_index_tools_sprites-0.1.0.tar.gz:
Publisher:
publish.yml on superfly/llama-index-tools-sprites
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llama_index_tools_sprites-0.1.0.tar.gz -
Subject digest:
2462148f39fce36ff0bc9ed532abd87b89657430329045c762ded1019f50b6aa - Sigstore transparency entry: 2595543430
- Sigstore integration time:
-
Permalink:
superfly/llama-index-tools-sprites@f373ec8dd473f55bdb16be053dd84fe20ca51d69 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/superfly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f373ec8dd473f55bdb16be053dd84fe20ca51d69 -
Trigger Event:
push
-
Statement type:
File details
Details for the file llama_index_tools_sprites-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_tools_sprites-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e5db91d881ab5619718214429012351eea0f0344caf0de7c2bb60f70827e139
|
|
| MD5 |
6938f78b3b4cce4622d6237bdfbb690d
|
|
| BLAKE2b-256 |
43be36869c986be09d52fc14218eb1ff042127eca28b51a0222b30c50b4bdef3
|
Provenance
The following attestation bundles were made for llama_index_tools_sprites-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on superfly/llama-index-tools-sprites
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llama_index_tools_sprites-0.1.0-py3-none-any.whl -
Subject digest:
3e5db91d881ab5619718214429012351eea0f0344caf0de7c2bb60f70827e139 - Sigstore transparency entry: 2595543498
- Sigstore integration time:
-
Permalink:
superfly/llama-index-tools-sprites@f373ec8dd473f55bdb16be053dd84fe20ca51d69 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/superfly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f373ec8dd473f55bdb16be053dd84fe20ca51d69 -
Trigger Event:
push
-
Statement type: