-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiscover-and-evaluate.py
More file actions
65 lines (51 loc) · 2.22 KB
/
Copy pathdiscover-and-evaluate.py
File metadata and controls
65 lines (51 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Rhumb Example: Discover and evaluate services for a capability.
This script shows the core Rhumb Index flow:
1. Search for services by capability (e.g., "send email")
2. Get the AN Score breakdown for the top result
3. Check known failure modes before integrating
No governed API key needed — all discovery endpoints are public.
"""
import httpx
import json
BASE = "https://api.rhumb.dev/v1"
def main():
# Step 1: Search for email services
print("🔍 Searching for email services...\n")
resp = httpx.get(f"{BASE}/search", params={"q": "email"})
results = resp.json().get("data", {}).get("items", [])
if not results:
print("No results found.")
return
for svc in results[:5]:
slug = svc.get("slug", svc.get("service_slug", "?"))
score = svc.get("an_score", svc.get("score", "?"))
tier = svc.get("tier_label", "?")
print(f" {slug:20s} AN Score: {score} Tier: {tier}")
# Step 2: Get detailed score for the top result
top = results[0]
slug = top.get("slug", top.get("service_slug"))
print(f"\n📊 Detailed score for {slug}:\n")
score_resp = httpx.get(f"{BASE}/services/{slug}/score")
score_data = score_resp.json()
if "an_score" in score_data:
print(f" AN Score: {score_data['an_score']}")
print(f" Execution: {score_data.get('execution_score', '?')}")
print(f" Access: {score_data.get('access_readiness_score', '?')}")
print(f" Autonomy: {score_data.get('autonomy_score', '?')}")
print(f" Tier: {score_data.get('tier_label', '?')}")
print(f" Explanation: {score_data.get('explanation', '?')[:200]}")
# Step 3: Check failure modes
print(f"\n⚠️ Known failure modes for {slug}:\n")
fail_resp = httpx.get(f"{BASE}/services/{slug}/failures")
fail_data = fail_resp.json()
failures = fail_data.get("data", {}).get("failures", fail_data.get("failures", []))
if failures:
for f in failures[:3]:
print(f" • {f.get('title', f.get('name', '?'))}")
if f.get("description"):
print(f" {f['description'][:150]}")
else:
print(" No documented failure modes.")
if __name__ == "__main__":
main()