Most users run XReduce through the CLI - xreduce evaluate and xreduce profile cover the workflow end-to-end. The Python API is for when you need to embed XReduce inside your own code: a training loop, a custom inference harness, or a CI pipeline that needs more control than the CLI gives you.
The CLI loads a model, runs inference, and sends telemetry. The Python API exposes the same three steps so you can call them directly:
from xreduce import ModelRunner
runner = ModelRunner("config.yaml")
# Load your model however you want - XReduce doesn't care
# as long as it's ready to call.
model = load_your_model()
tokenizer = load_your_tokenizer()
# Run inference with telemetry captured automatically.
result = runner.run(
model,
"Your input text here",
tokenizer,
)
print(runner.get_last_run_id())The ModelRunner reads your config.yaml, wraps the call with telemetry capture, and sends results to your XReduce account. You get a run ID back that you can look up in the dashboard.
xreduce evaluate as a subprocess is the wrong shape. Call the API directly.The API has more surface area than the single call above - lower-level profiler controls, batch inference, custom telemetry attachment - but those interfaces are still stabilizing. We haven't published them as a public contract because we don't want to make commitments we'd have to break in the next few releases.
If you need to integrate XReduce deeply into your stack and the basic pattern above doesn't fit, - we'll walk you through the interfaces that exist today and flag which ones are safe to build against.