Skip to main content

Respan Replicate Instrumentation

Trace the official replicate Python SDK with Respan.

The instrumentation patches the Replicate client lifecycle and emits canonical Respan spans for run, async_run, stream, async_stream, prediction creation, prediction waiting, and prediction lookup/cancel operations.

Install

pip install respan-ai respan-instrumentation-replicate replicate

Usage

import os

import replicate
from respan import Respan, workflow
from respan_instrumentation_replicate import ReplicateInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[ReplicateInstrumentor()],
)


@workflow(name="replicate_quickstart.workflow")
def run_prediction() -> str:
    output = replicate.run(
        "meta/meta-llama-3-8b-instruct",
        input={"prompt": "Reply with one concise sentence about tracing."},
    )
    return (
        "".join(str(chunk) for chunk in output)
        if not isinstance(output, str)
        else output
    )


print(run_prediction())
respan.flush()
respan.shutdown()

Use Respan(..., customer_identifier=..., thread_identifier=..., metadata=...) or respan.propagate_attributes(...) to attach Respan attributes to Replicate spans.

Metadata

Release files for respan-instrumentation-replicate 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 respan-instrumentation-replicate 0.1.1
File Size Uploaded
respan_instrumentation_replicate-0.1.1.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-replicate 0.1.1
File Interpreter ABI Platform
respan_instrumentation_replicate-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / respan_instrumentation_replicate-0.1.1.tar.gz

Download URL respan_instrumentation_replicate-0.1.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
17e34d3afee79b0f76d33cb2f957cfbe0542db03a9e8c465bcbfa4e98c0f10a5
BLAKE2b-256 checksum
How to use checksums
145870c7a278f095dd22e97d93fe44cb187b86b8f150267f6b88f091c1c0bf48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

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

Download URL respan_instrumentation_replicate-0.1.1-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c06ae85975b6571bab0cf1075d59872f0227db0d321acec6a89a1697d3ac9f99
BLAKE2b-256 checksum
How to use checksums
ea3cd5e9221ba8df8931b2758cab447b3529812954408bbfc97fda20d4666e7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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