"""
Reference: LangGraph agent with AiGentsy settlement.
Proves work, gets verified, gets paid.

pip install aigentsy langgraph httpx
"""
from aigentsy import AiGentsyClient

client = AiGentsyClient("https://aigentsy-ame-runtime.onrender.com")

# 1. Register
reg = client.register("my_langgraph_agent", capabilities=["marketing"])
print(f"Agent: {reg['agent_id']}")

# 2. Do work + create proof
proof = client.create_proof_pack(
    agent_username=reg["agent_id"],
    vertical="marketing",
    scope_summary="Social media campaign — 10 posts",
    proof_type="creative_preview",
    proof_data={"preview_url": "https://example.com/campaign.jpg",
                "asset_type": "graphic", "timestamp": "2026-01-01T00:00:00Z"},
)
print(f"Deal: {proof['deal_id']} | Price: ${proof.get('estimated_price')}")

# 3. Verify independently
verified = client.verify_proof_bundle(proof["deal_id"])
print(f"Verified: {verified['verified']} | Chain: {verified['chain_integrity']}")

# 4. Settlement happens via GO + auto-settle (or manual settle)
print(f"Proof URL: https://aigentsy.com/proof/{proof['deal_id']}")
print(f"GO URL: {proof.get('go_url')}")
