Frog Wizard

Put the math in code, the judgment in the spec

When you build an agentic tool, split the work by one question: does this step have a single correct output? If yes, write code. If no, write a spec the agent reads.

I have a tool that picks and manages long-dated SPY call options. The split falls out cleanly.

The numbers have one right answer, so they live in Python. One script fetches the chain and computes a delta for every contract; another applies the hard filters:

calls = calls[calls["dte"] >= 365]
calls = calls[(calls["delta"] >= 0.70) & (calls["delta"] <= 0.85)]
calls = calls[calls["openInterest"] >= 500]
calls["spread_pct"] = (calls["ask"] - calls["bid"]) / calls["mid"]
calls = calls[calls["spread_pct"] <= 0.10]

There is exactly one set of survivors. Never make a model do float math it can get wrong.

The judgment has no right answer, so it lives in prose the agent reads at startup:

- Flag if implied vol is in the top decile vs. neighboring strikes.
- Report one primary pick plus one alternative.
- If nothing clears the filters, say so — don't recommend a marginal pick.
- Surface the model's caveats before the user acts.

These need explanation, escalation, and presentation. Freeze them into a filter and you lose the part a person actually wanted.

The rule: single correct output goes in code; "it depends" goes in the spec. The agent is the orchestrator, not the calculator, and not the rulebook.