Skip to main content

Overview

RDK provides several mechanisms for testing LLM applications:
  • mode="test" — disables HTTP transport (null transport)
  • enabled=False — disables tracing entirely
  • capture_traces() — captures spans in memory for assertions

Test mode

mode="test" sets transport="null" — no HTTP calls are made.
Also reads from RDK_MODE=test environment variable.

enabled=False

When you don’t want any tracing at all:

pytest fixture

A standard fixture that initializes RDK in test mode and tears down after each test:

capture_traces()

Assert on the spans that were created during a function call:

Check token usage

InMemoryTransport

For lower-level assertions, use InMemoryTransport directly:

Environment variable approach

Set RDK_MODE=test in your test environment to enable test mode without changing code:
Or in a shell:

See Also

  • init()mode and enabled parameters