Skip to content

Commit d3713e9

Browse files
chore: remove default_cluster_b_url + CLUSTER_B_URL env var (langgraph-demo leftover)
`default_cluster_b_url()` was extracted verbatim from the langgraph-demo monorepo (per CHANGELOG: 'Initial extraction from the langraph-demo monorepo'). Two problems: 1. The localhost:8082 default presumes a specific deployment shape (the original two-cluster demo); it is meaningless to a fresh SDK user. 2. 'cluster B' is internal terminology a user reading the SDK has no way to understand without context. Configuration of where YOUR receiver lives belongs in your application, not the SDK. `post_handoff` already takes the URL as a positional arg — drop the convenience helper, drop the env var, rename the arg from `cluster_b_url` to `receiver_url` for clarity. Breaking for callers that import `default_cluster_b_url` or pass `cluster_b_url=...` as a keyword arg. CHANGELOG entry added.
1 parent a99aaf0 commit d3713e9

7 files changed

Lines changed: 20 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Unreleased
44

55
- `trusted_endpoints`: registered URLs may now contain FastAPI/Express-style path placeholders. `{id}` matches exactly one path segment, `{rest:path}` matches any subtree. Plain URLs without `{` keep exact-match semantics — no migration needed for existing rows. Both `is_trusted_endpoint` and the snapshot tamper-check inside `evaluate_handoff` honor the new syntax. Closes #14.
6+
- README: new "Getting `PROVABLY_API_KEY` and `PROVABLY_ORG_ID`" subsection walking through sign-up at app.provably.ai → create org → Integrations menu, plus a pointer to provably.ai/docs.
7+
- **BREAKING:** removed `default_cluster_b_url()` and the `CLUSTER_B_URL` env var — leftovers from the langgraph-demo monorepo extraction with a `localhost:8082` default and opaque "cluster B" naming the SDK has no business assuming. `post_handoff(receiver_url, payload)` (positional arg renamed from `cluster_b_url`) takes the URL directly — supply it from your application's own configuration.
68

