Skip to main content

Proviras tracing SDK for LangGraph and LangChain agents

Project description

proviras-sdk (Python)

Trace LangGraph and LangChain runs to Proviras.

ProvirasTracer is a langchain_core.tracers.base.BaseTracer you pass as a callback. It creates one Proviras session per graph invocation and streams each LLM, tool, chain, and retriever run to your dashboard as a TraceCall.

Install

pip install proviras-sdk

langchain-core>=0.3.0 is pulled in automatically. Your project already has it if you use LangGraph or LangChain.

Setup

export PROVIRAS_PARENT_ID=<your-proviras-user-id>
export PROVIRAS_PLATFORM=langgraph
variable required description
PROVIRAS_PARENT_ID yes your Proviras user ID
PROVIRAS_PLATFORM yes runtime platform (e.g. langgraph, langchain)
PROVIRAS_USER_ID no parent agent ID when this agent is spawned by another

Usage with LangGraph

from proviras_sdk import ProvirasSdk
from langgraph.graph import StateGraph

sdk = ProvirasSdk()
graph = ...  # build your StateGraph

tracer = sdk.trace("Answer user question")

result = graph.invoke(
    {"messages": [{"role": "user", "content": "..."}]},
    config={"callbacks": [tracer]},
)
# session is finalized automatically when the root run ends

sdk.trace(task_description) returns a ProvirasTracer. It:

  1. Registers your agent on first run (saves agentId to ~/.proviras/config.json).
  2. Creates a session: POST /api/agent/session.
  3. On each completed LangChain run, posts a trace: POST /api/agent/session/{id}/trace.
  4. When the root run ends, finalizes the session: PATCH /api/agent/session.

Telemetry failures are swallowed — they never break the graph.

What gets captured

For each LangChain Run that completes (run_type of llm, tool, chain, or retriever):

field source
runType run.run_type
stepId run.id
parentTraceId server-issued traceId of the parent run
timestamp run.start_time
latencyMs run.end_time - run.start_time
model run.extra.metadata.ls_model_name
input / output JSON-encoded run.inputs / run.outputs, truncated at 8 KB
tokens run.outputs.llm_output.token_usage (LLM runs only)
error run.error

Posting happens once at root-run completion, in tree preorder, so a child's parentTraceId is always set correctly before the child is posted.

Per-invocation surface

sdk.trace("nightly summary", surface="code")

surface is one of "cowork" | "chat" | "code" | "api" and defaults to "api".

Async LangGraph

LangChain dispatches sync callback handlers on a worker thread when called from async contexts, so ProvirasTracer works with graph.ainvoke() and graph.astream() without changes. Each HTTP call blocks one worker thread for the duration of the request.

Project details


Download files

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

Source Distribution

proviras_sdk-2.1.4.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

proviras_sdk-2.1.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file proviras_sdk-2.1.4.tar.gz.

File metadata

  • Download URL: proviras_sdk-2.1.4.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for proviras_sdk-2.1.4.tar.gz
Algorithm Hash digest
SHA256 a9e9cae2d807e014a9f4af680d4a91190e4bb5c31888c630976fbea24b842c3b
MD5 8b7f5c72a65966e9872df52e06a8c0e2
BLAKE2b-256 10cccb45f76fc325de5822ac0f23c4c508ac8d467514754c02db7c0954c49681

See more details on using hashes here.

File details

Details for the file proviras_sdk-2.1.4-py3-none-any.whl.

File metadata

  • Download URL: proviras_sdk-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for proviras_sdk-2.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cd7a4814eaa2c806cd389ee9a5c5112dad2c05f4a3a5b44ae450ead4dd9be731
MD5 a828a3aa60296b256db4edfeb3727834
BLAKE2b-256 bc358f1850e9392c0ec859c606ee8c20ce5fae90403c3b3852c10cf3f1fd71d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page