Quickstart
Install the package, initialize the agent, and make the first proxied model call.
Proxy Helpers
Review the key flow and patched-client behavior.
Runtime Events
Review the event methods before composing hybrid flows.
Hybrid tracing
Use hybrid mode when the proxy already captures the model exchange, but you still want application-side tool timing and output.Prompt caching-aware usage
cacheReadTokens for tokens served from cache and cacheCreationTokens for tokens written into cache when your runtime exposes those values.
Self-hosted overrides
Event IDs you should understand
| Field | When to set it |
|---|---|
spanId | Use the same value across toolCallRequest() and toolCallResponse() |
stepId | Set it only if your framework already has stable ordered steps |
parentStepId | Use it when you want explicit tree structure instead of backend inference |
idempotencyKey | Set it when retries or queue replay could submit the same event twice |
Common mistakes
- Calling
trace()methods without stabletraceIdvalues across the same workflow. - Mixing manual
llmResponse()events with proxied model responses for the same model turn when you only wanted one representation. - Forgetting to reuse
spanIdacross tool request and response events. - Overriding URLs request-by-request instead of setting
proxyBaseUrlandanalyseBaseUrlonce on theWhyOpsclient.