79
## 0.2.0
810

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ Full product docs: [provably.ai/docs](https://provably.ai/docs).
175175
| `PROVABLY_RUST_BE_URL` | `initialize_runtime`, evaluator | yes |
176176
| `POSTGRES_URL` | intercept storage, trusted endpoints, handoff preprocess | yes |
177177
| `PROVABLY_APP_UI_URL` | optional UI deep-links | no |
178-
| `CLUSTER_B_URL` | `default_cluster_b_url()` helper only | no |
179178
| `PROVABLY_QUERY_RESOLVE_MAX_WAIT_S` | max seconds to wait for a query record to appear (default 15) | no |
180179

181180
`POSTGRES_URL` is a hard dependency today. Three SDK modules open Postgres
@@ -266,11 +265,11 @@ on any non-2xx response.
266265
interceptor's in-memory state — no manual claim construction needed:
267266

268267
```python
269-
from provably import build_handoff_payload, post_handoff, default_cluster_b_url
268+
from provably import build_handoff_payload, post_handoff
270269

271270
# fetch_and_claim is the raw JSON dict the LLM emitted
272271
payload = build_handoff_payload(fetch_and_claim, run_id="run-001")
273-
post_handoff(default_cluster_b_url(), payload)
272+
post_handoff("https://your-verifier.example.com", payload)
274273
```
275274

276275
`claim_contract` generates the system-prompt text that tells an LLM how to
@@ -397,7 +396,7 @@ from provably import (
397396
HandoffPayload, HandoffClaim, HandoffProofAction, HandoffProofBundle,
398397
BenchmarkRow, Outcome, VerificationMode,
399398
# handoff transport
400-
post_handoff, default_cluster_b_url,
399+
post_handoff,
401400
# handoff builders
402401
build_handoff_payload, DEFAULT_HANDOFF_TASK,
403402
claim_contract, default_instructions, field_descriptions,

docs/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ src/provably/
2121
__init__.py
2222
client.py initialize_runtime
2323
types.py HandoffPayload v2, HandoffClaim, etc.
24-
transport.py post_handoff, default_cluster_b_url
24+
transport.py post_handoff
2525
evaluator.py evaluate_handoff, extract_indexed_from_query_record
2626
eval_modes.py the four verification modes
2727
json_utils.py canonical_json

docs/handoff.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ post_handoff(
6767
There is no retry, no batching, no fallback. Failures bubble up as
6868
`httpx.HTTPError` / `httpx.HTTPStatusError`.
6969

70-
`default_cluster_b_url()` is a small convenience that returns
71-
`os.getenv("CLUSTER_B_URL", "http://localhost:8082")` with whitespace and
72-
trailing-slash trimming. Use it where it helps; ignore it otherwise.
70+
The `receiver_url` is supplied by the caller — the SDK does not read it from the
71+
environment or assume any default. Configuration of where YOUR verifier lives
72+
belongs in your application, not the SDK.
7373

7474
## Eval comparison modes
7575

src/provably/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from provably.handoff.guide import default_instructions, field_descriptions
77
from provably.handoff.outcomes import aggregate_outcome, outcome_from_trace
88
from provably.handoff.payload_builder import DEFAULT_HANDOFF_TASK, build_handoff_payload
9-
from provably.handoff.transport import default_cluster_b_url, post_handoff
9+
from provably.handoff.transport import post_handoff
1010
from provably.handoff.types import (
1111
BenchmarkRow,
1212
HandoffClaim,
@@ -49,7 +49,6 @@
4949
"check_claim_endpoints_are_trusted",
5050
"claim_contract",
5151
"configure_indexing",
52-
"default_cluster_b_url",
5352
"default_instructions",
5453
"disable",
5554
"enable",

src/provably/handoff/transport.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import os
4-
53
import httpx
64

75
from provably.handoff.types import HandoffPayload
@@ -11,15 +9,21 @@
119

1210

1311
def post_handoff(
14-
cluster_b_url: str,
12+
receiver_url: str,
1513
handoff_payload: HandoffPayload,
1614
*,
1715
headers: dict[str, str] | None = None,
1816
timeout_s: float = 120.0,
1917
) -> None:
20-
base = (cluster_b_url or "").strip().rstrip("/")
18+
"""POST a serialized ``HandoffPayload`` to ``{receiver_url}/handoffs/receive``.
19+
20+
The receiver is whatever service runs ``evaluate_handoff`` on the payload — typically
21+
a separate verifier in a two-service deployment, but the SDK has no opinion on its
22+
location: ``receiver_url`` is supplied by the caller, never read from the environment.
23+
"""
24+
base = (receiver_url or "").strip().rstrip("/")
2125
if not base:
22-
raise ValueError("cluster_b_url is empty — set CLUSTER_B_URL to post handoff")
26+
raise ValueError("receiver_url is empty — pass the verifier's base URL to post_handoff")
2327
url = f"{base}/handoffs/receive"
2428
body = handoff_payload.model_dump(mode="json")
2529
hdrs = {"Content-Type": "application/json", **(headers or {})}
@@ -29,7 +33,3 @@ def post_handoff(
2933
except Exception as e:
3034
_log.error("post_handoff_failed", url=url, error=str(e))
3135
raise
32-
33-
34-
def default_cluster_b_url() -> str:
35-
return (os.getenv("CLUSTER_B_URL") or "http://localhost:8082").strip().rstrip("/")

tests/unit/test_transport.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,10 @@
44

55
import pytest
66

7-
from provably.handoff.transport import default_cluster_b_url, post_handoff
7+
from provably.handoff.transport import post_handoff
88
from provably.handoff.types import HandoffPayload
99

1010

11-
def test_default_cluster_b_url_env(monkeypatch: pytest.MonkeyPatch) -> None:
12-
monkeypatch.setenv("CLUSTER_B_URL", "http://custom:9999/")
13-
assert default_cluster_b_url() == "http://custom:9999"
14-
15-
16-
def test_default_cluster_b_url_fallback(monkeypatch: pytest.MonkeyPatch) -> None:
17-
monkeypatch.delenv("CLUSTER_B_URL", raising=False)
18-
assert default_cluster_b_url() == "http://localhost:8082"
19-
20-
2111
def test_post_handoff_empty_url_raises() -> None:
2212
with pytest.raises(ValueError, match="empty"):
2313
post_handoff("", HandoffPayload())

0 commit comments

Comments
 (0)