karenina-scenarios

Build and run multi-turn scenario evaluations for conversational LLMs with karenina.

13|3|Updated Jun 27, 2025
One-click install
npx skills add https://github.com/biocypher/karenina --skill karenina-scenarios-biocypher
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: karenina-scenarios
Source: https://github.com/biocypher/karenina/tree/main/skills/karenina-scenarios
Command: npx skills add https://github.com/biocypher/karenina --skill karenina-scenarios-biocypher

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Single-turn benchmarks cannot measure how a model behaves across a live conversation, such as whether it abandons correct answers when challenged or retains knowledge across turns. This Skill guides you through building graph-based multi-turn scenario evaluations in karenina, where each turn's result determines the next question. ## Core Features & Use Cases - Scenario Graph Construction: Define nodes (questions with answer templates), conditional and unconditional edges, entry points, and END transitions, with validation for orphan nodes and missing fallbacks. - Outcome Criteria: Assert properties of the full execution using sugar functions like last_turn, any_turn, all_of, cross_turn, and TurnCheck with scope selectors. - Execution and Analysis: Run scenarios with answering and parsing models, then inspect per-turn history, paths taken, outcome verdicts, and terminal failures via VerificationResultSet. - Use Case: Build a sycophancy check where a model answers a biomedical question, is then challenged with a false claim, and outcome criteria verify whether it maintained the correct answer across turns. ## Quick Start Ask the AI to build a karenina scenario evaluation that branches the conversation based on whether the model's first answer passes verification.

Frequently Asked Questions about karenina-scenarios

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a multi-turn scenario evaluation in karenina?

Create a Scenario object, add nodes with Question objects containing answer templates, connect them with conditional or unconditional edges, set an entry node, and call validate(). Then add the validated definition to a Benchmark and run it with run_verification using both answering and parsing models.

How do I test an LLM for sycophancy across conversation turns?

Build a branching scenario where the model answers a question, then a follow-up node challenges it with a false claim. Use outcome criteria like last_turn(verify_result=True) or cross_turn checks to verify the model maintained its correct original answer.

Why does karenina scenario validation fail with orphan node errors?

Validation runs BFS from the entry node and fails if any node is unreachable, which catches nodes added but never wired into the graph. Also ensure every node with conditional edges has an unconditional fallback edge, typically to END.

Can I use SemanticMatch as a verify_with primitive in scenario templates?

No. SemanticMatch raises NotImplementedError outside the embedding_check pipeline stage because it needs an embedding model at runtime. Use text primitives like ContainsAll, ContainsAny, or ExactMatch in answer templates instead.

What happens when a karenina scenario hits the turn limit?

Execution stops immediately, the status is set to limit_reached, and all completed turns are preserved in history. Outcome criteria still evaluate against the partial execution. The default limit is 20 turns, configurable via scenario_turn_limit.

Why does my scenario run fail with an authentication TypeError?

Live runs require provider API keys in the environment, and the repo-root .env file is not auto-loaded. Export keys before launching, for example with set -a; source .env; set +a, otherwise the first request fails with an authentication resolution error.