autosource / scripts /export_cards.py
Shanmuk4622's picture
deploy fully live isolated AutoSource demo
924a755 verified
Raw
History Blame Contribute Delete
2.58 kB
"""Export all five Agent Cards to protocols/a2a_cards/ (plan §7.2).
Run: python -m scripts.export_cards
"""
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from core.a2a_layer import export_card, make_card # noqa: E402
from core.config import PROJECT_ROOT, settings # noqa: E402
CARDS_DIR = PROJECT_ROOT / "protocols" / "a2a_cards"
PORTS = settings()["ports"]
CARDS = [
("auditor", make_card(
name="AuditorAgent",
description="Monitors warehouse stock over MCP and emits procurement requests",
port=PORTS["auditor"],
skills=[{"id": "detect_shortage", "name": "Detect stock shortage",
"description": "scan inventory below reorder point and raise a ProcurementRequest",
"tags": ["inventory", "mcp"]}])),
("sourcing", make_card(
name="SourcingAgent",
description="Shortlists vendors for a procurement request",
port=PORTS["sourcing"],
skills=[{"id": "shortlist_vendors", "name": "Shortlist vendors",
"description": "rank top-3 vendors for a SKU",
"tags": ["procurement", "sourcing"]}])),
("buyer", make_card(
name="BuyerAgent",
description="Negotiates unit price against a hidden budget ceiling",
port=PORTS["buyer"], streaming=True,
skills=[{"id": "negotiate_price", "name": "Negotiate price",
"description": "multi-turn settle-or-walk negotiation with a vendor",
"tags": ["negotiation"]}])),
("vendor", make_card(
name="VendorAgent",
description="Adversarial sales counterparty with a hidden cost floor and persona",
port=PORTS["vendor_a"], streaming=True,
skills=[{"id": "counter_offer", "name": "Counter offer",
"description": "respond to buyer offers per persona above a hidden floor",
"tags": ["negotiation", "sales"]}])),
("settlement", make_card(
name="SettlementAgent",
description="Selects the winning deal, builds AP2 mandates, gates on human approval",
port=PORTS["ui"],
skills=[{"id": "settle_purchase", "name": "Settle purchase",
"description": "compare deals, assemble Intent/Cart/Payment mandates, write PO on approval",
"tags": ["ap2", "human-in-the-loop"]}])),
]
if __name__ == "__main__":
for name, card in CARDS:
export_card(card, CARDS_DIR / f"{name}.json")
print(f"exported {name}.json")