Files
zooqueenandHanzo Dev b00044ece2 Check each recipe's answer against the obvious one
Every runner printed whatever came back and exited 0, and fell back to a
second raw HTTP call when the SDK import failed. Now each recipe carries
expect.json, the answers a careful reader gives on its own input: a list of
acceptable options for a choice, of level indices for a score, true or false
for a noul. run.py and run.ts send request.json through the SDK, print every
answer, and exit 1 when a checked one is wrong. A question with no obvious
answer on its input is printed and not checked.

Recipes 09 and 11 had no input with an obvious answer, so each state gains
the one fact that decides it. The recipe READMEs describe what each recipe
asks instead of capabilities it never exercised, and copy the request and
checked answers from the two JSON files.

Co-authored-by: Hanzo Dev <[email protected]>
2026-10-09 17:39:13 -07:00

1.6 KiB

Agent Completion Check

Before an agent stops, ask Kai whether the work it reports covers everything the user asked for.

Request (request.json)

{
  "model": "kai",
  "state": {
    "user_request": "Implement password reset flow with email token validation and 15-minute expiration test.",
    "completed_work": [
      "created /api/v1/auth/reset-password endpoint",
      "token generation logic using crypto.randomBytes",
      "written test for valid token verification",
      "written test for expired token rejection"
    ],
    "test_run_result": "12 tests passed, 0 failures"
  },
  "questions": {
    "is_complete": {
      "type": "noul",
      "instructions": "Are all requirements in the user request satisfied?"
    },
    "quality_score": {
      "type": "score",
      "instructions": "Grade completeness and test coverage",
      "criteria": [
        "incomplete",
        "partially implemented",
        "complete with full tests"
      ]
    }
  }
}

Checked answers (expect.json)

  • is_complete (noul): P(true) above 0.5
  • quality_score (score): most probable level 2 complete with full tests

Run

From the repository root, after pip install -r requirements.txt and npm install:

curl -sS --fail-with-body https://api.hanzo.ai/v1/decisions \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d @recipes/05_agent_completion_check/request.json

python3 recipes/05_agent_completion_check/run.py
npx tsx recipes/05_agent_completion_check/run.ts

run.py and run.ts print every answer and exit 1 when a checked answer is wrong.