valite
Docs navigation

Docs/Core Concepts/Workflows & Runs

Workflows & Runs

Attribute every call to a workflow and a run — via headers, the base URL, or the tracing you already have.

Three attribution channels

valite reads workflow and run identity from three places, strongest first: explicit headers, path segments in the URL, and W3C trace context. All valite-specific markers are stripped before the request is forwarded — the provider never sees them. Each logged call records which channel identified it (run_source = header, path, or traceparent).

Workflow names and run IDs must match [A-Za-z0-9._-] and be at most 128 characters.

1 · Headers (strongest)

Request headers

x-valite-workflowheader

Names the workflow this call belongs to. Overrides any path segment.

x-valite-run-idheader

Groups calls into a single run. Calls sharing a run ID are measured together as one execution.

Python
client.chat.completions.create(
    model="gpt-4o",
    messages=[...],
    extra_headers={
        "x-valite-workflow": "support-triage",
        "x-valite-run-id": ticket_id,
    },
)

2 · URL path segments

The workflow (and optionally the run) can ride the base URL itself, which means zero per-request code — ideal when one service maps to one workflow:

shell
# workflow only
export OPENAI_BASE_URL=https://gateway.valite.ai/openai/wf/support-triage/v1

# workflow + run
export OPENAI_BASE_URL=https://gateway.valite.ai/openai/wf/support-triage/run/$JOB_ID/v1

The wf/<name> and run/<id> segments are recorded and stripped before forwarding.

3 · traceparent (automatic)

If your stack already propagates W3C trace context, valite uses the 32-hex trace ID as the run ID automatically whenever no explicit run ID is given. The traceparent header itself is forwarded untouched, so your existing distributed tracing keeps working.

Tip

This is the easiest path for instrumented systems: tag the workflow once in the base URL, and run grouping comes free from your tracer.

How runs close

A run is considered complete after a quiet period with no further calls (2 minutes by default). Complete runs are what the pipeline counts: the bar job requires a minimum number of complete baseline runs (5 by default) before it will freeze a quality bar, and per-run cost in profile is computed over them. Untagged calls are tracked and surfaced in the dashboard so you can see what still needs attribution.