One-line LangChain observability for Netra Runtime: traces into your Usage tab.
Project description
netra-observe
One-line LangChain observability for Netra Runtime: your agents, chains, tools, and LLM calls land as traces in the dashboard's Usage tab, with cost and token numbers taken from the gateway's billing ledger — never from client-side estimates.
Install
pip install netra-observe
Quickstart
from netra_observe import instrument
instrument(api_key="sk_live_...", project="support-agent")
Call it once at startup, before building your chains. Everything LangChain runs after that — agents, chains, tools, retrievers, LLM calls — is traced automatically (via OpenInference's LangChain instrumentation) and exported to Netra over OTLP.
Point your LLM at the Netra gateway as usual:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="qwen3.6-35b",
base_url="https://api.netraruntime.com/v1",
api_key="sk_live_...", # same Netra key
)
See examples/langchain_agent.py for a runnable tool-calling agent.
Configuration
instrument() argument |
Env fallback | Default |
|---|---|---|
api_key |
NETRA_API_KEY |
— (required) |
project |
NETRA_PROJECT |
None |
environment |
NETRA_ENVIRONMENT |
None |
endpoint |
NETRA_OTEL_ENDPOINT |
https://api.netraruntime.com/v1/otel |
tracer_provider |
— | netra-observe creates one |
instrument() returns a handle: handle.flush() forces an export,
handle.shutdown() (or using the handle as a context manager) flushes and
detaches everything. Pass your own tracer_provider to attach Netra's
exporter setup to an existing OpenTelemetry deployment instead of letting
the SDK own one.
How cost attribution works
The SDK propagates W3C trace context (traceparent) on HTTP requests to
the Netra gateway — propagation only, it never starts spans of its own.
The gateway records the trace/span id on its billing ledger row, so the LLM
span in your trace is joined server-side to the exact request the gateway
metered. Tokens and cost shown in the Usage tab come from that ledger;
client-reported numbers are never billed.
Failure isolation
netra-observe must never break your app: export failures are logged and
dropped (spans are batched and sent in the background), header injection
degrades to "no header" on any error, and shutdown() caps its final flush
at 5 seconds.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netra_observe-0.1.0.tar.gz.
File metadata
- Download URL: netra_observe-0.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ad4720f1dcf99813a814b51186902f68ea512d3c71b48abf983c6d8b6db07f
|
|
| MD5 |
86a9603c77125d382c6f48ef50ff6abc
|
|
| BLAKE2b-256 |
aa2db32b9f6cf0401d719724e299ffd5429de5dcea197168af34265227428e29
|
Provenance
The following attestation bundles were made for netra_observe-0.1.0.tar.gz:
Publisher:
publish.yml on NetraRuntime/netra-observe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netra_observe-0.1.0.tar.gz -
Subject digest:
17ad4720f1dcf99813a814b51186902f68ea512d3c71b48abf983c6d8b6db07f - Sigstore transparency entry: 2099690997
- Sigstore integration time:
-
Permalink:
NetraRuntime/netra-observe@356a77f1afa3c28e83329292c31b562fc44f8ef4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NetraRuntime
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@356a77f1afa3c28e83329292c31b562fc44f8ef4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file netra_observe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netra_observe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f8839775e09a1a8e07152ef08eeeff5778c879c58ed322e98718e982c32360f
|
|
| MD5 |
a9a384f628c2841c10aa09621f1b29bb
|
|
| BLAKE2b-256 |
45373ff934e244a1303296f8e97e201a0723203567b01a2714150c9a2f3c27ee
|
Provenance
The following attestation bundles were made for netra_observe-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on NetraRuntime/netra-observe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netra_observe-0.1.0-py3-none-any.whl -
Subject digest:
5f8839775e09a1a8e07152ef08eeeff5778c879c58ed322e98718e982c32360f - Sigstore transparency entry: 2099691708
- Sigstore integration time:
-
Permalink:
NetraRuntime/netra-observe@356a77f1afa3c28e83329292c31b562fc44f8ef4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NetraRuntime
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@356a77f1afa3c28e83329292c31b562fc44f8ef4 -
Trigger Event:
push
-
Statement type: