Skip to main content

Deterministic lexical execution analysis for multi-step LLM workflows.

Project description

X-Ray

X-Ray is a deterministic execution-analysis engine for multi-step LLM workflows.

X-Ray analyzes ordered output traces to decide whether a run forms one evolving execution trajectory, where structural contribution peaks, and how much token volume appears after that peak.

X-Ray is infrastructure, not an LLM judge.

Status: Beta (v0.1.0)

Why X-Ray Exists

Multi-step LLM systems often continue executing after meaningful contribution has already peaked.

Additional execution may:

  • repeat earlier work
  • increase token cost without adding signal
  • drift across tasks
  • create apparent progress without meaningful structural change

X-Ray analyzes the execution trajectory itself.

Install

Package install command:

pip install veloryn-xray

Editable local install:

pip install -e .

SDK

from veloryn.xray import analyze_structured, analyze_raw

Structured SDK Example

from veloryn.xray import analyze_structured

result = analyze_structured(
    {
        "steps": [
            {"output": "sort descending"},
            {"output": "use reverse=True"},
        ]
    }
)

print(result.to_dict())

Current runtime shape:

{
    "is_valid": True,
    "verdict": {
        "peak_step": 2,
        "should_stop_at": 2,
        "waste_percentage": 0,
    },
    "summary": {"reason": "Most value was captured early."},
    "meta": {"version": "0.1.0"},
    "timeline": [
        {"step": 1, "label": "improving"},
        {"step": 2, "label": "peak"},
    ],
    "analysis": {
        "signals": {
            "redundancy_trend": "stable",
            "contribution_trend": "stable",
        }
    }
}

X-Ray is:

  • deterministic
  • lexical
  • bounded
  • typed at the SDK boundary

X-Ray is not:

  • a semantic understanding system
  • an embeddings-based analyzer
  • a correctness evaluator
  • a workflow control system

Raw SDK Example

from veloryn.xray import analyze_raw

result = analyze_raw("sort descending\nuse reverse=True")
print(result.to_dict())

Raw mode parses newline-separated steps or JSON payloads and returns the same typed SDK result shape.

Fail-Safe SDK Example

from veloryn.xray import analyze_structured

result = analyze_structured(
    {
        "steps": [
            {"output": "capital of france"},
            {"output": "capital of germany"},
        ]
    }
)

print(result.to_dict())

Canonical fail-safe SDK output:

{
    "is_valid": False,
    "verdict": {"message": "No clear execution pattern detected."},
    "summary": {"reason": "This does not appear to be a single evolving task."},
    "meta": {"version": "0.1.0"},
}

Fail-safe omits:

  • timeline
  • analysis
  • internal signals

CLI

xray trace.json
xray trace.json --analysis
xray trace.json --debug

## Serialization Example

```python
import json

from veloryn.xray import analyze_structured

result = analyze_structured(
    {
        "steps": [
            {"output": "a"},
            {"output": "a"},
        ]
    }
)

payload = result.to_dict()
print(json.dumps(payload))

Input Shape

Structured SDK input must be:

{
    "steps": [
        {"output": "step 1 text"},
        {"output": "step 2 text"},
    ]
}

Rules:

  • top-level must be a dict
  • steps must exist
  • steps must be a list
  • each step must contain string output

Invalid schema raises ValueError.

Execution invalidity returns fail-safe.

Determinism

X-Ray uses no randomness, no embeddings, no semantic model, and no LLM calls.

For the same input and same algorithm versions, output is stable.

Peak selection uses a stabilized selector trajectory rather than raw normalized contributions directly. CLI and UI plots are aligned to the final selected peak.

Validation

Run Python tests:

python -m unittest discover -s tests

Build UI:

npm run build

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

veloryn_xray-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

veloryn_xray-0.1.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file veloryn_xray-0.1.0.tar.gz.

File metadata

  • Download URL: veloryn_xray-0.1.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for veloryn_xray-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d559059da78b76efa95b45dcc64b68bb8554d3963065dddf6b87a7bbe5fbac7c
MD5 0567431bae51ad3ea2f1799163a328e4
BLAKE2b-256 b3d9c25c4d10481215fcfd11fed46376f363baef8dbba64ddc5fd4308e1c5f09

See more details on using hashes here.

File details

Details for the file veloryn_xray-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: veloryn_xray-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for veloryn_xray-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36d6fc9f440d9318af07e672b8af74e53fbfd5dff5b71fd83fa96b235c002353
MD5 ec09c0c3705a070e2eca7c3a8cb1b2ea
BLAKE2b-256 d5050094bebf020c1241784786279353c19e658b8a6cf9948a7e6a17d23e9a13

See more details on using hashes here.

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