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.1

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.1
File Size Uploaded Provenance
agentbelt_core-0.1.1.tar.gz 9.6 kB With provenance Details

Built distribution (wheel)

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

Total release size: 19.4 kB

Release files / agentbelt_core-0.1.1.tar.gz

Download URL agentbelt_core-0.1.1.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dd7380a23920885776b2604550bde1e74db428af4fcf33d2d8a1060406de2346
BLAKE2b-256 checksum
How to use checksums
52b3d78a6423a9f68dbd88ae2d45a33d7b09812d6a3e6a16398fd212af5d6aed
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.1-py3-none-any.whl

Download URL agentbelt_core-0.1.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1db2767bc520876e78d03f77066e881f25781a0138af75ec3c52b5d100c2d0e1
BLAKE2b-256 checksum
How to use checksums
cbd3626a9dd2a3c66dd771de74e9f3340a84ea70716ec8d62b882c5236caa515
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.1

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.1.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.

Release history Release notifications | RSS feed

This release

0.1.1 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