Skip to content

Spec format ​

Every key highbar accepts, by level. Any other key is an error, except keys that start with x-, which are skipped at every level. Times are in milliseconds.

Top level ​

KeyType
agentmappingRequired. How to reach the agent.
suiteslistRequired, not empty.
defaultsmappingOptional. runs: how many times each test runs (default 1). min_pass: how many runs must pass in a test without its own min_pass, with the same values as the test's (default: all). budget: what each execution may spend in a test without its own budget. session: {args: {...}} for every test; a suite's and a test's own win, key by key.

agent ​

KeyTypeDefault
endpointURLrequiredWhere each message is sent.
startcommandnoneStart the agent: highbar runs it, stops it at the end, and passes HIGHBAR_TRACES_URL. Without it, highbar attaches to a running agent. A ${VAR} in it is shown in the output: pass a token in the environment, which the agent inherits.
healthURLnoneMust answer before tests start. Without it, highbar waits for the endpoint's port.
startup_timeoutms15000How long a started agent has to become ready.
settle_timems500How long after a reply highbar waits before reading the trace file.
watchms2000How long after its reply a test that forbids a call (forbid, function_calls: [], exclusive) is watched: the run reads the trace file until this long after the last reply, and an agent highbar started is stopped only then. A call later than that is not seen. A spec with no such test does not wait.
timeoutms60000Each reply, and each session hook.
tracespath or globnoneThe trace file of an attached agent, or a glob of files, one per process (var/traces/*.jsonl), read together in time order. A path that names a file is that file, even with a [ in it. See several processes. Required when a test checks tool calls in attach mode.
requestmappingPOST {"message": "{{message}}"}method, headers, body.
responsedotted pathfirst of response, message, content, text, replyWhere the reply text is in the JSON body.
sessionmappingnonesetup and teardown hooks, each a command, {python: "module:function"} or {http: {url, method, headers, body}}.
runmappingnonesetup and teardown hooks that run once per spec: the setup before the agent starts, the teardown on every way out after it. The same three kinds as session, with no test's placeholder; what the setup returns is {{run.<path>}}. See before and after the run.
correlatemapping{test: "{{test.id}}"}The context keys that link a trace record to a test.

${NAME} anywhere under agent is replaced by the environment variable when the spec is loaded; a missing variable is an error. A value in request, session, run or a URL's password, query or fragment is masked in the output; the traces path, start and a URL's host and path are shown (which values are masked). Placeholders ({{message}}, {{test.id}}, {{test.name}}, {{test.args.<path>}}, {{session.<path>}}, {{run.<path>}}) are allowed in request, correlate, session commands and the URL, headers and body of a session's HTTP hook; the run teardown takes only {{run.<path>}}, and the run setup none. See attach mode and sessions.

suites[] ​

KeyType
nametextRequired.
testslistRequired, not empty.
sessionmapping{args: {...}} for every test of the suite. A test's own args win, key by key.

tests[] ​

KeyType
triggertextThe message. Either trigger or turns. It can name a value of the session, {{session.<path>}}, when the agent has a session, in a test without variations.
expectmappingWhat must hold. Required with trigger. With turns, it holds only a budget, for the whole conversation.
turnslistA conversation: each turn has trigger, expect and an optional name. The last turn can have variations: paraphrases of its trigger, the turns before it as written. See variations on the last turn.
nametextShown in the output instead of the trigger.
idtextThe test's key in a report, for when the name or the trigger may change. Default: <suite>/<name>, where the name falls back to the trigger.
variationsintegerHow many paraphrases of the trigger to run as well. On a multi-turn test it goes on the last turn instead.
runsinteger ≥ 1How many times to run each phrasing.
min_passinteger ≥ 1, or fraction in (0, 1]How many runs must pass. Default: defaults.min_pass, else all. A fraction is rounded up.
sessionmapping{args: {...}}: a JSON object for this test's session hooks and {{test.args.<path>}}. See a state of its own.
historylistThe conversation before the test's first message, each {role, content} with role user or assistant, for the session's setup to seed. Needs agent.session with a setup: a Python one, or a command or HTTP one that uses {{test.history}}. In a single-turn test, {{test.history}} in agent.request hands it on too, for an agent with no state of its own. See starting in the middle of a conversation.
expect_statusfailed or errorThe state this test must end in: a negative control. It passes when it ends exactly there, and fails when it passes or ends in the other state. See a test that must fail.

Each test's key is unique in a spec. Two tests with the same key are a spec error: give one an id or a different name.

expect ​

KeyType
function_callslistCalls that must happen. []: no call at all.
orderedbooleanThe calls happened in the listed order. Needs function_calls.
exclusivebooleanNo call beyond the listed ones. Needs function_calls.
forbidlist of tool namesTools that must not be called.
responsematchersConditions on the reply text.
budgetmappingWhat may be spent. See budget.
checkmapping{python: "module:function"}: a check of your own, which returns the failures it found. See a check of your own.
llmmappingThe test's calls to the model, from its llm records: model, fallback, last_role, max_calls. See calls to the model.
retrievalmappingWhat entered the prompt, from the test's retrieval records: includes, excludes, max_items, max_tokens, chunks_in_order. See what entered the prompt.

At least one of function_calls, forbid, response, budget, check, llm and retrieval is required.

budget ​

KeyType
max_input_tokensinteger ≥ 0The whole input, cached tokens included.
max_costnumber ≥ 0The cost, compared with the sum in each currency.

At least one is required. A value equal to the limit is within it. Where a budget is written says what it covers:

WhereCovers
expect of a turnThat turn.
expect of a testEach execution of the test: all its turns, added up.
defaults.budgetEach execution of a test without a budget in its own expect.
yaml
- name: a conversation that stays small
  expect:
    budget: {max_input_tokens: 6000, max_cost: 0.05}
  turns:
    - trigger: "What did I order last week?"
      expect:
        budget: {max_input_tokens: 2000}
    - trigger: "Cancel it"
      expect:
        function_calls:
          - name: cancel_order

A test's budget replaces defaults.budget whole: a limit it leaves out is not taken from the default. A limit on a turn does not take the place of the one on the execution, so a conversation with limits only on its turns still gets defaults.budget.

A limit on a turn covers the records read in that turn's window. Records carry no turn id, so a turn recorded late lands in the next turn's window and counts against that turn's limit, and one read after the test's last window counts against the last turn's. The limit on the execution counts it either way.

What happenedResult
Within every limit.The budget passes.
Over a limit.failed, and it counts against min_pass like any other failed run.
The agent wrote no usage, or not the field the limit needs.error: nothing was verified.
Some of the usage is missing, and what is known is already over a limit.failed: more usage can only add to it.
Some of the usage is missing, and what is known is within the limit.error.
A turn with no test context has usage, and the budget holds only without it.error: it may be this test's.
A turn with usage was recorded after the test's window, and takes it over a limit.failed, like a late tool call.

max_cost has no currency of its own. A sum in any currency above it fails the budget; costs in more than one currency that are all within it end in error, because they do not add up to one number. A cost without a currency counts as missing. The agent's cost and the price table are in the trace contract.

A budget needs the turn's record, so it counts as a check on what the agent recorded: in attach mode it needs agent.traces, and a test with one needs a record of its own, like a test that checks tool calls.

function_calls[] ​

KeyType
nametext, or list of textsRequired. A list accepts any of the names.
paramsmappingMust be contained in the call's arguments. Values may be matchers.
resultmappingMust be contained in what the tool returned.
returnsany expected valueThe whole return value: a matcher, a list, a text or a number, for a tool that returns something other than an object. null is refused; write {equals: null}.
errorboolean, or matchersfalse (default): the call must not have failed. true: it must have. A matcher: its error text must meet it.

Matchers ​

Used in response, in values of params and result, and in error:

Matcher
equalsExactly this value. A boolean is never a number, here, in in, contains and a plain value.
contains / icontainsContains the text (i: ignoring case); for a list, has the item.
not_contains / not_icontainsDoes not.
matches / not_matchesA regular expression is found (Python re.search), or is not. Case-sensitive. Checked when the spec is loaded.
imatches / not_imatchesThe same, ignoring case. (?i) at the start of a pattern does the same in matches.
lt / lte / gt / gteA number below, at most, above, or at least the operand, which must be a finite number. Only in params and result.
len / len_lteA list of exactly, or at most, this many items (a whole number, 0 or more). Only in params and result.
inEqual to one of the listed values (a list with at least one). Only in params and result.
contains_allContains each listed item, as contains does (a list with at least one). Only in params and result.
any / allA list where some item, or every item, matches the operand, which is any expected value. all fails on an empty list. Only in params and result.

Negative matchers fail on a value with no text form, such as an object, null or a boolean, and every text matcher fails on a boolean or with one as its operand. An empty text operand is refused; equals takes one. An empty object as a value checks that the key is there and holds an object. A bound fails on a value that is not a number (a numeric string and a boolean included), and a length on a value that is not a list. Templates ({{previous.*}}) are only allowed in triggers.

Released under the MIT License.