Skip to main content

AuditLM

PyPI Python License GitHub Stars

Open source evaluation toolkit for LLM pipelines and AI agents.

Hallucination detection · Faithfulness scoring · Cost tracking Latency logging · Regression testing · Agent trace viewer

Self-hostable · No SaaS · No login · No data leaving your machine

pip install auditlm
auditlm init
auditlm dashboard

Why AuditLM?

32% of AI teams cite quality as their #1 barrier to production. Most teams ship prompts blindly or debug with print statements.

AuditLM gives you a proper evaluation layer:

  • Hallucination detection — did the model make up something not in the source?
  • Faithfulness scoring — did the model contradict the retrieved context?
  • Cost tracking — how much does each query cost in USD and INR?
  • Latency logging — how slow is each step?
  • Regression testing — did my last prompt change make things better or worse?
  • Agent trace viewer — which tools did the agent call, in what order?

Quick Start

1. Install

pip install auditlm

2. Setup (one time)

auditlm init

Walks you through picking a provider (Gemini or OpenAI), pasting your API key, and choosing a judge model. Config saved locally at ~/.agentaudit/.env.

3. Add to your pipeline

Before:

def answer_question(query):
    docs = retriever.search(query)
    return llm.generate(query, docs)

After — 3 lines added:

from agentaudit import audit, set_context          # line 1

@audit(name="my_pipeline")                          # line 2
def answer_question(query):
    docs = retriever.search(query)
    set_context(docs)                                # line 3
    return llm.generate(query, docs)

Your code works exactly the same. AuditLM silently evaluates every run.

4. See results

auditlm dashboard

Opens a local dashboard at localhost:8501 with four pages: Overview · Run Details · Trends · Regression


Zero-code starter

auditlm example

Creates my_pipeline.py with clear TODO markers. Replace two lines, run it, done.


CLI

Command What it does
auditlm init First-time setup
auditlm dashboard Open Streamlit dashboard
auditlm compare --pipeline NAME Compare last two runs
auditlm config --show Show current config
auditlm config --reset Update API key or model
auditlm example Generate starter file

How it works

AuditLM uses LLM-as-judge — sends your pipeline's output and context to a judge model (Gemini Flash by default) and asks:

"Extract every claim. For each, is it supported by the context?"

The judge returns claims with verdicts (SUPPORTED / UNSUPPORTED / CONTRADICTED) and AuditLM calculates:

hallucination_score = unsupported claims / total claims

Everything saved to local SQLite. Nothing leaves your machine.


Exact cost tracking (optional)

By default, AuditLM estimates tokens from text length. For exact cost, add one line:

from agentaudit import set_tokens

set_tokens(
    input=response.usage.prompt_tokens,
    output=response.usage.completion_tokens,
)

Dashboard labels costs as estimated or exact.


Agent tracing

from agentaudit import AgentTracer

with AgentTracer("my_agent") as tracer:
    result = search_tool(query)
    tracer.log_tool_call("search", input=query, output=result)
    tracer.log_response(answer)

Supported judge models

Google Gemini (free tier available): gemini-flash-latest · gemini-3.5-flash · gemini-3-flash · gemini-3.1-pro

OpenAI: gpt-4o-mini · gpt-4o

Custom models: add_model_pricing("model", input_per_1k, output_per_1k)


Tech stack

Python · SQLite · Streamlit · LLM-as-judge · pyproject.toml


Contributing

PRs welcome. Open an issue for bugs or feature requests.

License

MIT

Metadata

Release files for auditlm 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auditlm 0.1.2
File Size Uploaded Provenance
auditlm-0.1.2.tar.gz 32.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for auditlm 0.1.2
File Interpreter ABI Platform
auditlm-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 69.1 kB

Release files / auditlm-0.1.2.tar.gz

Download URL auditlm-0.1.2.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
96bc60dd7f24f537ce713fb0fdb293ddee43b37578f2416df98142fe696ce2f2
BLAKE2b-256 checksum
How to use checksums
0546d59af24c1c8de3ef9e0aba804aac324fcabaee6e6caa5a369a3a9bbebd29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / auditlm-0.1.2-py3-none-any.whl

Download URL auditlm-0.1.2-py3-none-any.whl
Size 36.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a12d490fc27ac99d036d9444fb06a47ef57918f2048afd166de35122aa0507e2
BLAKE2b-256 checksum
How to use checksums
f284d3d1cbb0d27c7663bf2aa79d1aa841c4427e423426f7a2454cbd2411d7f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for auditlm 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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