""" ACO Academy Benchmark Tool - HuggingFace Space Agent Commerce Optimization Demo No secrets or API keys in this code - all external configuration. """ import gradio as gr import os from datetime import datetime # Configuration (set via HF Space secrets/environment) ACO_API_BASE = os.getenv("ACO_API_BASE", "https://agenticcommerce.academy/api") STRIPE_CHECKOUT_BASE = os.getenv("STRIPE_CHECKOUT_BASE", "https://agenticcommerce.academy/benchmark") # Showcase examples (pre-generated reports) SHOWCASE_EXAMPLES = { "amazon.com": { "grade": "F", "score": "49/100", "pdf": "reports/amazon_benchmark.pdf", "summary": "Zero ACO implementation. AI agents cannot discover Amazon's APIs." }, "x.com": { "grade": "D", "score": "65/100", "pdf": "reports/x_benchmark.pdf", "summary": "Partial ACO support. Has agent.json and MCP, but missing structured data." }, "shopify.com": { "grade": "F", "score": "57/100", "pdf": "reports/shopify_benchmark.pdf", "summary": "Poor overall score despite perfect SEO. Weak ACO (40/100) and security (35/100)." }, "agenticcommerce.academy": { "grade": "D", "score": "61/100", "pdf": "reports/agenticcommerce_benchmark.pdf", "summary": "We practice what we preach - and we're still improving. Perfect SEO, moderate ACO." } } def get_showcase_report(domain): """Return pre-generated showcase report""" if domain not in SHOWCASE_EXAMPLES: return None, "Select a domain to view the report" example = SHOWCASE_EXAMPLES[domain] summary = f""" # {domain} - Grade {example['grade']} ({example['score']}) **{example['summary']}** šŸ“„ **Download the full 4-page PDF report below** This is a complete ACO benchmark including: - SEO Analysis - ACO Implementation Check - Security Scan - Consent Audit - CEH-RI Risk Assessment - Prioritized Recommendations """ return example['pdf'], summary def scan_domain_preview(domain): """ Preview scan - basic ACO check only NOTE: This is a MOCK for demo purposes. Real implementation calls ACO_API_BASE + /preview endpoint """ if not domain or len(domain) < 4: return "āš ļø Please enter a valid domain (e.g., example.com)" # Clean domain domain = domain.strip().lower().replace("https://", "").replace("http://", "").split("/")[0] # Mock preview result (replace with actual API call) # In production: response = requests.post(f"{ACO_API_BASE}/preview", json={"domain": domain}) preview = f""" ## šŸ” ACO Preview Report: {domain} ### Estimated Grade: F (35/100) **Quick Findings:** āŒ **No agent.json detected** - AI agents cannot discover your capabilities āŒ **No MCP manifest found** - No Model Context Protocol support āŒ **No llms.txt present** - AI crawlers have no guidance āš ļø **Basic SEO present** but not optimized for agents āš ļø **Security headers incomplete** - Missing modern protections --- ### āš ļø Your site is invisible to AI agents As AI-driven commerce becomes mainstream, sites without ACO will be excluded from agent transactions. --- ### šŸ“Š What's in the Full Report? āœ… **Complete 6-category analysis** (20+ checks across SEO, ACO, Security, Consent, CEH-RI) āœ… **Cognitive Event Horizon Risk Index** - Detect manipulation patterns āœ… **Detailed security & consent audit** - GDPR, CCPA, ACO compliance āœ… **Prioritized action plan** - Step-by-step fixes with impact scores āœ… **4-page downloadable PDF** - Professional report for your team āœ… **Industry benchmarks** - See how you compare --- ### šŸ”„ Ready to see the full picture? **One-time analysis: $99** Complete ACO benchmark delivered instantly. """ return preview def get_upgrade_link(domain): """Generate Stripe checkout link for full report""" if not domain or len(domain) < 4: return "āš ļø Please enter a domain first" domain = domain.strip().lower().replace("https://", "").replace("http://", "").split("/")[0] # Construct checkout URL (no secrets - just URL params) checkout_url = f"{STRIPE_CHECKOUT_BASE}?domain={domain}&product=aco-benchmark&price=99" return f""" ## šŸš€ Upgrade to Full Report **Domain:** {domain} **Price:** $99 (one-time) **[Click here to complete checkout]({checkout_url})** You'll receive: - Full 4-page PDF benchmark report - Detailed findings across all 6 categories - Prioritized recommendations - Access to your ACO Academy dashboard Secure payment processed via Stripe. """ # Build Gradio interface with gr.Blocks( theme=gr.themes.Soft( primary_hue="blue", secondary_hue="purple" ), title="ACO Academy | The SEO of the AI Era", css=""" .gradio-container {max-width: 1200px !important} .gr-button-primary {background: linear-gradient(90deg, #3B5EE9 0%, #9333EA 100%)} """ ) as demo: gr.Markdown(""" # ACO Academy Benchmark Tool ## The SEO of the AI Era **Is Your Site Ready for AI Agents?** Get a comprehensive benchmark of your site's Agent Commerce Optimization score. Find out what AI shopping agents see when they evaluate your site. """) # TAB 1: Showcase Examples with gr.Tab("šŸ” Showcase Examples"): gr.Markdown(""" ## See How Major Sites Score on ACO Readiness We've benchmarked popular platforms to show the **range** of ACO implementation. Download full PDF reports to see what you'll receive. """) showcase_dropdown = gr.Dropdown( choices=list(SHOWCASE_EXAMPLES.keys()), label="Select a site to view full report", value="amazon.com" ) showcase_btn = gr.Button("šŸ“„ View Report", variant="primary") showcase_summary = gr.Markdown() showcase_output = gr.File(label="Download PDF Report") showcase_btn.click( fn=get_showcase_report, inputs=[showcase_dropdown], outputs=[showcase_output, showcase_summary] ) # TAB 2: Check Your Site with gr.Tab("šŸ†“ Check Your Site"): gr.Markdown(""" ## Free Preview Scan Get a **basic ACO check** for any domain - see your estimated grade instantly. āš ļø **Preview includes:** ACO component detection only šŸ”„ **Full report includes:** SEO, Security, Consent, CEH-RI, and 20+ recommendations """) with gr.Row(): preview_input = gr.Textbox( label="Enter your domain", placeholder="example.com", scale=3 ) preview_btn = gr.Button("šŸ”Ž Scan Now (Free)", variant="secondary", scale=1) preview_output = gr.Markdown() gr.Markdown("---") upgrade_btn = gr.Button("šŸ”„ Get Full Report ($99)", variant="primary", size="lg") upgrade_output = gr.Markdown() preview_btn.click( fn=scan_domain_preview, inputs=[preview_input], outputs=[preview_output] ) upgrade_btn.click( fn=get_upgrade_link, inputs=[preview_input], outputs=[upgrade_output] ) # TAB 3: About ACO with gr.Tab("šŸ“š About ACO"): gr.Markdown(""" ## What's Included in Your Benchmark **A comprehensive 6-point analysis covering every aspect of agent commerce optimization** ### šŸ“Š What We Analyze ### šŸ” SEO Analysis SSL, robots.txt, sitemap, meta tags, and traditional search optimization factors. ### šŸ¤– ACO Analysis Agent card, MCP manifest, llms.txt, structured data, and AI agent discoverability. ### šŸ”’ Security Scan Security headers, rate limiting, sybil protection, and human escalation paths. ### āœ… Consent Audit GDPR, CCPA, and ACO consent compliance. Informed, voluntary, and fiduciary analysis. ### 🧠 CEH-RI Analysis Cognitive Event Horizon Risk Index across 6 dimensions of agent decision-making. ### šŸ“‹ Pathology Report Perception asymmetry, epistemic ambiguity, trust exhaustion risk assessment. --- ## What You Get āœ… Overall ACO Grade (A+ to F) āœ… Detailed score breakdown āœ… 6-dimension CEH-RI analysis āœ… Vulnerability detection āœ… Compliance status (GDPR, CCPA, ACO) āœ… Prioritized recommendations āœ… Instant results (no waiting) āœ… Downloadable PDF report āœ… Compare against best practices āœ… Actionable improvement steps --- ## ONE-TIME ANALYSIS: $99 Complete 6-point benchmark analysis with instant results: - SEO + ACO + Security + Consent + CEH-RI + Pathology - Prioritized action items - PDF report download - Results saved for future reference - Secure payment via Stripe --- ### šŸ”— Powered by SmartLedger ACO Academy is built on the **SmartLedger ecosystem**: - **E² Identity** - Verifiable credentials for agent authentication - **BLS Explorer** - Transparent blockchain audit trails - **SNTNL Network** - Decentralized trust infrastructure **[Learn more at agenticcommerce.academy →](https://agenticcommerce.academy)** """) gr.Markdown(""" --- **ACO Academy - The SEO of the AI Era** | [Run Full Benchmark ($99)](https://agenticcommerce.academy/benchmark) | Powered by [SmartLedger Solutions](https://smartledger.solutions) """) # Launch configuration for HuggingFace Docker Space if __name__ == "__main__": demo.launch( server_name="0.0.0.0", server_port=7860 )