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.2.tar.gz (19.4 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.2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qprompt_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 19.4 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.2.tar.gz
Algorithm Hash digest
SHA256 d9efcf9f074bf792dde3176337ee33dce685128f5ed1e3866c36024f38977737
MD5 4a59f6ac206111f20fbf2adabdb345b9
BLAKE2b-256 d336ae5ce05f59ad06993bddb0ecc15113e078229d76bf605c476390f90e3d50

See more details on using hashes here.

Provenance

The following attestation bundles were made for qprompt_cli-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: qprompt_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8ecfbed57d58878e3004f09605ff7919d33b3d2b08a49d8525fa2519a532e55
MD5 ef62c9c377420ea637b7e584053f8e33
BLAKE2b-256 ef528295f91925190c622e5b881a5d3e22cb620e71f6b5d4f9a494d6e6ce3191

See more details on using hashes here.

Provenance

The following attestation bundles were made for qprompt_cli-0.1.2-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