DEV Community

Taylor Zhu
Taylor Zhu

Posted on

Stamp a Capacity Contract Before the Agent Leaves the Notebook

You should refuse the route until a capacity contract is stamped. A free model path that answered your demo is not capacity. A free server that stayed up for an afternoon is not a host contract either.

Ship the endpoint only after four facts are written down, dated, and checked. Those facts are the allowance text, the server identity, the data class you will send, and the date the source page was fetched. If any fact is missing, stale, or copied from memory, the gate fails closed and the route stays dark.

The failure you are actually gating

You can prototype an agent in an evening now. That speed is useful. It is also how a notebook path becomes a public URL before anyone records what the free tier promised.

Free access fails differently from a paid outage. The call may succeed, then throttle, then vanish when a quota window resets. The host may stay reachable while the model name behind it changes. You feel that as flaky product behavior. Your users feel it as a broken feature.

A green local run does not close this gap. You need evidence you can re-read next week, not a screenshot of one lucky reply.

What you stamp

Keep one JSON file next to the service. Treat it as release evidence, not as configuration the app should trust at runtime for secrets. The checker below only reads it.

Required fields:

  • doc_url: the page you actually opened
  • fetched_on: ISO date of that read
  • allowance_text: a short quote of the current allowance, or the exact words not stated
  • server_id: a concrete host or project id, not the word free
  • data_class: public-demo, synthetic, or customer — pick one
  • expires_on: when you will re-read the docs
  • fallback: refuse or a named paid path you already operate
  • probe_note: what a local smoke call showed, including the clock time

Do not put a token count in this file because a chat, a social post, or an old draft said a round number. Paste what the project page says on fetched_on. If it says nothing numeric, write not stated and let the gate fail.

Round numbers age badly. A figure that was true in a launch note can be gone by the time you promote. Your job is to cite the page you opened, not to preserve a memorable total.

A stdlib checker you can run today

This script is a proposal. It does not call a vendor, and it is not a benchmark. It exits 0 only when the file is complete, fresh, and internally strict. Anything else exits 2.

#!/usr/bin/env python3
"""Fail closed unless a capacity contract is stamped and fresh."""
import argparse, json, sys
from datetime import date, datetime

VAGUE = {
    "unlimited", "plenty", "free forever",
    "as much as you want", "tbd", "todo",
}

def parse_day(raw):
    return datetime.strptime(raw, "%Y-%m-%d").date()

def main():
    p = argparse.ArgumentParser()
    p.add_argument("contract")
    p.add_argument("--max-age-days", type=int, default=7)
    p.add_argument("--today", default=date.today().isoformat())
    args = p.parse_args()
    today = parse_day(args.today)
    reasons = []
    try:
        with open(args.contract, encoding="utf-8") as handle:
            doc = json.load(handle)
    except (OSError, json.JSONDecodeError) as exc:
        print(f"FAIL unreadable contract: {exc}")
        return 2
    required = [
        "doc_url", "fetched_on", "allowance_text", "server_id",
        "data_class", "expires_on", "fallback", "probe_note",
    ]
    for key in required:
        if not str(doc.get(key, "")).strip():
            reasons.append(f"missing {key}")
    if reasons:
        print("FAIL")
        print("\n".join(reasons))
        return 2
    try:
        fetched = parse_day(doc["fetched_on"])
        expires = parse_day(doc["expires_on"])
    except ValueError:
        print("FAIL dates must be YYYY-MM-DD")
        return 2
    age = (today - fetched).days
    if age < 0 or age > args.max_age_days:
        reasons.append(f"fetched_on age {age}d outside 0..{args.max_age_days}")
    if expires < today:
        reasons.append("expires_on is in the past; re-read the source")
    allowance = doc["allowance_text"].strip().lower()
    if allowance in VAGUE or allowance == "not stated":
        reasons.append("allowance_text is not a citable current limit")
    if not str(doc["doc_url"]).startswith("https://"):
        reasons.append("doc_url must be https")
    if doc["server_id"].strip().lower() in {"free", "localhost", "server"}:
        reasons.append("server_id is a label, not an identity")
    if doc["data_class"] not in {"public-demo", "synthetic", "customer"}:
        reasons.append("data_class must be public-demo, synthetic, or customer")
    if doc["data_class"] == "customer" and doc["fallback"] == "refuse":
        reasons.append("customer data needs a named fallback, not only refuse")
    if len(doc["probe_note"]) < 20:
        reasons.append("probe_note is too thin to audit")
    if reasons:
        print("FAIL")
        print("\n".join(f"- {item}" for item in reasons))
        return 2
    print("PASS capacity contract is stamped")
    return 0

if __name__ == "__main__":
    sys.exit(main())
Enter fullscreen mode Exit fullscreen mode

