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.3.tar.gz (23.5 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.3-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qprompt_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 23.5 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.3.tar.gz
Algorithm Hash digest
SHA256 0638998ba7af851c074c019aec591aef742f834ed0a14f5114adea61134d3c3a
MD5 fb6c7571a6f18f3d5adffc051281f5a9
BLAKE2b-256 23736cd8466ae9687e8ee5f920758278deee6d4b12ff9b6d4228a5f96cea6308

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: qprompt_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 17.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0ec17b4e68002bf61243e19d26cabd9871ed7b772ea01d737fd4deef6a18808
MD5 77f8f4f987c6d52643923d31dbf3ecdc
BLAKE2b-256 9d4215d3154e781a411560227f70be1051598d80dcad83d2a698c8d8f3966110

See more details on using hashes here.

Provenance

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