Skip to main content
In a Hue evaluation your agent runs in your process with its own model, prompts and tools. For a case with a World, hue eval gives each run a fresh instance: a Hue URL for each simulated app and a world token to use as the app’s credential. Hue never executes the agent, intercepts its traffic or adds tools; you commit one helper that hands the agent’s existing app clients those values during an evaluation and production values otherwise. An answer-only case gets its task without a World. The helper needs no Hue package, so it works in any language --command can start. See hue eval for commands.

How it works

Each app keeps its real API paths under a Hue base URL:
The agent calls that URL with the per-run world token instead of the real credential, and Hue answers in the app’s own format from the run’s instance. The tool list or API is the app’s own, so the agent sees the tools it has in production. Hue adds none: an eval-ready agent receives neither the deprecated context.tools / context.mcp, nor the Hue MCP server, nor any evaluation-only tool.

Point clients at Hue

Read each app URL and credential through a helper that detects evaluation and otherwise returns production values. hue eval --command sets HUE_EXECUTION_ID; World cases also set HUE_WORLD_TOKEN. Connect optional apps only when appInWorld(variable) is true. Required app or MCP connections fail closed without a world token or app URL, before requests and without reading the real credential. With neither variable, production values are unchanged. Functions default to the process environment; tests and in-process adapters can pass a mapping or world’s env. Copy only needed functions, commit them with call sites and an optional entry point or test, and test without Hue credentials. Never commit variable-name diagnostics.
hue-eval.ts

Environment variables

Each app surface has a variable, HUE_SIM_<SURFACE>_URL, whose value is the Hue base URL that replaces the real one: the real base URL under https://app.hue.run/api/sim/. <SURFACE> is the surface ID in upper case with every other character replaced by _, so the Gmail MCP server’s variable in the examples is HUE_SIM_GOOGLE_GMAIL_MCP_URL. A base URL keeps any trailing slash its real one has. For an SDK whose base option is an origin rather than a full base URL, pass the value up to and including the real host. HUE_SIM_<SURFACE>_ALIAS is the same base URL on a host of its own, with the real path at the root (https://gmail-googleapis-com.sim.hue.run/gmail/v1), for a client that keeps only the origin of the address you give it. HUE_MCP_CONFIG names an owner-only mcpServers file for every MCP surface of the World, keyed by Hue’s app instance (such as gmail-primary) rather than by your server names, with HUE_WORLD_TOKEN as the bearer. It fits as-is only when those keys are the names your production configuration uses, since a framework derives tool names from them. HUE_MCP_URL, HUE_MCP_TOKEN and HUE_MCP_EXPIRES_AT carry the first MCP surface under the names older adapters read. hue eval prints world created per case, not the variable names. To learn a case’s exact names, have the agent log the HUE_SIM_ variable names, never their values, to stderr during one local trial run, and don’t commit the line; the helper’s fail-closed error also lists the names present.

Multiple apps

A World includes only the apps its case uses; answer-only cases have none. Resolve required apps at startup, outside tool error handling, so refusal stops the run before requests. Connect optional apps only when appInWorld(variable) is true and log skipped names to stderr. In production it is always true; included apps expose production’s tools.

Framework setup

Point each app client at the helper’s result. Find each call site (MCP configuration or code, hosted connector, REST base URL, raw HTTP, meta-tool or model-written code) and replace the Gmail examples’ variables and credential readers.

MCP configuration files

For an mcpServers file, preserve production server names and let the helper write an evaluation copy with Hue’s URLs and the world token. A missing app URL or a client-specific URL field fails closed; remove the copy on exit. Claude Code reads it with --mcp-config:
claude-code.sh
HUE_MCP_CONFIG has the same shape; pass it directly only when its keys match your server names:
mcp.json

Stdio MCP servers

A command and args entry starts a local server, so the helper refuses to rewrite it to avoid changing tools. Keep it and use appEndpoint to resolve the app’s REST URL and the world token. Pass them through the server’s own base-URL and credential settings; without a base-URL override it cannot run in a world.

OpenAI Agents SDK

openai-agents.ts

Vercel AI SDK

vercel-ai-sdk.ts

LangChain

langchain_agent.py

Claude Agent SDK

claude-agent-sdk.ts

Hosted MCP connectors

When the model provider connects to MCP itself, pass the Hue URL and world token. The URL is reachable from the provider and the token is scoped to this instance; use either authorization or Authorization: Bearer.
openai-responses.ts

Direct REST clients

