What it does
You give it three things:- Filters — which rows are eligible (
used = false,region = EU) - Order — which eligible row to prefer (cheapest first, oldest first)
- Patch — what to change on the row it takes (
used = true)
Setting one up
1
Add a column that marks the state
A Yes/no column like
used, or a Date & time like claimed_at. Make sure every existing row has a value — a row where the column is missing or blank is invisible to the filter and can never be claimed.2
Add the action to an agent tool
Add a Custom Data action, set the operation to Claim, and fill in the filters, order and patch.
3
Tell the agent when to use it
In the prompt. A claim is not reversible, so the agent should only reach for it when it’s actually giving the value to the caller.
The model picks the row; you decide what happens to it
Filters can be templated from the agent’s tool arguments, so the model chooses which row. The patch is fixed in the configuration and can never come from the model. That asymmetry is the safety property: a model that could write the patch could set any field on any row it could find. It can ask for a code; it can’t decide what “claiming” means. Two rules on the patch:- Only declared columns.
- Never the row key. Rewriting the key would leave the row’s identity disagreeing with its contents.
Filters and ordering
Claim speaks the same vocabulary as a search:eq, neq, gt, gte, lt, lte, in, contains, starts_with, plus an order list. So “the cheapest unused code in this region” is one call, and anything you can express in a search filter you can express here.
Ordering is worth thinking about. With no order, rows come back in key order — which for sequential codes (CODE-001, CODE-002) means issuance is predictable. If that matters, order by something less guessable, or generate non-sequential codes.

