Skip to main content

agent-reliability-otel-labels (Python)

Process-metadata labels for OpenTelemetry agent spans.

This library adds about nine attributes and one event type to spans that your agent already emits. It answers questions a trace cannot otherwise answer: was this the same call as before, was this a retry, does this tool destroy something, and which signed policies were actually in force.

No API key, no account, no Trustabl service.

The one prerequisite

Your agent must already be instrumented. This library decorates spans; it never creates them. LangChain's instrumentation, OpenLIT, Traceloop, OpenInference or a framework's native gen_ai support all qualify.

Install

pip install agent-reliability-otel-labels

Python 3.9 or newer. It depends on opentelemetry-api and rfc8785, not on the OpenTelemetry SDK.

Use

from agent_reliability_otel_labels import (
    Binding, Run, bind_authority, canonical_fp, mark_run_end, mark_tool_span,
)


def run_agent(args):
    run = Run()      # one per run: never share a Run between runs
    attempts = {}    # calls so far in this run, per arguments fingerprint

    with tracer.start_as_current_span("invoke_agent") as root:
        run.mark_start(root)
        bind_authority(root, bindings=[
            Binding(id="openshell-seccomp-v3", type="sandbox", sha256=...,
                    version="3.1.0", required=True, source="entrypoint"),
        ])
        try:
            with tracer.start_as_current_span("execute_tool") as span:
                key = canonical_fp(args)
                attempts[key] = attempts.get(key, 0) + 1
                step = run.next_step()
                result = None
                try:
                    result = search_flights(args)
                finally:
                    # In finally, so a call that raises is labelled too.
                    mark_tool_span(span, args=args, result=result,
                                   attempt=attempts[key], side_effect="read",
                                   step_index=step, run_id=run.run_id)

            # Call before the root span ends; an ended span drops the write.
            mark_run_end(root, exit_reason="final_answer")
        except Exception:
            mark_run_end(root, exit_reason="error")
            raise

Arguments and results are fingerprinted, never stored: the span carries a 16-character hash, not what the caller asked for. No usable span is a silent no-op, so a workload with tracing disabled is unaffected.

What it writes

Attribute On Answers
trustabl.step_index tool calls What order did this really happen in?
trustabl.run_id root and tool calls Which spans belong to one job?
trustabl.tool.input_fp tool calls Was this the same call as before?
trustabl.tool.output_fp tool calls Did the same input give the same result?
trustabl.tool.side_effect tool calls pure, read, write or irreversible? Omitted when unknown.
trustabl.tool.error_class tool calls Did it actually work?
trustabl.tool.attempt tool calls Is it retrying?
trustabl.handoff_id child agent span Which agent delegated to which?
trustabl.exit_reason root, before it ends How did the run end?
trustabl.policy.binding (event) agent / sandbox root Which signed policies were loaded?

More

The full documentation, the TypeScript and Go bindings, and a runnable example (python/examples/agent.py) are in the repository: https://github.com/trustabl/agent-reliability-otel-labels

License

Apache-2.0. See LICENSE.

Metadata

Release files for agent-reliability-otel-labels 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 agent-reliability-otel-labels 0.1.1
File Size Uploaded Provenance Actions
agent_reliability_otel_labels-0.1.1.tar.gz 21.1 kB Without provenance Details for agent_reliability_otel_labels-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-reliability-otel-labels 0.1.1
File Interpreter ABI Platform Actions
agent_reliability_otel_labels-0.1.1-py3-none-any.whl Python 3 none any Details for agent_reliability_otel_labels-0.1.1-py3-none-any.whl

Total release size: 35.9 kB

Release files / agent_reliability_otel_labels-0.1.1.tar.gz

Download URL agent_reliability_otel_labels-0.1.1.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4ac73ef4a9a2495fb5ddd6484846c1d1571a67a4746718b3e54ce17b31f02902
BLAKE2b-256 checksum
How to use checksums
b0ca0875ee94c7a88d836777934c373730be96eab1c9a5231a30cebf0514de94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / agent_reliability_otel_labels-0.1.1-py3-none-any.whl

Download URL agent_reliability_otel_labels-0.1.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c9007daa62236cd80c31dfb0333a1b4c5c75e4fcb5e03bbedbb87e698f5a77f
BLAKE2b-256 checksum
How to use checksums
b9a3fe0037020642b2346125ff03301e85baa26bd67b87a37d63a03ef1520127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for agent-reliability-otel-labels 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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