Skip to main content

Open-source observability for AI agents — hierarchical tracing, auto-instrumentation, blame analysis.

Project description

verdictlens (Python SDK)

Python client for VerdictLens — hierarchical tracing for AI agent workloads with auto-instrumentation.

See the repository root for the full platform quickstart.

Install

pip install verdictlens

Quickstart

from verdictlens import configure, trace, wrap_openai
from openai import OpenAI

configure(base_url="http://localhost:8000")
client = wrap_openai(OpenAI())

@trace(name="my_pipeline", span_type="chain")
def my_pipeline(query: str) -> str:
    context = retrieve(query)
    return generate(context, query)

@trace(name="retrieve", span_type="retrieval")
def retrieve(query: str) -> list:
    return vector_db.search(query)

@trace(name="generate", span_type="agent")
def generate(context: list, query: str) -> str:
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": f"{context}\n{query}"}]
    )
    return response.choices[0].message.content

This produces a hierarchical span tree:

my_pipeline (chain)
├── retrieve (retrieval)
└── generate (agent)
    └── openai.chat.completions.create(gpt-4o-mini) (llm)  ← auto-traced

Key Features

  • Nested @trace — child spans auto-attach to parent via contextvars
  • wrap_openai(client) — auto-trace OpenAI chat completions with zero code
  • wrap_anthropic(client) — auto-trace Anthropic messages with zero code
  • wrap_google(client) — auto-trace Google Gemini generate_content with zero code
  • asyncio.gather safe — parallel branches maintain correct parent context
  • Non-blocking — async transport with disk-backed offline queue

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

verdictlens-0.2.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

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

verdictlens-0.2.0-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file verdictlens-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for verdictlens-0.2.0.tar.gz
Algorithm Hash digest
SHA256 630bc0d88d93284e18ff0896ce0564824b46ea9edd00861555fa681eb96c67a6
MD5 04c2c66908c75580f44b49acdafea246
BLAKE2b-256 f71968afee33d8fd9f19749efb43e45fba4062151bacfb7b27645d60ce7253e1

See more details on using hashes here.

File details

Details for the file verdictlens-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for verdictlens-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35b0d25b0e60fcfb50e0b23839801e34c573b0030a47f63de7cf4280a7c869ea
MD5 37121e2e8eacf0d6b79fb5702422b36a
BLAKE2b-256 6e34390d9f268f88f157206362a077ad161fc7c6eaf39cf0b5ba1e8de6dcf8a7

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