K12 Workflows
K12 Workflows
K12 workflows orchestrate EOP (Annex) edits and QRG generation/editing processes, integrating with tools and agents.
Workflow Quick Reference
| Workflow | ID | Purpose | Deep Dive |
|---|---|---|---|
| EOP Editing | K12-annex-workflow | Production EOP annex editing (kickoff, status, result) | EOP Workflow |
| QRG Generation | qrg-generation-workflow | QRG generation pipeline (kickoff, status, result) | QRG Workflow |
| QRG Editing | qrg-editing-workflow | QRG editing pipeline (kickoff, status, result) | QRG Workflow |
| Annex Turn-Based Conversation | K12-annex-turn-based-conversation-workflow | Multi-turn annex replay plus evaluator pass | Testing |
| QRG Turn-Based Conversation | K12-qrg-turn-based-conversation-workflow | Multi-turn QRG replay plus evaluator pass | Testing |
| Annex Scenario Runner | K12-annex-turn-based-scenario-workflow | Run one checked-in annex scenario by scenarioId | Testing |
| QRG Scenario Runner | K12-qrg-turn-based-scenario-workflow | Run one checked-in QRG scenario by scenarioId | Testing |
| Annex Scenario Batch | K12-annex-turn-based-scenario-batch-workflow | Run a bounded set of annex scenarios and aggregate pass/fail counts | Testing |
| Annex Scenario Mining | K12-annex-turn-based-scenario-mining-workflow | Mine draft scenarios from historical K12 interactions | Testing |
Key concepts
- Workflows are built with
createStep+createWorkflow-- commit after chaining steps and share Zod schemas between tools and workflows. - Tool integration -- K12 workflows call K12 tools (task management, EOP snapshot, QRG operations) and use Mastra workflow orchestration.
- Production vs evaluation workflows --
K12-annex-workflow,qrg-generation-workflow, andqrg-editing-workfloware the production async flows. The turn-based workflow family is for QA, scenario replay, evaluator scoring, and prompt/regression work. - Direct runtime execution for local QA -- the turn-based helpers can execute against a live deployed environment through Bruno or directly against a local Mastra runtime when used from the internal harness.
Turn-Based Workflow Family
The turn-based workflow layer lives under packages/domain-k12/src/k12-turn-based/ and reuses the real annex/QRG request paths to evaluate behavior over time instead of only validating a single kickoff/result exchange.
Annex turn-based conversation
K12-annex-turn-based-conversation-workflow accepts:
- annex form content
- user, role, and EOP identifiers
- an ordered list of prompts
- an optional evaluation scenario definition
It replays the prompts sequentially, keeps the session alive across turns, captures the edited content after each turn, and then runs the evaluator agent plus deterministic checks.
Scenario runner and batch workflows
The scenario runner uses the checked-in catalog under packages/domain-k12/src/k12-turn-based/scenarios/ to materialize full workflow input from a named scenario definition.
K12-annex-turn-based-scenario-workflowruns one scenarioK12-qrg-turn-based-scenario-workflowruns one QRG scenarioK12-annex-turn-based-scenario-batch-workflowruns a selected subset and returns aggregate countsK12-annex-turn-based-scenario-mining-workflowderives draft scenarios from existing interaction history
These workflows are what the internal K12 harness uses for deployed scenario evaluation.
Where to look
packages/domain-k12/src/(k12-annex.workflow.ts,qrg-generation.workflow.ts,qrg-editing.workflow.ts)packages/domain-k12/src/k12-turn-based/(annex-conversation.workflow.ts,qrg-conversation.workflow.ts,scenario-runner.workflow.ts,scenario-mining.workflow.ts,shared.ts)- Unit tests under
packages/domain-k12/tests/tools/andpackages/domain-k12/tests/workflows/ - Integration checks under
tests/integration/k12/andtests/e2e/k12/
Tip: Reuse the workflow input/output Zod schemas to keep type-safety consistent across tools.