Skip to main content

agentbelt-core

Shared fingerprinting and storage primitives for the agentbelt suite (agentbelt-budget, agentbelt-loop, agentbelt-sampler), plus an opt-in runtime profiler you can use directly. Most consumers pull this in transitively as a dependency of the other packages, but the profiling tool below is meant to be imported and used on its own.

pip install agentbelt-core   # usually pulled in transitively

What's here

  • fingerprint.py — normalize tool calls/results (volatile-field stripping, stable JSON), hash, and fuzzy token-overlap similarity
  • keyed_store.py — thread-safe per-key state base class
  • profiling.py — opt-in runtime profiler for measuring your own real usage of any agentbelt package (see below)

Profiling your own usage

The numbers published in the suite's root README are measured on a synthetic benchmark, on someone else's hardware. If you want to know the actual overhead agentbelt-budget/-loop/-sampler add inside your application, under your real traffic - wrap the calls you care about:

from agentbelt_core.profiling import Profiler

profiler = Profiler()

with profiler.track("budget.check"):
    breaker.check(session_id)

with profiler.track("loop.record"):
    loop_detector.record(session_id, tool=tool_name, args=args, result=result)

# ... run your real workload for a while, then:
print(profiler.report_text())
# budget.check: n=4210  median=3.1us  mean=3.4us  min=1.9us  max=41.2us
# loop.record: n=4210  median=14.8us  mean=15.9us  min=9.1us  max=88.0us

Or as a decorator, if you'd rather instrument a function once instead of wrapping every call site:

@profiler.profiled()
def call_llm_with_guard(session_id, prompt):
    breaker.check(session_id)
    response = call_llm(prompt)
    breaker.record_response(session_id, response, model="gpt-4o")
    return response

Memory profiling is opt-in and off by default (tracemalloc has its own overhead if left running continuously):

profiler = Profiler(track_memory=True)          # every tracked block measures memory
# or, per call:
with profiler.track("budget.check", memory=True):
    breaker.check(session_id)

profiler.report() gives you the same data as a plain dict, if you'd rather log it as structured data than print the text summary. .reset() clears accumulated stats (for one label, or everything) if you want to profile in rolling windows rather than accumulate for the process lifetime.

This adds zero overhead when you don't use it — no background thread, no daemon, nothing runs unless you explicitly wrap something in .track() or @profiled.

License

MIT

Metadata

Release files for agentbelt-core 0.1.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 agentbelt-core 0.1.0
File Size Uploaded Provenance
agentbelt_core-0.1.0.tar.gz 9.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentbelt-core 0.1.0
File Interpreter ABI Platform
agentbelt_core-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / agentbelt_core-0.1.0.tar.gz

Download URL agentbelt_core-0.1.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fe0b7fd5536a841848418345503641915b1769d2f0e5c2b17bbf9f6d3d2f1769
BLAKE2b-256 checksum
How to use checksums
c6fa0923ed6d97c8c89d097f60adb1508c0f8796bdadf4971d9953446649532c
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 Sep 8, 2026.

Transparency log

Release files / agentbelt_core-0.1.0-py3-none-any.whl

Download URL agentbelt_core-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2f33fb5152d0d0672167416d1de51cad50d878b7cffd4078ed1d4f3ee581c78
BLAKE2b-256 checksum
How to use checksums
163050af2821bef9001c75a6d61b842998c27da48a66401ba15afbb74ab5bc74
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 Sep 8, 2026.

Transparency log

Security for agentbelt-core 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentbelt_core-0.1.0.tar.gz

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 Sep 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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