Skip to main content

agentbelt-sampler

Agent-aware span sampling: always keep errors, cost/latency outliers, retries, and novel calls; sample everything else at a low rate. Part of the agentbelt suite.

pip install agentbelt-sampler
# or, for the real OpenTelemetry Sampler adapter:
pip install agentbelt-sampler[otel]

Quickstart

from agentbelt_sampler import Sampler, SamplingPolicy, Span

sampler = Sampler(SamplingPolicy(boring_sample_rate=0.05))

if sampler.should_keep(Span(tool="search", cost_usd=0.002, is_error=False)):
    export(span)

Run python examples/volume_demo.py for a concrete before/after number (errors and outliers 100% retained, overall volume cut substantially on a repetitive synthetic stream).

What did this actually catch?

print(sampler.impact_report())
# 100 span(s) seen, 11 kept (89.0% reduction)

The most direct of the three impact reports — seen vs. kept, mapped straight to observability-backend cost reduction.

See the suite README for the full concept and how this fits with agentbelt-budget and agentbelt-loop.

License

MIT

Metadata

Release files for agentbelt-sampler 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-sampler 0.1.1
File Size Uploaded Provenance
agentbelt_sampler-0.1.1.tar.gz 8.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / agentbelt_sampler-0.1.1.tar.gz

Download URL agentbelt_sampler-0.1.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7269818b7ab23b28a009489b5d3dd9ac7e2908e088e6ac9aea4715490faa8149
BLAKE2b-256 checksum
How to use checksums
70c788313a0c66b5da09f0011fbd21ed5725b03f9785867fe526f36292abd7d2
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_sampler-0.1.1-py3-none-any.whl

Download URL agentbelt_sampler-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0aae36758795224e3d235d5e8d04b605e9a43ba1e3f6ad21c38e6bcca1491055
BLAKE2b-256 checksum
How to use checksums
e4ed008c9bc1f371f85fba03fec93d2d1368502b2d0e77ae8dab7a2414fe5505
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-sampler 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_sampler-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.

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

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