Overview
RDK provides several mechanisms for testing LLM applications:test_mode=True— disables HTTP transport and mocks tool callsenabled=False— disables tracing entirelycapture_traces()— captures spans in memory for assertionsmock_tools()— intercept specific tool calls with controlled responses
test_mode
test_mode=True does two things:
- Sets
transport="null"— no HTTP calls are made - All tool calls return
"MOCKED"by default
RDK_TEST_MODE=1 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:mock_tools()
Override specific tool responses within a test:Callable mock
Error simulation
capture_traces()
Assert on the spans that were created during a function call:Check token usage
InMemoryTransport
For lower-level assertions, useInMemoryTransport directly:
Environment variable approach
SetRDK_TEST_MODE=1 in your test environment to enable test mode without changing code:
See Also
- mock_tools() — Full API reference
- init() —
test_modeandenabledparameters

