Skip to main content

lanerouter

Live road conditions for the agent web. lanerouter.com

Your agent checks a website or API before acting and reports what happened after. Every agent that reports makes the map better for the next one: walls, rate limits, slowdowns and outages show up within minutes, with legitimate detours that worked.

pip install lanerouter

No dependencies. Python 3.9 or newer.

Two lines

from lanerouter import LaneRouter

LaneRouter().install()

Set LANEROUTER_KEY in your environment, or pass key=. Every request your agent makes with requests or httpx (sync and async) is now checked first and reported after. Nothing else changes: requests go out exactly as before, and if LaneRouter is unreachable your agent never notices.

Get a free key at lanerouter.com/connect. Without a key the library still checks roads, it just doesn't report.

Stop before a red light

from lanerouter import LaneRouter, RedLightError

lanes = LaneRouter(check="block")
lanes.install()

try:
    requests.post("https://shop.example/checkout", json=order)
except RedLightError as err:
    print(err.condition, err.advice, err.detours)

check="warn" (the default) logs a warning through the lanerouter logger, once per road per minute. check="off" skips checks and only reports. Pass on_condition= to handle amber and red roads yourself.

Check or report by hand

lanes = LaneRouter()

lanes.check("shop.example/checkout", action="checkout")
lanes.report("shop.example/checkout", "wall", action="checkout", http_status=403)
lanes.report("shop.example/checkout", "clear", detour={"kind": "official_api", "target": "api.shop.example", "worked": True})
lanes.flush()

Outcomes: clear, slow, rate_limited, wall, changed, broken. Detours must be legitimate routes: official_api, alternate_endpoint, wait_and_retry, hand_to_human, different_provider.

Use with LaneRouter() as lanes: or call lanes.close() before exit so the last reports are sent.

Watch a road

Get a signed webhook when a road turns green, amber or red. The secret is returned once, so store it.

watch = lanes.watch("shop.example/checkout", "https://your-app.example/hooks/lanerouter", action="checkout")

lanes.watches()
lanes.unwatch(watch["id"])
lanes.history(road_id=128)

Verify each delivery with the raw request body:

from lanerouter import verify_signature

ok = verify_signature(raw_body, headers["lanerouter-signature"], os.environ["LANEROUTER_WEBHOOK_SECRET"])

What leaves your machine

Only the road and the outcome: the host and its first meaningful path segment, the HTTP status, the time it took and the library name. Full URLs, query strings, IDs, request and response bodies, headers and personal data never leave your machine.

Options

Option Default
key LANEROUTER_KEY Your free key
check "warn" "warn", "block" or "off"
on_condition None Called with the road and its conditions when it isn't green
framework "lanerouter-py" Shown to site owners in their Insights
slow_ms 5000 Slower than this counts as slow
timeout 1.5 Seconds to wait for LaneRouter before giving up
check_ttl 60 Seconds a check is cached
report_every 60 Seconds before the same road and outcome is reported again
flush_interval 5 Seconds reports wait before being sent in a batch
ignore () Hosts never checked or reported

MCP

Agents that speak MCP can connect directly instead:

https://lanerouter.com/mcp

MIT licensed.

Metadata

Release files for lanerouter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lanerouter 0.1.0
File Size Uploaded Provenance Actions
lanerouter-0.1.0.tar.gz 10.2 kB Without provenance Details for lanerouter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lanerouter 0.1.0
File Interpreter ABI Platform Actions
lanerouter-0.1.0-py3-none-any.whl Python 3 none any Details for lanerouter-0.1.0-py3-none-any.whl

Total release size: 18.8 kB

Release files / lanerouter-0.1.0.tar.gz

Download URL lanerouter-0.1.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b198abf177bd67f803e427adcd7de3fb321fe9779243db2f84eb2dc965d17d18
BLAKE2b-256 checksum
How to use checksums
8ce2140efc4167cb21c3e8b68ef937a7e716411e96d929c5e8454a1ec70dfdc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / lanerouter-0.1.0-py3-none-any.whl

Download URL lanerouter-0.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10a313739ae6892aced6b9b9c5cd0d09e3ec1c3bf254fa66d456b309ac751192
BLAKE2b-256 checksum
How to use checksums
4583197d6efb40aa69b45159feddc525f2a82b23f0bc3a70b7c0742032d8cb87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for lanerouter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page