Pair it with a contract you fill by hand. The sample below is intentionally bad so you can see a fail before you trust a pass.

{
  "doc_url": "https://example.invalid/docs/free-access",
  "fetched_on": "2026-10-08",
  "allowance_text": "not stated",
  "server_id": "free",
  "data_class": "synthetic",
  "expires_on": "2026-10-15",
  "fallback": "refuse",
  "probe_note": "smoke pending"
}
Enter fullscreen mode Exit fullscreen mode

Run it the same way every time you promote:

python3 check_capacity_contract.py contract.json --max-age-days 7 --today 2026-10-08
echo "exit=$?"
Enter fullscreen mode Exit fullscreen mode

That sample must fail. allowance_text is not stated, and server_id is only the word free. Fix the file from a live doc read, then run again. A pass means the file is strict. It does not mean the vendor reserved anything for you.

Where a free model path fits

You still need somewhere to exercise the smoke note. MonkeyCode, as supplied for this draft, offers free model access and a free server option you can use for that probe. Disclosure: This article was prepared as part of MonkeyCode's product outreach.

Use it as the thing you measure, not as a number this page invents. Open the current project documentation, copy the allowance wording into allowance_text, and copy a real server or project id into server_id. If the page lists no quota, no hardware shape, and no duration, leave those claims out. The checker is supposed to fail until the page speaks.

Do not treat a pass on that free server as permission to send customer content. Keep data_class at synthetic or public-demo unless a separate review names a fallback you already run.

Model names belong in the same file only when the docs name them on the fetch date. If you hardcode a model id from memory, you have recreated the stale-contract bug in a different field. Add model_id later, with the same freshness rule, once you are ready to fail the job when it drifts.

Decide with the table, not with vibes

Evidence you have Route decision
Fresh quote, concrete server id, synthetic data, fallback refuse Demo route only
Same, but fetched_on older than your max age Refuse until you re-read
Allowance text is a remembered round number with no URL Refuse
data_class is customer and fallback is refuse Refuse
Docs changed and your quote no longer matches Refuse and restamp
You need an SLA, concurrency floor, or retention promise Do not use this gate; get a written plan

Read the row before you open the port. A demo route means a token-gated URL, a banner that the path is uncommitted, and no customer payload. It does not mean quietly leave it up.

Wire the gate into promotion

  1. Fetch the provider page and fill contract.json the same day.
  2. Send one synthetic prompt to the free server. Write the status, a latency ballpark, and the timestamp into probe_note. Do not paste secrets or customer text into that note.
  3. Run the checker in CI on the promote job. Fail the job on exit 2.
  4. Set expires_on no later than seven days out. When that date passes, the job fails even if nothing else changed.
  5. On fail, keep the previous route dark. Do not fall through to a silent default model.
python3 check_capacity_contract.py contract.json --max-age-days 7 || exit 2
# only then: your existing promote command
Enter fullscreen mode Exit fullscreen mode

If you have no promote command yet, stop. The checker is not a deployer. It will not create a hostname, rotate a key, or drain traffic. Those steps stay in the pipeline you already review.

Pin the checker and the contract in the same commit as the route change. A pass on your laptop against an uncommitted file is not evidence the job will see. Reviewers should be able to open the JSON and the doc URL without asking you what the limit was.

Limits you should say out loud

This gate checks a file you wrote. It cannot see a quota change that happened after fetched_on. A seven-day max age only bounds how long you trust your own notes.

It does not load-test the free server. One smoke call in probe_note can hide a concurrency collapse. It does not review retention, training use, or region. Those are separate reads of the same docs, and you should add fields only when you will actually enforce them.

Free access can be withdrawn. A stamped file is a refusal rule, not a reservation. If your product cannot tolerate a sudden refuse, this path is the wrong host.

The vague-phrase list is short on purpose. You can sneak a fuzzy sentence past it. That is why a human still reads allowance_text in review. Automation catches empty and stale files. It does not replace judgment about whether the quote is specific enough to operate on.

Who should not use this

Skip the approach if you need a contractual SLA, a fixed model build, or a promise about hardware. Those are procurement problems. A checklist will not create them.

Skip it if you cannot name the data class. Customer content does not belong on a free server by default, and the script will not discover that for you.

Skip it if you want a score, a leaderboard, or a claim that one free host is faster than another. This artifact has no benchmark and should not be stretched into one.

Also skip it for a hackathon demo that will be deleted the same night, if nobody else can hit the URL. The stamp earns its keep when a route might outlive the person who created it.

One next step

Fill contract.json from the documentation you can open today, run the checker, and keep the route dark until you get PASS. If you are trying MonkeyCode's free model access and free server for that probe, copy the limits from the project page into the file first, then let the exit code decide, not the demo.

Top comments (0)