Diese Seite wurde maschinell übersetzt und wurde noch nicht von einer Person überprüft. Englisch ist die Referenz; Korrekturen auf GitHub sind willkommen. GitHub

Cookwala / SDK und Szenarien / 017

Read the reference registry: five pointers, nothing third-party

A registry lists what exists and where; it does not host it. The reference registry at cookwala.ai points at the catalog, the example recipes, the default limits, the WHO/Codex rule pack and the agent-safety benchmark, all from this repository.

Zielgruppe: registry operator · Ziel: Roboter für Menschen · Level: beginner

Zuerst lesen: /docs/REGISTRY/ /docs/FEDERATION/

Schritte

  1. Five entries, each with a kind, a name under ai.cookwala/, a verification method and a repository pointer. getRegistry

  2. The recipe collection the registry points at is the nine the hub serves. listRecipes

  3. The registry says it in its own note: pointers only, nothing here is a third-party product.

Ergebnis

You know what a registry entry looks like and that anyone may run one. Scenarios 090 onwards cover publishing, verification and federation.

Kommandozeile

curl -s http://localhost:7878/v1/tools/registry
curl -s https://cookwala.ai/v1/registry.json

Aufgezeichnete Ausgabe

Status: ok

[1] getRegistry: {"cookwala": "0.2.0", "generatedAt": "2026-10-04T12:00:00Z", "registry": "https://cookwala.ai", "note": "Pointers only. Everything listed exists in the amado2k5/cookwala repository; nothing here is a third-party product. Anyone may run a registry (RFC-0002, RFC-0006).", "entries": [{"kind": "catalog", "name": "ai.cookwala/reference-catalog", "description": "The reference Cookwala catalog: schemas, vocabularies, example recipes and feeds.", "version": "0.2.0", "status": "active", "url": "https://cookwala.ai/.well-known/cookwala.json", "coreVersion": "0.2.0", "verification": {"method": "dns_txt"…
[2] listRecipes: {"recipes": ["basbousa", "ful-medames", "kofta-oven", "koshari", "lentil-soup", "molokhia", "rice-vermicelli", "salata-baladi", "shakshuka"]}

Code

Ausführen: python scenarios/out/017-registry-pointers-only/python.py

# Scenario 017: Read the reference registry: five pointers, nothing third-party
# A registry lists what exists and where; it does not host it. The reference registry at cookwala.ai points at the catalog, the example recipes, the default limits, the WHO/Codex rule pack and the agent-safety benchmark, all from this repository.
# Run a hub first: python hub/cookwala_hub.py --recipes examples
import json, os
from cookwala.client import CookwalaClient, CookwalaProblem

def load(path):
    with open(path, encoding="utf-8") as f:
        return json.load(f)

def pick(obj, path):
    for part in path.replace("]", "").replace("[", ".").split("."):
        obj = obj[int(part)] if part.isdigit() else (len(obj) if part == "length" else obj.get(part))
    return obj

c = CookwalaClient(os.environ.get("COOKWALA_HUB", "http://localhost:7878"))


# Step 1: Five entries, each with a kind, a name under ai.cookwala/, a verification method and a repository pointer.
registry = c.get_registry()
assert pick(registry, "cookwala") == "0.2.0", pick(registry, "cookwala")
print("ok", "cookwala", "=", "0.2.0")
assert pick(registry, "entries.length") == 6, pick(registry, "entries.length")
print("ok", "entries.length", "=", 6)
assert pick(registry, "entries[0].kind") == "catalog", pick(registry, "entries[0].kind")
print("ok", "entries[0].kind", "=", "catalog")
assert pick(registry, "entries[0].name") == "ai.cookwala/reference-catalog", pick(registry, "entries[0].name")
print("ok", "entries[0].name", "=", "ai.cookwala/reference-catalog")
assert pick(registry, "entries[1].kind") == "recipe_collection", pick(registry, "entries[1].kind")
print("ok", "entries[1].kind", "=", "recipe_collection")
assert pick(registry, "entries[2].kind") == "safety_limits", pick(registry, "entries[2].kind")
print("ok", "entries[2].kind", "=", "safety_limits")
assert pick(registry, "entries[3].kind") == "rule_pack", pick(registry, "entries[3].kind")
print("ok", "entries[3].kind", "=", "rule_pack")
assert pick(registry, "entries[4].kind") == "benchmark", pick(registry, "entries[4].kind")
print("ok", "entries[4].kind", "=", "benchmark")
assert pick(registry, "entries[3].status") == "deleted", pick(registry, "entries[3].status")
print("ok", "entries[3].status", "=", "deleted")
assert pick(registry, "entries[5].kind") == "rule_pack", pick(registry, "entries[5].kind")
print("ok", "entries[5].kind", "=", "rule_pack")
assert pick(registry, "entries[5].name") == "ai.cookwala/basic-nutrition-food-safety", pick(registry, "entries[5].name")
print("ok", "entries[5].name", "=", "ai.cookwala/basic-nutrition-food-safety")

# Step 2: The recipe collection the registry points at is the nine the hub serves.
recipes = c.list_recipes()
assert pick(recipes, "recipes.length") == 9, pick(recipes, "recipes.length")
print("ok", "recipes.length", "=", 9)

# Step 3: The registry says it in its own note: pointers only, nothing here is a third-party product.
assert pick(registry, "note") == "Pointers only. Everything listed exists in the amado2k5/cookwala repository; nothing here is a third-party product. Anyone may run a registry (RFC-0002, RFC-0006).", pick(registry, "note")
print("ok", "note", "=", "Pointers only. Everything listed exists in the amado2k5/cookwala repository; nothing here is a third-party product. Anyone may run a registry (RFC-0002, RFC-0006).")

print("scenario complete")

scenarios/017-registry-pointers-only.json

Zurück: 016 Weiter: 018