Wyrd docs v0.2.0 Reference GitHub

Status: Runnable

Declare and inspect a Service

Registering the Service registers every Card it references, dependencies first, and creates its tables. The server then records which Card references which, so you can read the graph back from any Card.

Declare

From the CLI:

bash
wyrd declare examples/support-desk-app/service/support-desk.yaml

It prints declared: and the Service’s reference, then one line per Card with its outcome and status:

text
declared: default/Service/support-desk@1.0.0#<uid>
  default/Prompt/support-prompt@1.0.0#<uid>: declared (active)
  ...
Unverified
The line format is derived from the CLI source. A captured run replaces it on the first verified run.

From code, declare_from_path does the same and returns the receipt. The example’s deploy step then downloads what it declared:

deploy.py python
cards = Cards(client)
receipt = cards.declare_from_path(SERVICE / "support-desk.yaml")
cards.pull(receipt.root, BUNDLE)
Gateway(client).put_capture_policy({"mode": "metadata", "payload_fields": []})
print(f"declared {receipt.root} into {BUNDLE.name}")

receipt.root is the Service’s exact reference, and receipt.outcomes lists every Card with its outcome:

OutcomeMeans
declaredA new version was stored
idempotent_noopThat exact version is already declared with the same content
deduplicatedThe Card has no exact version, and the latest one in its line has the same content

Declaring is safe to rerun: unchanged Cards come back idempotent_noop. If the loader finds any error, nothing is sent.

Inspect

List what is declared:

bash
wyrd list --kind Service

Fetch one Card with the relationships the server derived. You never write relationships; the server reads every reference in each spec and records the edge both ways:

python
from wyrd.cards import CardRef, Cards

card = Cards().get(CardRef("Service", "support-desk", "1.0.0", space="default"))
for edge in card.relationships["outbound_refs"]:
    print(edge.get("alias"), edge["ref"])

outbound_refs lists every Card this one references, with the component alias where there is one. inbound_refs lists every Card that references it, so fetching support-prompt shows both the Agent and the Service that use it. status.phase is the Card’s lifecycle state, such as active.

To download the Service and everything it references into a directory, as the app does at deploy time:

bash
wyrd pull --kind Service --space default --name support-desk --version 1.0.0 --output-dir .wyrd-bundle

Change a Card

An exact version is immutable. To change support-prompt, give it a new version, update the reference to it in support-agent.yaml, and bump the Agent and the Service the same way. Register again, and the new Service version records the new Prompt while the old one still names the old Prompt. That is what keeps an old verdict reproducible.

Leave version out of a Card instead, and the server picks one: 0.1.0 first, then the next patch whenever the content changes. That suits Cards you iterate on; we recommend exact versions for anything a Service pins.

If it fails

You seeCauseFix
WYRD_REGISTRY_409_SPEC_DRIFTAn exact version is already declared with different contentBump the Card’s version
WYRD_REGISTRY_422_UNRESOLVED_DEPENDENCYA ref names a declared Card that doesn’t existDeclare that Card first, or fix the reference
WYRD_VALA_409_BIFROST_FINGERPRINT_MISMATCHA table in spec.tables already exists with different columnsKeep the existing schema, or use a new table name
WYRD_PERMISSION_403_DENIED_RBACYour credential lacks cards:writeUse a credential that can declare Cards
WYRD_LOADER_400_INVALID_ENVELOPEA file failed local validation; nothing was sentRun wyrd declare --check and fix the file it names

Next

Record a run and observations against the declared Service.

Last updated