Skip to main content

Respan Helicone instrumentation

Trace calls made through Helicone's Python manual logger with Respan. This package instruments the published helicone-helpers HeliconeManualLogger surface without replacing or bypassing Helicone's own logging behavior.

The instrumentation covers:

  • HeliconeManualLogger.log_request() and direct send_log() calls
  • HeliconeLogBuilder, including streamed chunks and error logs
  • OpenAI-, Anthropic-, and custom-model request/response payloads
  • Helicone _type=tool, _type=vector_db, and _type=data custom logs
  • sync manual logging and the builder's async send_log() lifecycle

Install

pip install respan-ai respan-instrumentation-helicone "helicone-helpers~=1.2.1"

Usage

import os

from helicone_helpers import HeliconeManualLogger
from respan import Respan, workflow
from respan_instrumentation_helicone import HeliconeInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[HeliconeInstrumentor()],
)
helicone = HeliconeManualLogger(api_key=os.environ["HELICONE_API_KEY"])


@workflow(name="helicone_manual_log")
def run(prompt: str) -> str:
    request = {
        "model": "custom-chat-model",
        "messages": [{"role": "user", "content": prompt}],
    }

    def operation(recorder):
        response = {
            "model": "custom-chat-model",
            "choices": [{"message": {"role": "assistant", "content": "Hello!"}}],
            "usage": {
                "prompt_tokens": 4,
                "completion_tokens": 2,
                "total_tokens": 6,
            },
        }
        recorder.append_results(response)
        return "Hello!"

    return helicone.log_request(request, operation, provider="openai")


try:
    print(run("Say hello."))
finally:
    respan.flush()
    respan.shutdown()

HeliconeInstrumentor(capture_content=False) keeps span identity, model, provider, timing, usage, and errors while omitting request and response content. Authentication and Helicone transport headers are never copied into spans. Safe constructor/request correlation headers are normalized into canonical customer/session fields and one JSON respan.metadata attribute.

Activation and overlap policy

Helicone manual logging is explicit instrumentation. Activate HeliconeInstrumentor() only in applications that use HeliconeManualLogger; it is not a direct-provider auto-instrumentor. The package patches Helicone's logger and builder methods only—it does not patch OpenAI, Anthropic, or another provider SDK.

Do not combine this package with instrumentation for the provider operation that the same manual log describes unless you intentionally want both records. For example, wrapping an OpenAI call in HeliconeManualLogger.log_request() while also activating OpenAIInstrumentor() produces one provider span and one Helicone manual-log span for the same logical model call.

The instrumentor is reference-counted and restores the exact SDK methods it patched when the final owner deactivates. It also exposes instrument() and uninstrument() aliases for compatibility with OpenTelemetry-style lifecycle code.

See the Helicone example set in respan-example-projects/python/tracing/helicone for deterministic sync, async-builder, streaming, error, tool, vector database, and custom data coverage.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_helicone-0.1.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

respan_instrumentation_helicone-0.1.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file respan_instrumentation_helicone-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_helicone-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e8ecf7d2af76ffd9d19ca4e2e9843a5158250e49fedc15a2c3673987a841a040
MD5 7af3fcf954f7b7601085072b8f2ec155
BLAKE2b-256 113e2f3ace2afb86b162c65d0e12f7905d78aca955c3f02ea2b30da739b0060d

See more details on using hashes here.

File details

Details for the file respan_instrumentation_helicone-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_helicone-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d90910b7b025b9bef15d44d227ade28be14f0d4fe78c1481234096cd287f4288
MD5 b56daaa70a1ac1469a521ba20288182e
BLAKE2b-256 b7c91f3c32af7c9e0ba9db48d8626a5f277a5c2db406c5c5deb186f99c485c06

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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