Evals quickstart
Create a key, make your first HTTP request and run your first CLI command.
This quickstart takes about five minutes. You create a task API key, list your datasets over HTTP, then install the CLI and do the same from the command line.
You need Evals turned on for your deployment, and Evals access in the app. Until your deployment turns Evals on, the Evals pages don’t appear in the app. Organization owners and admins have access by default, and an admin can grant it to other roles: Open Evals on the Member role, in Settings > Organization > Roles.
-
Create a task API key
Create a task API key with only Read evals checked, as API keys describes. Store it in an environment variable, never in your code or in a repository:
Code -
Set your deployment’s address
Your deployment is the Context address your organization signs in to, such as
https://api.context.ai. Set it without a trailing slash:Code -
Find your workspace ID
Datasets and evaluations belong to a workspace. In the app, open the workspace’s menu, choose Workspace settings, and copy the Workspace ID field on the General tab:
Code -
List your datasets over HTTP
The TypeScript example uses top-level
await, so run it as an ES module (a.mtsfile, or a package with"type": "module").workspaceScopeis JSON in one query value; let your HTTP library URL-encode it. Without it, an organization owner or admin gets datasets from every workspace. If your Evals access covers exactly one workspace, you get that one; otherwise the server answers403and asks you to name a workspace.A
401means the key is missing or isn’t a task API key. A403means the key lacksevals:read, you don’t have Evals access, the key is limited to specific agents, or you didn’t name a workspace. The body’serrorsays which, and only the missing-capability403carries acode; see Errors. -
Install the CLI
In the app, open Settings > Terminal. It shows the install command for your operating system, built from your deployment’s address. On macOS and Linux it has this form:
CodeThis installs the Context command-line tools, including the
contextcommand these pages use. Windows users copy the command that Settings > Terminal shows for Windows.The CLI’s help and error messages still write
context-cli; typecontextinstead. -
Set your organization ID
The CLI also needs your organization ID. Copy it from the Organization ID field in your organization’s Settings > General:
Code -
List your datasets from the CLI
CodeThe command prints one JSON document: a page with
itemsandnextCursor. The CLI’s list commands page their results, while the HTTP list of datasets returns a plain array. Without--workspace, an organization owner or admin gets every workspace, and anyone whose Evals access covers exactly one workspace gets that one; anyone else gets exit code2and is asked to name one. Organization owners and admins can also pass--workspace all.
Next steps
- Compare two models from the CLI builds and runs an evaluation.
- Read a run’s results over HTTP pulls scores into your own tools.
- Errors lists every status code and the CLI’s exit codes.