{
  "author": {
    "address": "0xc820da3Ce55C600A6282D2B21083Fe5Aa7E51F3D",
    "signature": "638f706add5a5f4222064a161d8cf580e554d1665cc14e86412159c297451795637741c1ae7ad36427e29e745ca2841fafaf640bc54c52fa3d394f1d75c0b95c1b"
  },
  "available_to_orchestrator": true,
  "changelog": "Published update",
  "content_hash": "sha256:98b0bcfa5c4bb032cf57c1e2f7b9ef9de5e629c40558ac524af588f51ad8c842",
  "created_at": "2026-10-09T05:05:05Z",
  "format": "osaurus.template",
  "format_version": 1,
  "id": "3380B691-C8B2-4369-A286-552B3C8B532B",
  "kind": "workflow",
  "name": "Third-Grade Mixed Math Worksheet PDF",
  "requirements": {
    "knowledge": [],
    "mcp_servers": [],
    "models": [],
    "network": [],
    "notes": {},
    "permissions": [],
    "plugins": [],
    "secrets": [],
    "tools": [
      "file_write",
      "file_read"
    ]
  },
  "summary": "Creates a printable 25-question third-grade mixed math worksheet and answer-key PDF.",
  "version": 3,
  "workflow": {
    "edges": [
      {
        "from": "create_worksheet",
        "to": "render_pdf"
      },
      {
        "from": "render_pdf",
        "to": "verify_pdf"
      }
    ],
    "examples": [
      {
        "input": {
          "worksheet_title": "Friday Math Check-In"
        },
        "name": "Friday review"
      },
      {
        "input": {
          "worksheet_title": ""
        },
        "name": "Blank title fallback"
      },
      {
        "input": {
          "worksheet_title": "Third-Grade Mixed Math Review"
        },
        "name": "Balanced mixed review"
      },
      {
        "input": {
          "worksheet_title": "Third-Grade Mixed Math Review"
        },
        "name": "Standard classroom review"
      }
    ],
    "input_schema": {
      "additionalProperties": false,
      "properties": {
        "worksheet_title": {
          "default": "Third-Grade Mixed Math Review",
          "description": "Enter the heading students should see, such as Friday Math Review.",
          "title": "Worksheet title",
          "type": "string"
        }
      },
      "required": [
        "worksheet_title"
      ],
      "type": "object",
      "x-order": [
        "worksheet_title"
      ]
    },
    "model_slots": [
      {
        "locality": "cloud_allowed",
        "needs_tool_use": false,
        "slot": "worksheet_writer",
        "strictness": "preferred"
      }
    ],
    "nodes": [
      {
        "code": {
          "network": [],
          "secrets": [],
          "source": "async function run(input, ctx) {\n  const title = String(input.worksheet_title || '').trim() || 'Third-Grade Mixed Math Review';\n  const runId = String((ctx.run && ctx.run.id) || Date.now());\n  let seed = 2166136261;\n  for (const ch of runId) { seed ^= ch.charCodeAt(0); seed = Math.imul(seed, 16777619); }\n  function random() { seed |= 0; seed = (seed + 0x6D2B79F5) | 0; let t = seed; t = Math.imul(t ^ (t >>> 15), t | 1); t ^= t + Math.imul(t ^ (t >>> 7), t | 61); return ((t ^ (t >>> 14)) >>> 0) / 4294967296; }\n  const rand = (min, max) => Math.floor(random() * (max - min + 1)) + min;\n  const pick = a => a[rand(0, a.length - 1)];\n  const esc = s => String(s).replace(/[&<>\"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','\"':'&quot;',\"'\":'&#39;'}[c]));\n  const rows = [];\n  const add = () => { const a=rand(125,599), b=rand(105,Math.min(399,999-a)); return [`${a} + ${b} = ________`, String(a+b)]; };\n  const sub = () => { const a=rand(350,999), b=rand(101,a-100); return [`${a} − ${b} = ________`, String(a-b)]; };\n  const mult = () => { const a=rand(2,10), b=rand(2,10); return [`${a} × ${b} = ________`, String(a*b)]; };\n  const div = () => { const q=rand(2,10), d=rand(2,10); return [`${q*d} ÷ ${d} = ________`, String(q)]; };\n  rows.push(add(), add(), sub(), sub(), mult(), mult(), div(), div());\n\n  const h=rand(1,9), t=rand(1,9), o=rand(1,9), n=100*h+10*t+o;\n  const places = [{word:'hundreds',digit:h,value:h*100},{word:'tens',digit:t,value:t*10},{word:'ones',digit:o,value:o}];\n  const place=pick(places);\n  rows.push([`What is the value of the digit ${place.digit} in ${n}? ________`, String(place.value)]);\n  rows.push([`Write ${n} in expanded form. ____________________`, `${h*100} + ${t*10} + ${o}`]);\n  let c1=rand(100,999), c2=rand(100,999); if (c1===c2) c2 = c1===999 ? 998 : c1+1;\n  rows.push([`Write <, >, or =: ${c1} ______ ${c2}`, c1<c2 ? '<' : '>']);\n\n  const den=pick([4,6,8,10]), num=rand(1,den-1);\n  rows.push([`A whole is split into ${den} equal parts. ${num} parts are shaded. Write the fraction. ________`, `${num}/${den}`]);\n  const den2=pick([4,6,8]), f1=rand(1,den2-2), f2=rand(f1+1,den2-1);\n  rows.push([`Which fraction is greater: ${f1}/${den2} or ${f2}/${den2}? ________`, `${f2}/${den2}`]);\n  const den3=pick([4,6,8]), used=rand(1,den3-1);\n  rows.push([`A snack is divided into ${den3} equal pieces. You eat ${used}. What fraction did you eat? ________`, `${used}/${den3}`]);\n\n  const startHour=rand(1,10), startMin=pick([0,5,10,15,20,25,30,35,40]), elapsed=pick([20,25,30,35,40,45,50]);\n  const total=startHour*60+startMin+elapsed, endHour=(Math.floor(total/60)-1)%12+1, endMin=total%60;\n  rows.push([`It is ${startHour}:${String(startMin).padStart(2,'0')} p.m. What time will it be in ${elapsed} minutes? ________`, `${endHour}:${String(endMin).padStart(2,'0')} p.m.`]);\n  const duration=pick([25,30,35,40,45,50,55]), sHour=rand(8,10), sMin=pick([0,5,10,15,20,25,30]);\n  const eTotal=sHour*60+sMin+duration, eHour=Math.floor(eTotal/60), eMin=eTotal%60;\n  rows.push([`How much time passes from ${sHour}:${String(sMin).padStart(2,'0')} a.m. to ${eHour}:${String(eMin).padStart(2,'0')} a.m.? ________`, `${duration} minutes`]);\n\n  const quarters=rand(1,3), dimes=rand(1,4), nickels=rand(0,3), pennies=rand(1,4), cents=quarters*25+dimes*10+nickels*5+pennies;\n  rows.push([`How much money is ${quarters} quarter${quarters===1?'':'s'}, ${dimes} dime${dimes===1?'':'s'}, ${nickels} nickel${nickels===1?'':'s'}, and ${pennies} penn${pennies===1?'y':'ies'}? ________`, `${cents}¢`]);\n  const paid=pick([5,10]), priceCents=rand(125,paid*100-25), change=paid*100-priceCents;\n  rows.push([`You pay $${paid}.00 for an item that costs $${(priceCents/100).toFixed(2)}. How much change do you get? ________`, `$${(change/100).toFixed(2)}`]);\n\n  const feet=rand(2,8); rows.push([`How many inches are in ${feet} feet? ________`, `${feet*12} inches`]);\n  const meters=rand(2,9); rows.push([`How many centimeters are in ${meters} meters? ________`, `${meters*100} centimeters`]);\n  const len=rand(4,12), wid=rand(2,len-1); rows.push([`A rectangle is ${len} cm long and ${wid} cm wide. What is its perimeter? ________`, `${2*(len+wid)} cm`]);\n\n  const bags=rand(3,9), each=rand(2,9), given=rand(1,Math.min(9,bags*each-1));\n  rows.push([`Mia has ${bags} bags with ${each} apples in each bag. She gives away ${given} apples. How many apples remain? ________`, `${bags*each-given} apples`]);\n  const books=rand(200,650), more=rand(100,Math.min(300,999-books));\n  rows.push([`A library has ${books} storybooks and receives ${more} more. How many storybooks does it have now? ________`, `${books+more} storybooks`]);\n  const ribbonPieces=pick([4,6,8,9]), pieceLength=rand(3,12);\n  rows.push([`A ${ribbonPieces*pieceLength}-inch ribbon is cut into ${ribbonPieces} equal pieces. How long is each piece? ________`, `${pieceLength} inches`]);\n  const m1=rand(100,300), m2=rand(20,80), m3=rand(10,60);\n  rows.push([`Calculate: ${m1} − ${m2} + ${m3} = ________`, String(m1-m2+m3)]);\n\n  for (let i=rows.length-1; i>0; i--) { const j=rand(0,i); [rows[i],rows[j]]=[rows[j],rows[i]]; }\n  const questions = rows.map((r,i) => `<div class=\"problem\"><b>${i+1}.</b> ${esc(r[0])}</div>`).join('');\n  const answers = rows.map((r,i) => `<div class=\"answer\"><b>${i+1}.</b> ${esc(r[1])}</div>`).join('');\n  const setId = (seed >>> 0).toString(16).toUpperCase().padStart(8,'0').slice(0,8);\n  const safeTitle=esc(title);\n  const html = `<!doctype html><html><head><meta charset=\"utf-8\"><style>\n    @page { size: letter; margin: 0.55in; @bottom-center { content: \"Page \" counter(page); font: 9px Arial; color: #666; } }\n    body { font-family: Arial,sans-serif; color:#17202a; font-size:11pt; line-height:1.35; }\n    h1 { color:#173f5f; text-align:center; font-size:22pt; margin:0 0 10px; }\n    h2 { color:#173f5f; text-align:center; font-size:17pt; margin:4px 0 14px; }\n    .student { display:flex; justify-content:space-between; margin:12px 0; font-size:10.5pt; }\n    .directions { padding:8px 10px; background:#eaf2f8; border-left:4px solid #4d86a8; margin-bottom:14px; }\n    .problem { margin:0 0 16px; break-inside:avoid; }\n    .set { text-align:right; color:#777; font-size:8pt; margin-top:4px; }\n    .answer-key { page-break-before:always; }\n    .answers { display:grid; grid-template-columns:1fr 1fr; border-top:1px solid #b8c4ce; border-left:1px solid #b8c4ce; }\n    .answer { min-height:27px; padding:7px 9px; border-right:1px solid #b8c4ce; border-bottom:1px solid #b8c4ce; }\n  </style></head><body>\n    <h1>${safeTitle}</h1><div class=\"student\"><span>Name: ____________________________________</span><span>Date: __________________</span></div>\n    <div class=\"directions\"><b>Directions:</b> Solve each problem. Show your work when needed, and write each answer in the blank.</div>${questions}<div class=\"set\">Set ${setId}</div>\n    <section class=\"answer-key\"><h1>Answer Key</h1><h2>${safeTitle}</h2><div class=\"answers\">${answers}</div><div class=\"set\">Set ${setId}</div></section>\n  </body></html>`;\n  return { html, title, problem_count: rows.length, set_id: setId };\n}",
          "timeout": 30
        },
        "id": "create_worksheet",
        "input": {
          "worksheet_title": "{{input.worksheet_title}}"
        },
        "intent": "Generate a new balanced set of 25 third-grade problems, calculate every answer, and prepare the printable worksheet and answer key.",
        "kind": "code",
        "name": "Generate fresh worksheet",
        "output_schema": {
          "additionalProperties": false,
          "properties": {
            "html": {
              "type": "string"
            },
            "problem_count": {
              "type": "integer"
            },
            "set_id": {
              "type": "string"
            },
            "title": {
              "type": "string"
            }
          },
          "required": [
            "html",
            "title",
            "problem_count",
            "set_id"
          ],
          "type": "object"
        },
        "retry": {
          "backoff_seconds": 1,
          "max_attempts": 1
        },
        "timeout": 30
      },
      {
        "id": "render_pdf",
        "input": {
          "content": "{{nodes.create_worksheet.output.html}}",
          "path": "third-grade-mixed-math-worksheet.pdf"
        },
        "intent": "Create the final worksheet PDF in the run workspace.",
        "kind": "tool",
        "name": "Render printable PDF",
        "output_schema": {
          "additionalProperties": true,
          "properties": {
            "path": {
              "type": "string"
            }
          },
          "required": [
            "path"
          ],
          "type": "object"
        },
        "retry": {
          "backoff_seconds": 1,
          "max_attempts": 2
        },
        "timeout": 60,
        "tool": {
          "name": "file_write"
        }
      },
      {
        "id": "verify_pdf",
        "input": {
          "path": "{{nodes.render_pdf.output.path}}"
        },
        "intent": "Verify that the generated worksheet PDF is readable.",
        "kind": "tool",
        "name": "Check finished PDF",
        "output_schema": {},
        "retry": {
          "backoff_seconds": 1,
          "max_attempts": 2
        },
        "timeout": 45,
        "tool": {
          "name": "file_read"
        }
      }
    ],
    "output": {
      "pdf": "{{nodes.render_pdf.output.path}}",
      "problem_count": "{{nodes.create_worksheet.output.problem_count}}",
      "title": "{{nodes.create_worksheet.output.title}}"
    },
    "output_schema": {
      "additionalProperties": false,
      "properties": {
        "pdf": {
          "format": "file",
          "title": "Worksheet PDF",
          "type": "string"
        },
        "problem_count": {
          "title": "Number of problems",
          "type": "integer"
        },
        "title": {
          "title": "Worksheet title",
          "type": "string"
        }
      },
      "required": [
        "pdf",
        "title",
        "problem_count"
      ],
      "type": "object"
    },
    "requirement_notes": {},
    "secrets": []
  }
}