A Retool Workflow runs an Amazon Buy Box price-watch on a schedule with no server to deploy: a Schedule trigger block fires on an interval, a Resource Query block calls the SellerMagnet API, and a Python Code block decides whether the new price is a real drop, reusing the Python quickstart's own sellermagnet.py and retry.py completely unchanged. The two traps that actually matter here are not about the Amazon data at all: Retool's Resource Query block times out at 10 seconds by default, far below the ~120 seconds SellerMagnet allows a single lookup, and a scheduled Workflow run can never overlap itself, so a slow run is only ever late, never duplicated.
Key Takeaways
- Retool's own limits page is explicit: a scheduled Workflow run must finish, whether it succeeded or failed, before the next scheduled run can start, and every schedule carries a small jitter delay (up to 6 minutes on an hourly schedule) to spread out queue load. Unlike Vercel's cron jobs (missed-or-duplicated) or Cloud Run Jobs (platform retries the whole task up to 3x) earlier in this series, the Retool risk is a LATE run, never an overlapping one.
- A Resource Query block (the block that actually calls a REST API resource) times out at 10 seconds by default, configurable up to 10 minutes for an async run. Left at the default, a slow-but-billed SellerMagnet lookup gets cut off by Retool itself before the real response arrives, which then looks like a connection error to the Code block reading its result - not a SellerMagnet problem at all.
- A Code block can run real Python (or JavaScript) with HTTP-capable libraries, not just data transformation, so this post's Code block pastes in the quickstart's own sellermagnet.py and retry.py unchanged rather than re-implementing the retry policy as a declarative Resource Query - keeping the exact same billing-aware retry every other post in this series uses.
- A Code block's own configurable retry count retries the WHOLE block (every already-succeeded ASIN inside a loop included) on any error, which would double-bill a partially-successful batch; this post leaves that block-level retry off and keeps get_with_retry()'s narrower, per-call retry inside the Python code instead.
- The SellerMagnet API key is never a literal string in the script: Retool's own guidance is a Resource credential field or a secret/environment variable read from code, and a self-hosted deployment additionally requires that variable's name to carry the RETOOL_EXPOSED_ prefix before a Code block may read it at all.
Why does the Resource Query timeout matter more than the schedule?
Retool's block-level timeout table lists a Resource Query block's DEFAULT at 10 seconds, with a configurable maximum of 10 minutes for an asynchronous Workflow run (2 minutes for a synchronous one). SellerMagnet's own API allows a single scrape to take up to roughly 120 seconds, and that time is billed whether the caller waits for it or not. A Resource Query left at Retool's 10-second default does not make the SellerMagnet call cheaper or faster: it just means Retool gives up on reading the response before a legitimately slow (and already billed) lookup finishes, and the Code block downstream sees a timeout error instead of the real JSON. The fix is a one-time setting change on the Resource Query block (raise its timeout past 120 seconds), not a code change.
| Limit | Value |
|---|---|
| Schedule trigger minimum interval | 1 minute, and a run must finish before the next one starts |
| Workflow timeout (async: Schedule, Event) | 30 hours |
| Workflow timeout (sync: webhook/app, to first Response) | 15 minutes |
| Resource Query block timeout (default) | 10 seconds |
| Resource Query block timeout (async max) | 10 minutes |
| Resource Query block timeout (sync max) | 2 minutes |
sellermagnet.py - unmodified from the Python quickstart
import os
import requests
API = "https://sellermagnet-api.com/api"
class ApiError(Exception):
def __init__(self, status: int, message: str, retry_after: float = 0.0):
super().__init__(f"{status}: {message}")
self.status, self.retry_after = status, retry_after
def new_session() -> requests.Session:
session = requests.Session()
session.headers["X-Api-Key"] = os.environ["SELLERMAGNET_API_KEY"]
return session
def get(session: requests.Session, endpoint: str, **params) -> dict:
resp = session.get(f"{API}/{endpoint}", params=params, timeout=120)
try:
body = resp.json()
except ValueError:
body = {}
if resp.status_code == 200 and body.get("success"):
return body["data"]
try:
wait = float(resp.headers.get("Retry-After", 0))
except ValueError:
wait = 0.0
raise ApiError(resp.status_code, body.get("message", "request failed"), wait)
retry.py - unmodified from the Python quickstart
import random
import time
import requests
from sellermagnet import ApiError, get
RETRYABLE = {429, 500, 502, 503}
def get_with_retry(session, endpoint: str, attempts: int = 4, **params) -> dict:
internal_errors = 0
for attempt in range(1, attempts + 1):
try:
return get(session, endpoint, **params)
except ApiError as err:
internal_errors += err.status == 500
if err.status not in RETRYABLE or attempt == attempts or internal_errors > 1:
raise
backoff = min(2 ** attempt, 30) + random.uniform(0, 1)
time.sleep(max(backoff, err.retry_after))
except (requests.ConnectionError, requests.Timeout):
if attempt == attempts:
raise
time.sleep(min(2 ** attempt, 30))
What does the Python Code block actually run?
price_watch.py below has no Retool-specific objects in it at all: check_batch() takes the ASIN list, the marketplace ID and the previous run's last-seen prices as plain arguments, and returns the alerts plus the updated prices to store. Inside the real Workflow, the Code block reads asins and last_prices from the OUTPUT of the previous block (a Resource Query against a small state table, one row per ASIN) and its own return value becomes the INPUT to the next block (a second Resource Query that writes the updated prices back, then a Slack or email Resource Query for any real alert). None of that wiring changes a single line inside check_batch() itself.
price_watch.py - check_batch(), tested below against the real quickstart modules
"""price_watch.py - the logic a Retool Code block (Python) runs on a schedule.
Reused unchanged from the Python quickstart: sellermagnet.py (ApiError, new_session, get)
and retry.py (get_with_retry). This file adds only the comparison/alert logic; it makes
no assumption about Retool's own objects (no `retoolContext`, no block references), so it
is fully testable here and then pasted into a Code block almost unchanged - only the last
few lines (reading the previous Resource Query's output, writing the next one's input)
are Retool wiring, shown separately as illustrative, not tested.
"""
from __future__ import annotations
from retry import get_with_retry
DROP_THRESHOLD_PCT = 3.0 # a smaller move is noise, not a real drop
def read_buy_box_price(session, asin: str, marketplace_id: str) -> float | None:
"""buyBox.totalPrice as a float, or None when there is no featured offer."""
data = get_with_retry(session, "amazon-product-offers", asin=asin, marketplaceId=marketplace_id)
price = (data.get("buyBox") or {}).get("totalPrice")
return price if isinstance(price, (int, float)) else None # {} or a non-numeric value: no alert
def check_batch(session, asins: list[str], marketplace_id: str, last_prices: dict) -> tuple[list[dict], dict]:
"""One scheduled tick. Returns (alerts, updated_last_prices).
`last_prices` is read from, and `updated_last_prices` is written back to, a Retool
Resource Query against a small state table (one row per ASIN) - the Code block itself
holds no state between runs, Retool Workflows do not promise one (see FACTS below).
"""
alerts: list[dict] = []
updated = dict(last_prices)
for asin in dict.fromkeys(a.strip().upper() for a in asins): # dedupe, keep order
try:
price = read_buy_box_price(session, asin, marketplace_id)
except Exception as err: # noqa: BLE001 - reported per ASIN, batch continues
alerts.append({"asin": asin, "kind": "error", "detail": str(err)})
continue
if price is None:
updated[asin] = None
continue
last = last_prices.get(asin)
if isinstance(last, (int, float)) and last > 0:
drop_pct = round((last - price) / last * 100, 1)
if drop_pct >= DROP_THRESHOLD_PCT:
alerts.append({"asin": asin, "kind": "drop", "from": last, "to": price, "drop_pct": drop_pct})
updated[asin] = price # always store the latest reading, alert or not
return alerts, updated

