Prepare the example
You need Node.js 24, Bun 1.3.9, and access to the SDK examples. The example source is in the private SDK repository. The public quickstart is available without repository access. From the cloned repository:Configure your own project
Sign in to Hue, select your project, and create a service key in Settings → Integrations & API keys. Keep this step in your own account. Configure the server through your secret manager or an ignored.env file; do not paste keys into an agent prompt.
In the example directory, create .env and keep it out of Git:
true to store this synthetic conversation’s content, or false to send metadata only. Start the server:
Verify a conversation
Send a short text-analysis request, then use the controlled-error action. Keep the same session for both turns. In your Hue project, open Traces and match the trace IDs shown by the chatbot. Check:- The root, model and tool spans describe the request and its execution order.
- Related turns share the session identifier.
- Content appears when capture is enabled and is unavailable when capture is disabled.
- The controlled error appears as an execution error.
- Export failures are reported separately from model or tool failures.
HUE_CAPTURE_CONTENT=false and repeat. A printed trace ID alone does not prove delivery. The reference app reports telemetry acceptance after both traces and logs are acknowledged; inspecting stored records verifies the connection.
Synthetic mode uses the AI SDK’s actual streaming and tool execution machinery with deterministic provider responses. It does not assess a live model’s quality, and it leaves unknown token usage absent.
Use a live model
When you want to test your own provider access, setHUE_CHAT_MODE=live, AI_GATEWAY_API_KEY, and HUE_CHAT_MODEL to an available provider/model identifier. The example uses the Vercel AI Gateway and your normal model charges apply. A provider failure is surfaced as an error; there is no synthetic fallback.
The example runs locally and binds to loopback. Its README describes the request limits and lifecycle. Use your application’s authentication and operational controls before adapting it into a hosted service.
Add tracing to an existing chatbot
Inspect how your app initializes telemetry before adding a provider. For an application that already exports to another destination:- Add Hue’s span and log processors to the existing OpenTelemetry provider construction.
- Preserve the existing global AI SDK integration. A per-call integration can replace it for that call.
- Keep request spans open until the response stream and tools finish.
- Await flush in the framework’s supported after-response lifecycle; keep the shared provider alive between requests.
- Exclude binary document bodies and unnecessary private content from custom attributes.