Skip to content

Repository files navigation

WildEdge


CI Python Versions Tested on Linux Tested on macOS Tested on Windows PyPI Coverage

Monitor local and remote ML inference from Python. Track latency, token usage, errors, model metadata, and local hardware context across llama.cpp, MLX, Transformers, OpenAI, and more.

Instrument supported libraries with one command, or add tracking in your code. Prompts and outputs aren't uploaded unless you explicitly attach them.

Get started · Explore the demo · Docs · Website

Model performance Workflow trace SQL editor
Model health, latency, time to first token, and throughput Named workflow step and inference timing in a trace waterfall SQL query with stacked hourly inference volumes across local and cloud models

Illustrative sample data across WildEdge SDKs. Click a thumbnail for the full-size image, or explore the read-only demo.

More screenshots: events and hardware
Events Hardware
Inference and error events with model and device metadata Thermal state, accelerator usage, and CPU throttling

Install

uv add wildedge-sdk

To send events, sign up at app.wildedge.dev, create a project and copy its DSN. Without a DSN everything is a silent no-op, so dev and CI need no configuration.

CLI

Monitor an existing application by adding wildedge run to its start command:

WILDEDGE_DSN="https://<secret>@ingest.wildedge.dev/<key>" \
uv run wildedge run --integrations llama_cpp -- python app.py

This assumes your application already uses llama-cpp-python. The llama_cpp integration instruments that library; replace it with your integration. No SDK calls are required in your application code.

See the deployment guide for startup options, environment validation, and production configuration.

SDK

To try tracking in your code, run one local text-generation model on CPU. Install the model's dependencies:

uv add transformers torch

Save this as app.py. The first run downloads the model from Hugging Face; no model-provider API key is needed.

import wildedge
from transformers import pipeline

client = wildedge.init(integrations=["transformers"])
try:
    model = pipeline(
        "text-generation",
        model="HuggingFaceTB/SmolLM2-360M-Instruct",
        device=-1,  # CPU
    )
    result = model(
        "Explain how rain forms in one sentence.",
        max_new_tokens=32,
        do_sample=False,
        return_full_text=False,
    )
    print(result[0]["generated_text"])
finally:
    client.close(timeout=10)

Set the DSN from your WildEdge project and run it:

export WILDEDGE_DSN="https://<secret>@ingest.wildedge.dev/<key>"
uv run python app.py

Open your project at app.wildedge.dev to inspect the model load and inference events, including duration and model metadata. The generated text is printed locally; it isn't uploaded.

Already have an application? Initialize WildEdge before creating your model or API client. See examples for each integration, traces and spans, and the deployment guide for lifecycle details.

Trace a workflow across local and remote models

Combine integrations and group inference calls into traces and spans. This example also requires uv add openai and an OPENAI_API_KEY, alongside the Transformers dependencies and WildEdge DSN above.

import wildedge
from openai import OpenAI
from transformers import pipeline

client = wildedge.init(integrations=["transformers", "openai"])
try:
    local = pipeline(
        "text-generation",
        model="HuggingFaceTB/SmolLM2-360M-Instruct",
        device=-1,
    )
    remote = OpenAI()
    prompt = "Explain how rain forms in one sentence."

    with wildedge.trace(run_id="run-1"):
        with wildedge.span(kind="agent_step", name="draft"):
            draft = local(
                prompt, max_new_tokens=32, return_full_text=False
            )[0]["generated_text"]
        with wildedge.span(kind="agent_step", name="refine"):
            response = remote.chat.completions.create(
                model="gpt-4o-mini",
                messages=[{"role": "user", "content": draft}],
            )
            print(response.choices[0].message.content)
finally:
    client.close(timeout=10)

Both inference calls belong to one trace, with separate draft and refine spans. See manual tracking for additional span types and context.

Supported integrations

Local inference: llama.cpp, Transformers, MLX-LM, ONNX Runtime, PyTorch, TensorFlow, Keras, Ultralytics, timm, faster-whisper, and MLX Whisper.

API clients: OpenAI, Anthropic, and OpenAI-compatible providers.

Most integrations track supported entry points automatically after activation. PyTorch and standalone Keras models require explicit registration.

Integration keys, setup, and examples

Enable the integration before creating models or API clients, using --integrations or wildedge.init(integrations=[...]). Automatic tracking covers the entry points listed below. PyTorch and standalone Keras models need explicit registration through client.load(...) or client.register_model(...).

Local models

Library Integration key How tracking starts Example
Transformers transformers Automatically through pipeline / from_pretrained Example
llama.cpp (llama-cpp-python) llama_cpp Automatically when constructing Llama Example
MLX-LM mlx Automatically through mlx_lm.load Example
faster-whisper / MLX Whisper faster_whisper / mlx_whisper Automatically through supported model loaders Example
ONNX Runtime onnx Automatically when constructing InferenceSession Example
timm timm Automatically through create_model Example
Ultralytics ultralytics Automatically when constructing YOLO —
TensorFlow tensorflow Automatically through keras.models.load_model / saved_model.load; register models created in code Example
PyTorch torch Register the model explicitly Example
Keras keras Register the model explicitly Example

API clients

Library Integration key How tracking starts Example
Anthropic anthropic Automatically for clients created after initialization Example
OpenAI openai Automatically for clients created after initialization Example
API coverage and compatible providers

Fireworks, Together, Baseten, xAI, Mistral, Groq and other OpenAI-compatible hosts work through the openai integration — pass their base_url. See Providers for every recognized endpoint.

See API tracking for endpoint coverage, streaming, embeddings, and tracking calls made without the official client libraries.

Model download tracking

Hub tracking

Pass hubs= to track model download provenance. Hubs are framework-agnostic and can be combined with any integration.

Hub Tracks
huggingface Downloads via huggingface_hub
torchhub Downloads via torch.hub

For unsupported frameworks, see Manual tracking.

Configuration

Parameter Default Description
dsn - https://<secret>@ingest.wildedge.dev/<key> (or WILDEDGE_DSN). If unset, the client is a no-op.
app_version None Your app's version string
app_identity <project_key> Namespace for offline persistence. Set per-app in multi-process workloads (or WILDEDGE_APP_IDENTITY)
enable_offline_persistence true Persist unsent events to disk and replay on restart
sampling_interval_s 30.0 Seconds between background hardware snapshots. Set to 0 or None to disable (or WILDEDGE_SAMPLING_INTERVAL_S)
attachments_enabled false Opt-in upload of raw inference inputs/outputs (or WILDEDGE_ATTACHMENTS_ENABLED). See Attachments

For advanced options (batching, queue tuning, dead-letter storage, attachments), see Configuration.

Security & Privacy

Automatic integrations send inference metrics, model metadata, and device/hardware information, including a device identifier, OS information, locale, and timezone. They do not attach raw inputs or outputs. Raw payload uploads require explicitly supplied attachments and attachments_enabled=True.

Report security and privacy issues to: support@wildedge.dev

Links