pytracer-sdk
Layer 1 of pyTracer: captures agent actions (LLM calls, tool calls, reasoning steps, handoffs) as structured, OpenTelemetry-compliant spans, with local redaction and non-blocking flush.
import pytracer_sdk as pytracer
@pytracer.op(kind="llm")
def call_model(prompt: str) -> str:
...
Capturing to a gateway
HTTPTransport ships spans to the ingestion gateway. Capture is fire-and-forget:
a gateway outage never blocks or crashes the agent. The gateway can accept a batch
(HTTP 202) yet still reject individual spans (for example a span missing
branch/commit). Those rejections are surfaced rather than lost:
HTTPTransport.rejected_spansis a running count of spans the gateway rejected.- Each rejection is logged as a warning (on the
pytracer_sdklogger) with the gateway's reason. on_rejection, an optionalCallable[[int, list], None], is called with the count and the error list when a batch had rejections, so a sender can alert or fail its CI on silently dropped spans.
from pytracer_sdk.transport import HTTPTransport
def alert(count, errors):
raise SystemExit(f"gateway rejected {count} span(s): {errors[0]}")
transport = HTTPTransport("https://gateway.example", api_key="...", on_rejection=alert)
pytracer.configure(transport, service_name="my-agent")
# ... run the agent ...
print(transport.rejected_spans) # 0 when every span was accepted
A bad on_rejection callback can never kill the flush worker: it is called
defensively and a raise from it is logged, not propagated.
Spans lost before they reach the gateway
Spans can also be lost on the client side, before the gateway sees them: the in-process queue is full (the agent produces spans faster than they can be shipped), or a delivery fails (the gateway is unreachable, or a 429/503 persists past the retries). These are surfaced the same way:
tracer.buffer.droppedcounts spans dropped because the queue was full, andtracer.buffer.send_errorscounts spans whose delivery failed.- Each loss is logged as a warning on the
pytracer_sdklogger. The warning is rate limited to one per reason every 30 seconds, carrying the number of spans lost since the previous one, so an outage does not flood the agent's log; losses still waiting for the next warning are logged at shutdown. A full queue is warned at the moment of the first drop. on_drop, an optionalCallable[[str, int, BaseException | None], None]passed toconfigure(), is called with the reason ("queue_full"or"send_failed"), the number of spans, and the delivery error (Nonefor a full queue). It runs on the buffer's background thread, never the agent's: spans dropped from a full queue are counted as they are dropped and reported together. During an outage the callback can lag the drops by one send attempt (about 35 seconds at worst, against a gateway answering 429 or 503), while the warning is immediate. Likeon_rejection, a raise from it is logged, not propagated.
def on_drop(reason, count, error):
metrics.increment("pytracer.spans_lost", count, tags={"reason": reason})
tracer = pytracer.configure(transport, service_name="my-agent", on_drop=on_drop)
# ... run the agent ...
print(tracer.buffer.dropped, tracer.buffer.send_errors) # 0 0 when nothing was lost
If dropped grows, raise the queue bound with
SpanBuffer(transport, max_queue_size=...) passed as Tracer(..., buffer=...),
or ship to a closer or larger gateway.
Metadata
Release files for pytracer-sdk 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytracer_sdk-0.1.4.tar.gz | 45.7 kB | With provenance | Details for pytracer_sdk-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytracer_sdk-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for pytracer_sdk-0.1.4-py3-none-any.whl |
Total release size: 80.0 kB
Release files / pytracer_sdk-0.1.4.tar.gz
| Download URL | pytracer_sdk-0.1.4.tar.gz |
|---|---|
| Size | 45.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87c98580c2fb9fba462c3f9c9362dd15da3303b94602c0cbab839f5e879cd109
|
|
BLAKE2b-256 checksum How to use checksums |
8ec18618d8fcd9113ee93f06c57d65a0df292039eb70613b92c97fee078e7330
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 26, 2026.
Transparency logRelease files / pytracer_sdk-0.1.4-py3-none-any.whl
| Download URL | pytracer_sdk-0.1.4-py3-none-any.whl |
|---|---|
| Size | 34.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
063f2598dce006d176c8c3799b5705abd98014e5b134e7453522ce6cfa924a5a
|
|
BLAKE2b-256 checksum How to use checksums |
56de67be9235fa32296130c0402477e9764bfd5fa14239a4cc0375f270b59cd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 26, 2026.
Transparency logSecurity for pytracer-sdk 0.1.4
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
Both files in this release have been uploaded with provenance metadata.
Attestation for pytracer_sdk-0.1.4.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 Oct 26, 2026.
Transparency logA 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.