Skip to main content
A case is one input to your agent. You build cases with kensa_case and parametrize them into a pytest test. Each case carries an id, an input (or a conversation), and any extra fields your harness needs.

Signature

Case object

Inside a test, the case fixture is a KensaCase:

Literal input vs messages

Use input for a single prompt:
Use messages when the case is a partial conversation and the agent must respond to the latest turn:
Messages follow the standard role/content shape (system, developer, user, assistant, tool), including tool_calls on assistant turns and tool_call_id on tool turns.

Parametrize multiple cases

One test can cover many cases. Each becomes its own pytest item:

Trials

Wrap a test with the Kensa marker to run each case more than once:
Each case expands into one pytest item per trial:
Kensa aggregates the trials into a single verdict per case. trials: 1 is reported as a smoke check; trials > 1 is measured evidence of flakiness. See Pytest plugin for verdict aggregation.

Generated cases

When your coding agent mines imported traces into eval ideas (the kensa-inspect skill) and materializes the approved ones (the kensa-generate skill), the generated tests/evals/test_<id>.py files use this same kensa_case API - plain pytest files you can edit, rename, and extend by hand. See Tracing & imports.
Last modified on July 23, 2026