How does a Retool schedule compare with the rest of this series?
Every scheduled or cron-triggered post in this series answers the same question differently: what happens when a run is still going when the next one would start, or when a run fails? Retool's answer is the simplest of the group: the next scheduled run waits, full stop.

| Status | Meaning | Billed | Reaction |
|---|---|---|---|
200 | Success | Yes | Use data |
401 / 403 | Key or credits | No | Stop |
404 | Not on this marketplace | Yes | Absorbed, logged, never re-thrown |
429 | Concurrency cap | No | Wait Retry-After, retried |
500 | Internal error | No, refunded | Retry once |
502 / 503 | Upstream / breaker | Yes | Wait, then retry, capped at 4, then absorbed |
Real output from the tested harness (fakehttp.py faking requests.Session.get only, illustrative data)
first-run-no-baseline: [] {'B0CL61F39H': 444.99}
first-run-no-baseline-no-alert: PASS
first-run-no-baseline-stores-price: PASS
unchanged-no-alert: PASS
real-drop: [{'asin': 'B0CL61F39H', 'kind': 'drop', 'from': 444.99, 'to': 399.0, 'drop_pct': 10.3}]
real-drop-fires: PASS
drop-under-threshold-not-alerted: PASS
price-rose-no-alert-baseline-updates: PASS
no-buybox-not-a-drop: PASS
err: [{'asin': 'B0UNKNOWN1', 'kind': 'error', 'detail': '404: Product not found'}]
404-absorbed-not-retried: PASS
429-free-retried-then-ok: PASS
500-twice-reported-not-looped-to-3rd-call: PASS
502-503-capped-at-4-absorbed: PASS
duplicate-asins-deduped: PASS
mixed-batch-only-real-drop-alerts: PASS
---
PASS=13 FAIL=0
ALL 13/13 SCENARIOS PASS
Frequently Asked Questions
Can a Retool Workflow's schedule trigger run two price checks at once?
No. Retool's own limits page states each scheduled workflow run must complete, whether it succeeded or failed, before the next run can start. The risk with Retool is a LATE run (plus a small jitter delay), never a duplicate or overlapping one, unlike Vercel's cron jobs.
Why does the Resource Query timeout matter for a SellerMagnet call?
A Resource Query block times out at 10 seconds by default, far below the ~120 seconds SellerMagnet allows a single lookup to take. Left at the default, a slow but billed call gets cut off by Retool itself and looks like a connection error, not a real API response.
Does the Code block need its own retry logic, or does Retool retry it?
A Code block has its own configurable retry count setting, but it retries the WHOLE block (including any already-succeeded ASIN lookups inside a loop) on any error, which would double-bill. This post keeps the quickstart's own get_with_retry() inside the Python code instead, so only the one failing HTTP call is retried, and Retool's own block-level retry stays off for this block.
Where does the API key go, so it is never visible in the workflow's code?
Retool's own best-practice guidance is a Resource credential field or a workspace secret / environment variable read from code, never a literal string pasted into the script. Self-hosted deployments additionally require that variable's name to carry the RETOOL_EXPOSED_ prefix before a Code block may read it at all.
Does the comparison logic need to change for Retool specifically?
No. check_batch() is plain Python with no Retool-specific objects; it is pasted into a Python Code block almost unchanged, reading the previous Resource Query's output and returning the value the next block (a state-table write, then a Slack alert) consumes.
Bottom line: a Retool Workflow runs this price-watch with zero changes to the Python quickstart's sellermagnet.py and retry.py, provided the Resource Query block's timeout is raised past 120 seconds (Retool's own 10-second default will otherwise cut off a slow, already-billed lookup) and the Code block's own retry count is left off in favour of the quickstart's narrower per-call retry. Retool's schedule trigger is also the simplest in this series: a run can only ever be late, never duplicated, because the platform refuses to start the next one until the current run finishes. Every endpoint is documented on the API documentation page, more runnable snippets are on the code examples page, and a free account includes 150 credits to try it.