spanix
A local profiler for AI agents. One line, no account, no server.
An agent SDK reports cost, tokens and duration on every message it streams.
It reports them exactly once, and the caller's for loop throws them away.
spanix stops throwing them away.
from claude_agent_sdk import query
from spanix import watch, last_run
stream = query(prompt=p, options=opts)
async for msg in watch(stream, run="nightly"):
handle(msg)
print(last_run().summary())
spanix · nightly 22.6s
cost $0.6512
tokens 206,431 (in 184,220 · out 8,911 · cache 13,300)
turns 11
messages 38
tools Read ×1, WebFetch ×5, Grep ×1
The message is yielded untouched, so the loop around it does not change.
Design
It never breaks your agent. Every recording path is wrapped in its own
try, and the message is always yielded. A profiler that takes down production
is a profiler nobody installs.
It never imports your agent SDK. Fields are read by name with fallbacks, so
pip install spanix pulls in nothing, and supporting a second runtime is just
another list of names. There are zero dependencies.
It never keeps content. Prompts, tool arguments and tool results carry API keys and customer data. Only counters and tool names are stored.
Status
0.0.1 is the accounting core: watch(), in-memory Run records and
summary(). Nothing is written to disk and nothing is sent anywhere.
Next: SQLite at ~/.spanix/runs.db, the subagent tree with cost rolled up per
node, and a panel on localhost.
License
Apache-2.0
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 spanix-0.0.2.tar.gz.
File metadata
- Download URL: spanix-0.0.2.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c12196e2bd36586c72048ff2f3903b049a8ac870e1e080295b0e07aa287fe70
|
|
| MD5 |
3888ab40080ec8b24f6302740a80f553
|
|
| BLAKE2b-256 |
3e44e12f265c6530af049bb655497430ac034fe14b986b9fc05414f734c8f89c
|
File details
Details for the file spanix-0.0.2-py3-none-any.whl.
File metadata
- Download URL: spanix-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
563ec43dcef0c6a5323f3ff89e7ec3c208f1661f3ed498b9751653afcaf8b008
|
|
| MD5 |
01fb6567ba7842c0658104a14f44fa0f
|
|
| BLAKE2b-256 |
1ffdd788fc6bd2241d92770c19e6dd64c14218f8740197d4e226b616fa794fd9
|