Skip to main content

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 agent reads your repository and shows you its plan. It asks you to create a Read and write API key in Hue and store it yourself, so the key never goes into the chat. It then installs the Hue skill and SDK, traces your real request path, confirms that a real request arrived with its content, and connects the Hue MCP server so it can read your traces. A Hue account is required. To set up by hand, follow the steps below. They send a real trace from a local text transformation, with no model provider or model credits.
The example is a strict setup diagnostic: it fails if Hue is unavailable. For serving applications, use TypeScript production setup or Python production setup.
You need a Hue project and Node.js 22 or 24 or Python 3.10+. To send to a local OpenTelemetry Collector instead, follow Send through a Collector.

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 as HUE_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 run npm init -y && npm pkg set type=module first so that import statements work in .js and .ts files.
The package is ESM; CommonJS applications on Node.js 22.12 or later load it with 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:
For a new pip example, create and activate a virtual environment first with 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 with npm 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. Replace user-123 below with your application’s stable user ID so Hue can build their World across traces.
Create first-trace.mjs:
Run node first-trace.mjs.
The program checks the key before sending data, prints 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-trace and a tool child named execute_tool uppercase.
  • Session hue-quickstart and the recorded timing.
  • Input Hello Hue and output HELLO HUE. With HUE_CAPTURE_CONTENT=false, the trace shows no input or output.
Export acknowledgement confirms receiver acceptance. Inspecting the stored trace verifies the complete setup.

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 uses Authorization: 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

Call hue.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 to https://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

If the trace does not appear, follow troubleshooting.