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
..

Agent Tool Selection

Ask Kai which of four tools a coding agent should call first for its current step, and whether writing files is allowed at that step.

Request (request.json)

{
  "model": "kai",
  "state": {
    "current_step": "Diagnose why unit tests are failing in auth_test.go after upgrading Go version.",
    "available_tools": [
      "view_file",
      "replace_file_content",
      "run_command",
      "search_web",
      "git_status",
      "docker_build",
      "sql_query",
      "fetch_url"
    ]
  },
  "questions": {
    "primary_tool": {
      "type": "choice",
      "instructions": "Which tool should the agent invoke first?",
      "criteria": {
        "run_command": "execute test runner or shell command to reproduce error",
        "view_file": "inspect source file contents",
        "search_web": "look up external documentation or compiler errors",
        "git_status": "check modified git files"
      }
    },
    "allow_file_write": {
      "type": "noul",
      "instructions": "Is write tool execution allowed at this diagnostic stage?"
    }
  }
}

Checked answers (expect.json)

  • primary_tool (choice): run_command or view_file
  • allow_file_write (noul): not checked, no obvious answer on this input

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/02_agent_tool_selection/request.json

python3 recipes/02_agent_tool_selection/run.py
npx tsx recipes/02_agent_tool_selection/run.ts

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