Set up with your coding agent
If you received a trial invitation from Hue, open Worlds and choose Create world instead of the tracing setup below. Copy the prompt from Create world with your agent into your coding agent. See Trial organizations. Open Claude Code, Codex, Cursor or another coding agent in your application’s repository and send:Prompt
The example is a strict setup diagnostic: it fails if Hue is unavailable. For serving applications, use TypeScript production setup or Python production setup.
1. Create a project key
In Hue, select your project and open Settings → API keys to create a Read and write service key. Store it asHUE_API_KEY in your server environment or secret manager. Project keys explains the access levels and rotation.
2. Install the SDK
TypeScript
Requires Node.js 22 or 24 (Node.js 26 also runs in CI) or Bun 1.4. Run the command in your application’s directory. For a new example, create a directory and runnpm init -y && npm pkg set type=module first so that import statements work in .js and .ts files.
- npm
- Bun
require("@hue-run/sdk"). Check compatibility before adding it to an existing application.
Python
Requires Python 3.10 or later; tested on 3.10 and 3.14. Install into your project’s existing environment:- pip
- uv
python3 -m venv .venv and source .venv/bin/activate. For a new uv project, run uv init before uv add; run the examples with uv run python or activate its .venv.
Verify your installation
The documented releases are TypeScript 0.27.0 on npm and Python 0.15.0 on PyPI. Check the installed version withnpm ls @hue-run/sdk or python -m pip show hue-run; in a uv project, use uv tree.
3. Configure your environment
In the same terminal, set:HUE_CAPTURE_CONTENT=true records prompts, responses, and tool inputs and outputs alongside timing and errors; set it to false for metadata-only traces. See content capture.
4. Record a request
Identify the user on every request. Replaceuser-123 below with your application’s stable user ID so Hue can build their World across traces.
- TypeScript / JavaScript
- Python
Create Run
first-trace.mjs:node first-trace.mjs.HELLO HUE and a trace ID after a successful flush, then shuts down the SDK. A rejected export causes the program to fail.
5. Inspect the trace
In the same Hue project, open Traces and match the printed trace ID. You should see:- A root span named
first-traceand a tool child namedexecute_tool uppercase. - Session
hue-quickstartand the recorded timing. - Input
Hello Hueand outputHELLO HUE. WithHUE_CAPTURE_CONTENT=false, the trace shows no input or output.
Project keys
Use a project service key for SDK requests and OpenTelemetry exports. Pass it to the SDK constructor. Hue constructors do not automatically load environment files. For direct HTTP requests, authentication usesAuthorization: Bearer <project-service-key>. The key determines the destination project. Resource attributes, observed user IDs and session IDs cannot select a different project.
Access levels
A key either reads the project or reads and writes it. New keys default to Read and write. Your organization’s access also limits each key. Trial organizations have Worlds access; a Read and write key does not unlock tracing or evaluations.
Use Read and write for application telemetry and processes that change project data. Use separate keys for development and production so you can revoke either independently. On a development machine, one Read and write key can serve as both the application’s
HUE_API_KEY and the MCP client’s HUE_MCP_KEY; hue login stores it under both names. Create separate keys when you want to revoke either use alone. The MCP access levels list the tools each preset reaches.
Owner- and admin-only MCP tools act as the member who created the key, who must still be a verified owner or admin; a sign-in connection uses the role of the member who approved it. Owners and admins create and revoke keys; any member can instead sign in with Hue to connect an MCP client. Treat every key as a server credential and keep it out of browser bundles, logs, source control and shared prompts. Use the in-product trial prompt only with a coding agent you trust.
Legacy presets
Keys created with earlier presets keep their access. Tracing only keys appear as Tracing only (legacy); they can send telemetry, check the project connection, and verify known-trace receipts, but cannot browse project data or use evaluation APIs. Coding agent (read-only) and Coding agent (read + evaluations) keys now appear as Read and Read and write. Tracing and evaluations and Source capture only keys appear as Tracing and evaluations (legacy) and Source capture (legacy); they keep working for their original APIs but cannot read project data through the MCP server, and new keys use Read and write instead. Creating a new restricted key does not narrow an older credential.Verify and rotate
Callhue.checkConnection() in TypeScript or hue.validate_project() in Python. These send a project lookup without a trace and return the project identity. Confirm it matches the project you intend to use before exporting data.
When replacing a key, configure the replacement in the server’s secret store, verify the connection, then revoke the old key in project settings. Never include either credential in a support report. A successful connection check validates project access; the first-trace check separately verifies instrumentation and delivery.
Connection settings
Both SDKs default tohttps://app.hue.run. Omit baseUrl in TypeScript and base_url in Python for Hue Cloud. You do not need to choose or discover a different endpoint for a normal Hue Cloud integration.
For local development or another configured Hue deployment, pass a different origin through baseUrl in TypeScript or base_url in Python. If your application uses HUE_BASE_URL, read it explicitly and pass it to the constructor. SDKs do not load environment files automatically.
Supply an origin without credentials, an API path, query parameters or a fragment. HTTPS is required except for loopback HTTP. SDKs append their own paths; a standard OTLP exporter instead needs the full signal endpoint.
Next steps
- Generate a World to test your agent against simulated app data without production traces.
- Structure your own requests with Traces and spans, using the TypeScript or Python SDK or your existing OpenTelemetry setup.
- Connect your coding agent to the Hue MCP server by signing in with Hue or with a Read or Read and write key.
- Turn a trace into a case and evaluate your agent: Create a case.