A REST surface keeps the real API paths under its base URL. Give it to the SDK or build requests on it: For a Slack bot that also receives messages, commands, or button clicks, follow Test a Slack bot in a World to configure incoming events alongside its outgoing API client.
direct-rest.ts
Google’s clients add the API’s own paths to the address you give them. Node googleapis keeps only the origin of rootUrl, so give it the origin of the surface’s HUE_SIM_<SURFACE>_ALIAS, and the world token as the OAuth2 access token with no refresh token. Google’s Python client appends the service path, so pass the base URL without the trailing gmail/v1.
gmail-rest.ts
In TypeScript, Calendar, Sheets and Drive take the origin of HUE_SIM_GOOGLE_CALENDAR_REST_ALIAS, HUE_SIM_GOOGLE_SHEETS_REST_ALIAS and HUE_SIM_GOOGLE_SHEETS_DRIVE_ALIAS the same way. In a World, https://www-googleapis-com.sim.hue.run/ serves Gmail under /gmail/v1/ and Calendar under /calendar/v3/, as www.googleapis.com does, so one rootUrl on that origin covers both clients. googleapis sends a media upload (a call with media) to the call’s own rootUrl, not the constructor’s, so pass { rootUrl } as that call’s second argument too; otherwise the upload and the world token go to Google. A service that serves several cases at once keeps these values per case; see integrations saved in your app. Slack clients take the base URL; keep its trailing slash:
slack.ts

Meta-tools and code execution

Some agents reach apps through a tool proxy such as mcp_effect({ serverId, tool, argumentsJson }), mcp_read, or model-written code in a sandbox. The model’s tool list stays unchanged; only server-id resolution changes to the Hue URL and credential.
  • Resolve each app on the host before the run.
  • Give a sandbox only the resolved client, generated module or host proxy—not credentials, open fetch or process.env.
    • Key cached clients by HUE_WORLD_ID; remote sandboxes need an injected URL and token, egress only to app.hue.run and blocked real hosts.
  • Provider-hosted interpreters cannot reach the world directly; host-routed tools can. Test that model-written code fails closed against the real host.
A tool-proxy agent resolves every server once at startup and answers each mcp_effect call from that table:
meta-tool.ts
A code-execution agent hands the sandbox that same resolved function and nothing else:
code-mode.ts

Deployed agents

hue eval runs the agent where you start it. For a deployed agent, run its code locally with --command, or forward the case’s variables through a thin entry point to a non-production deployment for that request only. Never put Hue URLs, world tokens or connection keys in production configuration.

Integrations saved in your app

Some products keep each user’s MCP servers in their own database and connect them when a task runs. Point that path at the World from the case command: read the servers from HUE_MCP_CONFIG, add them for a new test user, run the task, then remove them. Each case gets a new instance, so the URLs and token change every case and nothing is pasted by hand. hue eval runs cases at the same time, so give each case its own user; a shared user would load other cases’ servers.
run-case.ts
Each server’s headers already carry Authorization: Bearer <token>; if your API stores the bare token, use HUE_WORLD_TOKEN. Write every reply the user would see. A structured answer such as {"replies": [...]} is graded on all of its text, not only the last message. A long-running service that builds its app clients per user, such as googleapis from a stored Google connection, takes the World the same way. The case command stores that case’s app URLs (the HUE_SIM_<SURFACE>_ALIAS origin for googleapis), world token, HUE_WORLD_NOW and HUE_WORLD_EXPIRES_AT on the test user or tenant it creates. The service builds that user’s clients from them and takes that user’s “today” from the stored HUE_WORLD_NOW. Don’t read them from the service’s own environment: an environment variable is process-wide, so concurrent cases would share one World and one date. To try a running app by hand, configure it once with a connection key instead of a world token.

Relative dates

A World’s clock is the source trace’s start, not wall time; hue eval passes RFC 3339 HUE_WORLD_NOW for relative dates. It is the World’s “today”: a case that asks about tomorrow, next Friday or a 31-day limit is graded against that date, so an agent that reads the wall clock answers for the wrong day. If --command runs a wrapper script that starts the agent with an environment of its own (a container, env -i, a job runner), pass HUE_WORLD_NOW through to the agent. Without the SDK, use inHueEval() && process.env.HUE_WORLD_NOW ? new Date(process.env.HUE_WORLD_NOW) : new Date() in TypeScript; Python parses with datetime.fromisoformat(value.replace("Z", "+00:00")) and otherwise uses datetime.now(timezone.utc) (Python 3.10 needs +00:00). SDK helpers worldNow() ?? new Date() and world_now() or datetime.now(timezone.utc) fall back when unset; adapters use worldNow(context.world) or context.world.env. Ignore if the agent never reads a clock.

Run it

