agentskit.js
Evals

Prompt snapshots + diff

Assert that rendered prompts haven't changed unexpectedly, and trace exactly which edit caused a drift.

Prompts are code β€” they can regress. matchPromptSnapshot works like Jest snapshots: the first run writes the reference, subsequent runs compare against it. When something drifts, promptDiff and attributePromptChange tell you which change caused it.

#matchPromptSnapshot

import { matchPromptSnapshot } from '@agentskit/eval'

await matchPromptSnapshot({
  name: 'triage-v1',
  actual: renderedPrompt,
  mode: 'exact', // | 'normalized' | 'similarity'
  path: '.agentskit/snapshots',
  similarityThreshold: 0.95,
})

#promptDiff + attributePromptChange

import { promptDiff, attributePromptChange } from '@agentskit/eval'

const delta = promptDiff(before, after)
const attribution = attributePromptChange(delta, history)

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page