Skip to main content

K12 Workflows

K12 Workflows

K12 workflows orchestrate EOP (Annex) edits and QRG generation/editing processes, integrating with tools and agents.

Workflow Quick Reference

WorkflowIDPurposeDeep Dive
EOP EditingK12-annex-workflowProduction EOP annex editing (kickoff, status, result)EOP Workflow
QRG Generationqrg-generation-workflowQRG generation pipeline (kickoff, status, result)QRG Workflow
QRG Editingqrg-editing-workflowQRG editing pipeline (kickoff, status, result)QRG Workflow
Annex Turn-Based ConversationK12-annex-turn-based-conversation-workflowMulti-turn annex replay plus evaluator passTesting
QRG Turn-Based ConversationK12-qrg-turn-based-conversation-workflowMulti-turn QRG replay plus evaluator passTesting
Annex Scenario RunnerK12-annex-turn-based-scenario-workflowRun one checked-in annex scenario by scenarioIdTesting
QRG Scenario RunnerK12-qrg-turn-based-scenario-workflowRun one checked-in QRG scenario by scenarioIdTesting
Annex Scenario BatchK12-annex-turn-based-scenario-batch-workflowRun a bounded set of annex scenarios and aggregate pass/fail countsTesting
Annex Scenario MiningK12-annex-turn-based-scenario-mining-workflowMine draft scenarios from historical K12 interactionsTesting

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, and qrg-editing-workflow are 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-workflow runs one scenario
  • K12-qrg-turn-based-scenario-workflow runs one QRG scenario
  • K12-annex-turn-based-scenario-batch-workflow runs a selected subset and returns aggregate counts
  • K12-annex-turn-based-scenario-mining-workflow derives 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/ and packages/domain-k12/tests/workflows/
  • Integration checks under tests/integration/k12/ and tests/e2e/k12/

Tip: Reuse the workflow input/output Zod schemas to keep type-safety consistent across tools.