hue eval starts your command once per case. World cases get World variables; answer-only cases get execution and case variables only. Read {"inputs","config"} from stdin, run once, print the answer to stdout and exit. Answer-only cases keep their generated checks and required judges; see answer-only cases. Use an absolute entry path for one-shot runs; private case directories cannot resolve repository-relative paths. Workers keep the CLI’s starting directory. Examples expand $PWD before launch. inputs is the trace or reviewer input. A case with earlier turns uses {"task": ..., "conversation": {"turns": [{"input": ..., "reply": ...}]}}: seed your agent’s conversation memory from turns, then pass task. For an approval, conversation.pending is the reply that asked for it, usually also the last turn’s reply. Older cases use {"task": ..., "priorContext": [...]} instead. A case that scripts several user messages sends them one call at a time in this same shape; see conversation cases. In a new case built from a trace, recorded session, conversation and user identifiers get fresh values for each attempt. get_case with include_content shows the inputs; map them to your entry argument. JSON stdout is parsed, other output is text (up to 4 MiB); nonzero exit or timeout (default 600 seconds) errors the case. When your production entry point is a server or takes another input shape, add a thin entry point and commit it with the helper:
agent.js
Run with a Read and write key that hue login stored in an ignored env file:
hue eval needs Node.js 22 or 24, even for Python. npx caches the CLI without changing the repository. If your project already has @hue-run/sdk installed, use npx hue eval to run that version. See Run your agent for --check, one run per command and resuming. Every case receives execution and case variables. Only a case with a World receives the World variables: hue eval removes HUE_API_KEY and Hue-key-shaped values; other shell and --env-file variables pass through. Do not reload a file containing HUE_API_KEY. Store checkpoints under .hue/eval/<agent-key> and ignore .hue/; case files are under HUE_CASE_DIR/files/<role>/. Logs go to stderr; stdout is stored. A case passes only after each required evaluator decides; undecided results leave it inconclusive. Exit codes: 0 pass, 1 failure, error, inconclusive or incomplete, 2 usage, 130 interrupt. Compare with --baseline <previous run id>. For the Run button and launch_run to use one agent for answer-only or world-backed cases, start a command worker. It claims queued runs and uses the same stdin handoff:
Command workers register direct:v1 and environment:v1. Adapter-file workers register world support by default; add --capability direct:v1 only after the adapter supports direct cases. Change --revision when capabilities change; otherwise keep it stable. TypeScript adapters lack HUE_WORLD_TOKEN and HUE_EXECUTION_ID: pass context.world.env or spawn with agentEnvironment(context.world). Reject missing worlds; direct adapters pass { HUE_EXECUTION_ID: context.executionId } and connect no apps. Adapter-file workers register world support by default; add --capability direct:v1 only after the adapter supports direct cases. Never mutate process.env; concurrency can leak worlds. Python uses hue_sdk.environment helpers. See the World handoff reference.

Conversation cases

A case can test several user messages in one conversation, such as a request and a follow-up sent right after it. Store the conversation as a turns array of {"role": "user" | "assistant", "text": ...} beside the case’s other fields. Turns through the last assistant message are history; each user message after it is a scripted message:
When a case has two or more scripted messages, hue eval 0.29.0 and later starts your command once per message, in order, and waits for each reply before sending the next. Every call uses the same World instance. Each call’s stdin has the single-turn shape: the case’s other fields, task set to the current message, and conversation.turns with the history and each earlier scripted message paired with the reply your agent gave in this run. The second call above receives:
Each call also receives these variables, and HUE_CASE_INPUTS holds the call’s inputs: A stateless agent that already reads task and conversation.turns needs no change. A stateful agent that keeps its own conversation store can key it by HUE_SESSION_ID: seed it from conversation.turns when HUE_TURN_INDEX is 0, then pass only task. The case’s answer is {"replies": [...]}, one reply per message in order, so evaluators grade every reply. --timeout applies to each call. A call that fails or times out ends the case as an error that names the turn, such as Turn 2 of 2, and keeps the earlier replies. A case with one scripted message runs as one call with its inputs unchanged. If your runner sends the turns itself, pass --turns runner, or set "turns": "runner" in hue.eval.json, to start the command once per case with the case’s inputs unchanged. Adapter files always receive the case’s inputs unchanged.

Verify the setup

  • Production: With world variables unset, helpers return production values; tests pass.
  • Answer-only and fail-closed: Execution-only cases skip optional apps. A missing World or app URL fails before requests or credential reads; sandboxes cannot reach real hosts.
  • Tools and adapters: Expose production tools without Hue-native tools; pass world env or direct execution ID, reject missing worlds and connect no apps for direct mode.
  • Diff and run: Commit only helper, call sites and an optional entry point or test; commit no Hue variable values. Keep the run URL, verdicts, divergence for failures and credential-free stdout.

Production safety

  • World variables exist only in hue eval; it removes HUE_MCP_CONFIG after each case. Production has no World variables and keeps its real credentials.
  • Never copy Hue URLs or token values into production configuration. A token expires with its instance and cannot reach the real app.
  • hue eval strips HUE_API_KEY and Hue-key-shaped values; self-tracing exports only the case span. Safe constructors disable without a key; strict constructors throw. Use --allow-hue-credentials only when permitting project-key access; inspect via get_run_execution/get_case_divergence.

Troubleshooting

Hard-coded URLs

Hard-coded URLs bypass the World: Hue records nothing and real apps may receive writes. Route URLs and credentials through the helper. no_calls is advisory; inspect logs before changing code to distinguish real requests from an early stop or invented answer.