Skip to content

Commit 2847b21

Browse files
committed
Add warrantability scoring to registry
1 parent eae0890 commit 2847b21

6 files changed

Lines changed: 44 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ Discovery for warranted agents.
9191

9292
The registry does not rank generic vibes or profile copy. It checks whether an agent can actually support the required evidence and bond amount.
9393

94+
It also emits a local `warrantabilityScore`: evidence fit plus bond capacity for this specific request.
95+
9496
### AgentRuntime
9597

9698
The deterministic state machine for a warranted action:

‎docs/AGENT_FRAMEWORK_ARCHITECTURE.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ It matches by:
103103
- requested bond amount;
104104
- promise type.
105105

106+
It also computes a local `warrantabilityScore` from evidence fit and bond capacity.
107+
106108
This is not a reputation marketplace. It is a warranty-eligibility filter.
107109

108110
## Layer 6: AgentRuntime

‎docs/AGENT_REGISTRY.md‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ The registry checks:
1818

1919
If an agent cannot provide the evidence path or cannot support the requested bond, it is rejected before the user treats the agent as warrantable.
2020

21+
The local registry also emits a `warrantabilityScore`.
22+
23+
That score is not reputation. It is a deterministic fit score for this request:
24+
25+
- evidence support;
26+
- bond capacity.
27+
2128
## Why This Matters
2229

2330
Agent marketplaces can make every agent look available.
@@ -42,9 +49,9 @@ Expected shape:
4249
FlowMemory Warranted Agent Registry
4350
4451
Matches:
45-
FlowMemory Warranted Research Agent ELIGIBLE
52+
FlowMemory Warranted Research Agent ELIGIBLE score=100
4653
reasons: eligible_for_warranted_quote
47-
Cheap Claim Agent REJECTED
54+
Cheap Claim Agent REJECTED score=29
4855
reasons: missing_required_evidence, bond_request_exceeds_manifest_limit
4956
```
5057

‎flowmemory_compiler/agent_registry.py‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class AgentMatch:
1818
missing_evidence: tuple[str, ...]
1919
requested_bond_units: int
2020
max_bond_units: int
21+
warrantability_score: int
2122
reasons: tuple[str, ...]
2223

2324

@@ -37,7 +38,7 @@ def list_agents(self) -> list[dict[str, Any]]:
3738

3839
def match(self, request: WorkRequest) -> list[AgentMatch]:
3940
matches = [_match_manifest(manifest, request) for manifest in self._manifests.values()]
40-
return sorted(matches, key=lambda item: (not item.eligible, item.display_name))
41+
return sorted(matches, key=lambda item: (not item.eligible, -item.warrantability_score, item.display_name))
4142

4243

4344
def run_registry_demo() -> dict[str, Any]:
@@ -85,6 +86,7 @@ def match_to_public(match: AgentMatch) -> dict[str, Any]:
8586
"missingEvidence": list(match.missing_evidence),
8687
"requestedBondUnits": match.requested_bond_units,
8788
"maxBondUnits": match.max_bond_units,
89+
"warrantabilityScore": match.warrantability_score,
8890
"reasons": list(match.reasons),
8991
}
9092

@@ -104,6 +106,12 @@ def _match_manifest(manifest: AgentManifest, request: WorkRequest) -> AgentMatch
104106
reasons.append("unsupported_promise_type")
105107
if not reasons:
106108
reasons.append("eligible_for_warranted_quote")
109+
score = _warrantability_score(
110+
required_count=len(required),
111+
matched_count=len(matched),
112+
requested_bond_units=request.requested_bond_units,
113+
max_bond_units=manifest.max_bond_units,
114+
)
107115
return AgentMatch(
108116
agent_id=manifest.agent_id,
109117
display_name=manifest.display_name,
@@ -113,5 +121,24 @@ def _match_manifest(manifest: AgentManifest, request: WorkRequest) -> AgentMatch
113121
missing_evidence=missing,
114122
requested_bond_units=request.requested_bond_units,
115123
max_bond_units=manifest.max_bond_units,
124+
warrantability_score=score,
116125
reasons=tuple(reasons),
117126
)
127+
128+
129+
def _warrantability_score(
130+
*,
131+
required_count: int,
132+
matched_count: int,
133+
requested_bond_units: int,
134+
max_bond_units: int,
135+
) -> int:
136+
if required_count == 0:
137+
evidence_score = 70
138+
else:
139+
evidence_score = int(70 * (matched_count / required_count))
140+
if requested_bond_units <= 0:
141+
bond_score = 30
142+
else:
143+
bond_score = int(30 * min(max_bond_units / requested_bond_units, 1))
144+
return min(100, evidence_score + bond_score)

‎flowmemory_compiler/cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def _print_agent_registry(result: dict[str, Any]) -> None:
429429
print("Matches:")
430430
for match in result["matches"]:
431431
status = "ELIGIBLE" if match["eligible"] else "REJECTED"
432-
print(f" {match['displayName']:<32} {status}")
432+
print(f" {match['displayName']:<32} {status} score={match['warrantabilityScore']}")
433433
print(f" reasons: {', '.join(match['reasons'])}")
434434
if match["missingEvidence"]:
435435
print(f" missing: {', '.join(match['missingEvidence'])}")

‎tests/test_flowcompiler.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ def test_agent_registry_matches_warranted_agent(self):
229229
self.assertEqual(result["schema"], "flowmemory.agent_registry_demo.v0")
230230
self.assertEqual(len(result["matches"]), 2)
231231
self.assertTrue(result["matches"][0]["eligible"])
232+
self.assertEqual(result["matches"][0]["warrantabilityScore"], 100)
232233
self.assertEqual(result["matches"][0]["reasons"], ["eligible_for_warranted_quote"])
233234
self.assertFalse(result["matches"][1]["eligible"])
235+
self.assertLess(result["matches"][1]["warrantabilityScore"], 100)
234236
self.assertIn("missing_required_evidence", result["matches"][1]["reasons"])
235237

236238
def test_agent_runtime_runs_success_and_failure_histories(self):

0 commit comments

Comments
 (0)