Metadata-Version: 2.4
Name: verdictlens
Version: 0.2.0
Summary: Open-source observability for AI agents — hierarchical tracing, auto-instrumentation, blame analysis.
Project-URL: Homepage, https://github.com/Koushik-1729/verdictlens
Project-URL: Documentation, https://github.com/Koushik-1729/verdictlens#readme
Project-URL: Repository, https://github.com/Koushik-1729/verdictlens
Project-URL: Bug Tracker, https://github.com/Koushik-1729/verdictlens/issues
Author-email: Yeruva Koushik Reddy <koushik.yeruva02@gmail.com>
License: Apache-2.0
Keywords: agents,ai,debugging,langchain,llm,observability,openai,tracing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Debuggers
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.5.0
Provides-Extra: all
Requires-Dist: crewai>=0.30.0; extra == 'all'
Requires-Dist: langchain-core>=0.2.0; extra == 'all'
Requires-Dist: llama-index-core>=0.10.0; extra == 'all'
Requires-Dist: openai>=1.0.0; extra == 'all'
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20.0; extra == 'all'
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'all'
Requires-Dist: pyautogen>=0.2.0; extra == 'all'
Provides-Extra: autogen
Requires-Dist: pyautogen>=0.2.0; extra == 'autogen'
Provides-Extra: crewai
Requires-Dist: crewai>=0.30.0; extra == 'crewai'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2.0; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.10.0; extra == 'llamaindex'
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == 'openai'
Provides-Extra: otel
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20.0; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otel'
Description-Content-Type: text/markdown

# 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

```bash
pip install verdictlens
```

## Quickstart

```python
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
