Harness Decision Matrix

Choose integration depth to match your wrapper and avoid duplicate telemetry.

Agent hint

Use when user has LangChain/LiteLLM middleware or custom retry wrapper — pick one instrumentation path.

In scope

  • patch vs wrap vs manual log
  • Double-count risk table
  • Example wrap and partial patterns

Out of scope

  • Full wrap API — see wrap() page
  • Provider list — see Supported Providers
Your harnessRecommendedDouble-count risk
None — raw SDK callsAuto-hook or patch_all()Low
Partial — custom retry/logging wrapperManual log_event at wrapper boundaryLow if patch disabled
Full — LangChain/LiteLLM + OTelwrap() with workflow_id; avoid patch + wrapMedium — use __aurex_patched__ guards

Full harness — wrap()

Python
auditor.patch_openai()  # guarded with __aurex_patched__

result = auditor.wrap(
    call_fn=openai.chat.completions.create,
    build_params=lambda: {"model": "gpt-4o", "messages": [...]},
    options={"workflow_id": "checkout_agent"},
)
Node.js
const response = await auditor.wrap(
  (params) => openai.chat.completions.create(params),
  () => ({ model: "gpt-4o", messages: [...] }),
  { workflowId: "checkout_agent" },
);

Partial harness — manual logging

Python
auditor.log_event(
    model=response.model,
    input_tokens=response.usage.prompt_tokens,
    output_tokens=response.usage.completion_tokens,
    workflow_id=workflow_id,
)
Node.js
auditor.logEvent({
  model: response.model,
  inputTokens: response.usage.prompt_tokens,
  outputTokens: response.usage.completion_tokens,
  workflowId,
});

Call get_health() for patch_status. In tests, call AurexAuditor.reset() before re-configuring.

See also