Skip to content
2 changes: 1 addition & 1 deletion docs/discovery-swarm/current-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Three credential types: agent `sk_` api-key (`X-API-Key`, custodial writes; pres

## 8. Economics

Credits: 100 free, 500 trial, paid reads (best_agent=10, risk_score=10, reputation/evidence/fraud=5), escrow with 2.5% Guild fee, referral rewards (200 credits, activation-gated, capped, never first-party). Stripe optional, not enforced. Effectively $0 marginal compute cost.
Credits: 100 free, 2,000 trial, paid reads (best_agent=10, signed_decision=1,000, risk_score=10, reputation/evidence/fraud=5), escrow with 2.5% Guild fee, referral rewards (200 credits, activation-gated, capped, never first-party). Trial credits are sandbox-only and never revenue. Stripe optional, not enforced. Effectively $0 marginal compute cost.

## 9. Test infrastructure

Expand Down
6 changes: 5 additions & 1 deletion live/guild/app/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@

CREDIT_USD = 0.001 # 1 credit = one tenth of a cent
FREE_CREDITS = 100 # new account starts with $0.10 of free lookups
TRIAL_CREDITS = 500 # human-free trial grant: $0.50 of lookups to evaluate
# Enough for two independent premium signed-decision reads. The production
# release gate intentionally verifies the sealed decision twice (conformance
# suite + independent verifier) through this same public, non-privileged path.
# These remain sandbox evaluation credits and are never counted as revenue.
TRIAL_CREDITS = 2000 # human-free trial grant: $2.00 of evaluation reads

# --- settlement economics (the economic layer) ------------------------------
# Agent Guild mediates agent-to-agent transactions via escrow: the requester
Expand Down
11 changes: 8 additions & 3 deletions live/guild/tests/test_machine_journey_x402.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def test_clean_client_full_journey(clean_market):
trial_path = manifest["economics"]["acquire_credits"]["trial"]["path"]
trial = client.post(trial_path)
assert trial.status_code == 200
key = trial.json()["key"]
trial_body = trial.json()
key = trial_body["key"]
assert agent["id"] # identity provisioned in step 2 (no human involved)

# 4. CHECK TRUST on the trial balance.
Expand All @@ -65,9 +66,13 @@ def test_clean_client_full_journey(clean_market):
assert r.status_code == 200

# 5. RECEIVE 402 WHEN APPROPRIATE — drain the trial; the 402 carries the
# standards-compliant v2 challenge.
# standards-compliant v2 challenge. Derive the bound from the service's
# own advertised balance and price so changing the evaluation budget does
# not silently turn this black-box journey into a partial drain.
challenge = None
for _ in range(200):
basic_cost = manifest["economics"]["pricing_credits"]["best_agent"]
max_reads_to_402 = trial_body["balance"] // basic_cost + 2
for _ in range(max_reads_to_402):
r = client.get("/check?capability=journey.test",
headers={"X-API-Key": key})
if r.status_code == 402:
Expand Down
10 changes: 10 additions & 0 deletions live/guild/tests/test_release_gate_machine_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import json
from pathlib import Path

from app.billing import FREE_CREDITS, PRICING, TRIAL_CREDITS


_PATH = Path(__file__).resolve().parents[2] / "scripts" / "release_gate.py"
_SPEC = importlib.util.spec_from_file_location("release_gate_under_test", _PATH)
Expand Down Expand Up @@ -61,3 +63,11 @@ def fake_open(req, timeout):

assert out == {"verified": True}
assert seen[0].get_header("X-api-key") == "ak_ephemeral_secret"


def test_public_trial_covers_both_independent_signed_release_checks():
"""The gate performs one live AGI-1 conformance fetch and one independent
signed-decision verification. Its ordinary trial account must fund both;
a privileged CI bypass would make the production check economically false.
"""
assert FREE_CREDITS + TRIAL_CREDITS >= 2 * PRICING["signed_decision"]
Loading