gagelink
Hydrology retrieval for AI agents. Values arrive carrying their unit, the datum they are measured from, their timezone, and whether the record is provisional or approved, and every request is recorded in a form that lets a session be re-run and its differences attributed.
Pre-alpha. The transport layer against the USGS Water Data APIs is present. The tool surface, normalisation into typed quantities, and replay are not. The API will change.
pip install gagelink
Why
Water services already publish everything needed to use their data correctly. A discharge states its unit, a stage states the datum it is measured from, a reading states whether it is provisional or approved, and a timestamp states its offset. Clients typically parse the number and drop the rest, and the errors follow from that.
The failure is measurable. In a benchmark of 4,288 runs across eleven models,
quantity-guard found that every model
reaching the computing tool sent a discharge published in cubic feet per second into a
parameter declared in cubic metres per second without converting it, on nearly every run,
giving an answer 35.3 times too large with nothing in the output to indicate it. Seven of
eleven differenced a stage on a local gage datum against an elevation on NAVD88 and reported
the result as freeboard.
gagelink retrieves the data with the metadata kept, and uses quantity-guard to enforce
it where the agent's tools are called.
Current surface
from gagelink import Service
service = Service(api_key="...") # free key, see below
page, retrieval = service.items(
"latest-continuous",
monitoring_location_id="USGS-07374000",
parameter_code="00060",
)
retrieval.record() # what a replay needs: url, params, time, status, sha256
retrieval.quota # Quota(limit=1000, remaining=999)
items returns the parsed page and the record of having fetched it together, rather than
the page alone, because a number that reaches an answer without the request that produced it
cannot be replayed, and pairing them at the only entry point is cheaper than remembering to
record it.
API keys and rate limits
The service allows 50 requests per IP per hour unauthenticated and 1,000 per hour with a key, which is free from api.waterdata.usgs.gov/signup. A single agent question comparing conditions at five sites costs roughly 15 to 25 requests, so caching is load-bearing rather than an optimisation and responses are cached for the life of the process by default.
The remaining allowance is read from X-RateLimit-Remaining on every response and carried
on the retrieval, so an agent can be told what it has left rather than discovering the limit
by failing.
The key travels in the X-Api-Key header and never appears in a recorded URL, since a
manifest is meant to be publishable.
The service this targets
USGS is decommissioning the WaterServices API family, with decommission scheduled for the
first quarter of 2027 and degradation possible from the second half of 2026. gagelink
targets the replacement at api.waterdata.usgs.gov/ogcapi/v0 only. One consequence worth
naming is the time-series-revisions collection, which publishes changes and deletions to
approved record, and which is what will let a replay separate an answer that changed because
the agency revised a measurement from one that changed because the code changed.
Development
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest
Network access goes through a replaceable fetch, so the suite runs against recorded
responses and no test needs the network.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gagelink-0.0.1.tar.gz.
File metadata
- Download URL: gagelink-0.0.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
800b5244aeaefef5210f0082e8a0b300d0c2cb8cafd2bb2405b3eefbacd883a1
|
|
| MD5 |
df63afd06e44975797b0358452bd05e6
|
|
| BLAKE2b-256 |
b409c81b8eda935a03d0e85a402d123cc3c9b6dc85d98d39d093eb9af4d7e7b4
|
Provenance
The following attestation bundles were made for gagelink-0.0.1.tar.gz:
Publisher:
release.yml on Adeniyikayodee/gagelink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gagelink-0.0.1.tar.gz -
Subject digest:
800b5244aeaefef5210f0082e8a0b300d0c2cb8cafd2bb2405b3eefbacd883a1 - Sigstore transparency entry: 2514852182
- Sigstore integration time:
-
Permalink:
Adeniyikayodee/gagelink@5517d14b3694873bd85d2d015eee719860e75a01 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/Adeniyikayodee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5517d14b3694873bd85d2d015eee719860e75a01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gagelink-0.0.1-py3-none-any.whl.
File metadata
- Download URL: gagelink-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dcabde981b76876beeb9fce0604648d535fd10fbeb22e1ad01e56b908227b9f
|
|
| MD5 |
f02aad94c832a57e828fb48723307f37
|
|
| BLAKE2b-256 |
5230460dc40a94f985cedf84a02a90a92c5c0feb42bec69a65d2daa5aed0bbd1
|
Provenance
The following attestation bundles were made for gagelink-0.0.1-py3-none-any.whl:
Publisher:
release.yml on Adeniyikayodee/gagelink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gagelink-0.0.1-py3-none-any.whl -
Subject digest:
7dcabde981b76876beeb9fce0604648d535fd10fbeb22e1ad01e56b908227b9f - Sigstore transparency entry: 2514855022
- Sigstore integration time:
-
Permalink:
Adeniyikayodee/gagelink@5517d14b3694873bd85d2d015eee719860e75a01 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/Adeniyikayodee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5517d14b3694873bd85d2d015eee719860e75a01 -
Trigger Event:
push
-
Statement type: