Skip to main content

Flight recorder for LLM apps

Project description

qprompt-cli

Internal trace utility for LLM workflows.
Goal: make answers inspectable with structured records of parsing, tool execution, evidence, and risks.

Why we use this internally

  • Identify why a model answer is wrong without re-running blind.
  • Detect when an answer claims tool usage that did not actually happen.
  • Preserve a portable artifact for incident review and QA.
  • Standardize trace shape across model/tool backends.

What is captured

  • Request metadata: trace_id, timestamp, model, question
  • Parse stage: intent, entities, assumptions, missing_context, suggested_tools
  • Request envelope: model messages and available tools
  • Tool execution: name, redacted input, output summary, status, error
  • Evidence records: claim/source/evidence id
  • Model response metrics: latency, token usage estimates (or provider usage when available)
  • Audit output: claims, unsupported claims, risk flags

Explicit limitations

  • No hidden chain-of-thought extraction.
  • No neuron/attention internals for hosted closed models.
  • Token usage depends on provider payload; may be estimate-only.

Install

python -m pip install -e .

Import:

from qprompt import Tracer

CLI

qprompt run "why did revenue drop in March?"           # real path: stub LLM, no synthetic tools
qprompt run "why did revenue drop in March?" --demo    # synthetic SQL + evidence (marked is_demo=true)
qprompt list
qprompt show <trace_id_or_path>
qprompt diff <trace_a> <trace_b>

The --demo flag is opt-in; the default never injects fake tool calls or evidence. Demo traces carry is_demo: true and are flagged on stdout/stderr so they can never be silently mistaken for real data.

Default storage:

.traces/YYYY-MM-DD/trace_<uuid>.json

Data contract

  • JSON schema: src/llmtrace/trace_schema.json
  • Runtime builder/validator: src/llmtrace/schema.py

Operational behavior

  • Trace write occurs only after schema validation.
  • Failed tool calls are recorded as step errors and surfaced as risks.
  • Multi-month phrasing (e.g. "April vs March") is preserved in parsed period.

Integration notes

  • Tracer.run(...) currently includes a mock model path for local validation.
  • For production usage, replace the callable used by Tracer.chat(...) with provider-specific calls and pass back usage fields when available.
  • For SQL/tool-backed workflows, run tools in code and pass outputs into the traced context; prompt text alone does not execute tools.

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

qprompt_cli-0.1.5.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

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

qprompt_cli-0.1.5-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file qprompt_cli-0.1.5.tar.gz.

File metadata

  • Download URL: qprompt_cli-0.1.5.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qprompt_cli-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1272212e2acf284e62a1dc73bce8f6d259e574877892a1dd6ed1f64ee345c476
MD5 283ce805ed49b357635d57eb3e69fc0a
BLAKE2b-256 55262108bcea76c2ad78a045c79a808f2018dfb22330b9c78fedc7f1d92923a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for qprompt_cli-0.1.5.tar.gz:

Publisher: release.yml on kraftaa/llm-explain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qprompt_cli-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: qprompt_cli-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qprompt_cli-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b3efaf9a82d3b89467801356d2b86a4455006eab4eb480db4976a827b74ef5
MD5 d16a5b59addabbc6a1fac79021478266
BLAKE2b-256 71855319f52dc63d125759887224dee6687749e46165ca9e373f529c2e770bf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for qprompt_cli-0.1.5-py3-none-any.whl:

Publisher: release.yml on kraftaa/llm-explain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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