Lightweight debugging SDK for multi-step AI pipelines.
Project description
X-Ray SDK (PyPI)
Install:
python3 -m pip install xray-sdk
Configure env (example):
export XRAY_API_URL=https://ai-agent-x-ray.onrender.com
export XRAY_API_KEY=your-xray-api-key
Or create a .env with those keys and the examples will load it via load_dotenv().
Basic use:
import os
from xray_sdk import XRayClient, XRayRun, XRayStep
client = XRayClient(
os.getenv("XRAY_API_URL", "https://ai-agent-x-ray.onrender.com"),
api_key=os.getenv("XRAY_API_KEY"),
)
run = XRayRun(
pipeline_name="my_pipeline",
description="Demo pipeline for keyword generation and search.",
metadata={"ctx": "demo"},
sample_size=20,
)
run.add_step(XRayStep(
name="stage1",
order=1,
description="Generate search keywords from the user query.",
inputs={
"query": "phone case",
"filters": {"min_rating": 4.0},
"llm_prompt": "Generate 5 search keywords for the product query.",
},
outputs={
"keywords": ["phone case", "iphone 15 case"],
"candidates_count": 3,
},
reasons={
"dropped_items": [
{"id": "B002", "reason": "too expensive"},
]
},
metrics={
"latency_ms": 120,
"elimination_rate": 0.33,
"model": "gpt-4o-mini",
"temperature": 0.2,
"prompt_tokens": 42,
},
))
result = client.send(run)
print(result)
Client methods:
send(run, analyze=True)→ POST/api/ingestspool(run, spool_dir=".xray_spool")→ save locally if API unavailableflush_spool(spool_dir=".xray_spool")→ replay newest spooled runlist_pipelines()→ GET/api/pipelineslist_runs(pipeline=None, status=None, limit=50)→ GET/api/runsget_run(run_id)→ GET/api/runs/<id>get_analysis(run_id)→ GET/api/runs/<id>/analysissearch_steps(step_name=None, pipeline=None, limit=50)→ GET/api/search/steps
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
xray_sdk-0.1.3.tar.gz
(8.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xray_sdk-0.1.3.tar.gz.
File metadata
- Download URL: xray_sdk-0.1.3.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbc3e02e0077b04ea138fba6d1961a48af166e559e1936dccbb9db3030be58cc
|
|
| MD5 |
7d1ec4cf3e3fa394cb5a210fa66f87c9
|
|
| BLAKE2b-256 |
068593fa0f8bd9db647603646291dbaa0832e6ddfa4b99721c13cabab63419fd
|
File details
Details for the file xray_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: xray_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cc9d89046ff41ca8b910208e002ca54175aff62660e01dbf6b83920c90fe6db
|
|
| MD5 |
91fd6f328e58bf01cd6004af6fcc0a86
|
|
| BLAKE2b-256 |
aab2a20e7d1c4c09196e9cb856929ae293ccd467b94d5f46f3535176e2cddd40
|