Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@sanity/agent-evals

Package Overview
Dependencies
Maintainers
113
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/agent-evals

Vitest-style evaluation framework for Sanity Agent

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
77
Maintainers
113
Weekly downloads
 
Created
Source

@sanity/agent-evals

A Vitest-style evaluation framework for testing AI agents.

Installation

pnpm add @sanity/agent-evals

Quick Start

1. Create a config file

// evals.config.ts
import { defineConfig } from "@sanity/agent-evals/config";

export default defineConfig({
  include: ["**/*.eval.ts"],
  exclude: ["node_modules/**"],

  judge: {
    model: anthropic("claude-sonnet-4-5"),
  },

  agent: (contextKey) => ({
    async run(prompt) {
      // Your agent implementation
      return {
        text: "",
        toolCalls: [],
        createdDocuments: [],
        updatedDocuments: [],
        duration: 0,
      };
    },
  }),

  client: (contextKey) =>
    createClient({
      /* ... */
    }),
});

2. Write evals

// query.eval.ts
import { describe, expect, it } from "@sanity/agent-evals";

describe("Document Query", () => {
  it("finds posts by author", async ({ agent }) => {
    const result = await agent.prompt("Find all posts by Knut");

    await expect(result).toSatisfy("returns a list of posts");
    expect(result).toHaveUsedTools(["groq-query"]);
  });
});

3. Run evals

npx sanity-evals

CLI Options

npx sanity-evals --help

License

MIT

Keywords

sanity

FAQs

Package last updated on 03 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts