Skip to content

Quick start ​

From an empty account to a prompt your backend resolves at runtime.

1. Write a prompt ​

Sign in at evalwright.com, create an organization, then a prompt in one of its projects. A prompt is a name with many versions — every change forks one rather than overwriting. Put what varies per call in {{double braces}}:

text
You are a support agent for {{productName}}.
Answer {{customerName}} in a {{tone}} tone, in at most {{maxWords}} words.

2. Deploy it ​

Deploy a version to one of the project's environments from its menu. A project starts with development, staging and production, and you can add more under Environments. Each environment holds one version, and the same version can be live in several. A version deployed nowhere is a draft and no key can read it. A protected environment — production, to start with — may require approval, per your organization's policy.

3. Create an API key ​

In the app, open API keys and pick the environment the key reads. The plaintext is shown once; Evalwright keeps only its hash. See API keys.

4. Copy the prompt's id ​

resolve() takes the prompt's id, not its name. Open any version of the prompt: the id is at the top of the page, beside the prompt's name, labelled Prompt ID with a copy button.

5. Resolve it ​

ts
import { EvalwrightClient } from "@evalwright/sdk";

const client = new EvalwrightClient({
  apiKey: process.env.EVALWRIGHT_API_KEY!,
  baseUrl: process.env.EVALWRIGHT_BASE_URL!,
});

const SUPPORT_REPLY_ID = "6a1f0c3e9b2d4a7f8e5c1b90"; // from step 4

const { prompt, version, promptVersionId } = await client.prompts.resolve(
  SUPPORT_REPLY_ID,
  { vars: { productName: "Acme", customerName: "Ada", tone: "warm", maxWords: "120" } },
);

console.log(`running ${version} (${promptVersionId})`);
// The way the benchmark ran it: the prompt as the system message, the
// customer's message as the user turn.
const reply = await myModel.complete({ system: prompt, user: customerMessage });

baseUrl has no default on purpose: every call carries your API key, and a default host collects keys from everyone who forgot to set one. Give it without /v1; the SDK adds that itself.

6. Change it without deploying ​

Edit, benchmark the new version against the old, deploy the winner. Within about 30 seconds resolve() returns the new text; nothing on your side restarts.

Deploying is the only thing that moves callers. To roll back, deploy the previous version again; to take a prompt out of an environment, remove it there. See prompts.resolve().

Released under the MIT licence.