Inspiration

Local business websites leak leads every day. Small business owners excel at their craft—whether that’s running a barbershop or a bakery—but they rarely have the time, budget, or technical expertise to continuously optimize their web copy, refine their SEO, or fix broken CTAs. We realized that while large enterprises use sophisticated A/B testing and growth teams, local businesses are left behind.

We were inspired to build LoopWeb: an autonomous B2B intelligence layer that attaches to existing local business websites, audits them for growth opportunities, and deploys fixes directly through standard APIs (like WordPress). We wanted to build a system that acts not just as an auditor, but as an autonomous, self-improving engineer.

What it does

LoopWeb is a fully autonomous optimization pipeline:

Observe: It scrapes the dynamic DOM of a target business (we used a real barbershop, Base44, as our pilot). Reason: Using Qwen-Max via Alibaba Cloud, it identifies specific, actionable opportunities to improve conversions (e.g., standardizing CTAs, adding SEO keywords to H1 tags). Execute: After a human approves the generated brief, LoopWeb deploys the optimized code directly to the business's CMS via the WordPress REST API. But the defining feature of LoopWeb is its Adaptive Agent Kernel (AAK). If a deployment fails (for example, Qwen hallucinates an unclosed HTML tag that the WordPress API rejects), the AAK intercepts the trace, asks Qwen to hypothesize the root cause of its own failure, and dynamically writes a new prompt constraint. The system self-corrects and prevents that error from ever happening again.

How we built it

LoopWeb consists of a robust Python pipeline leveraging Qwen Cloud and Alibaba Cloud:

Scraping Engine: Built with asynchronous Playwright and BeautifulSoup4 to ensure we capture the fully rendered, dynamic DOM of the target business. Agent Layer: We integrated the Qwen-Max model via the dashscope-intl API. Qwen handles the complex reasoning required to output strict JSON execution plans mapping "Before" text to high-converting "After" text. Deployment Adapters: We engineered an abstract adapter interface, backed by a real_wp_adapter that uses Application Passwords to push changes to live WordPress sandbox endpoints. The Adaptive Agent Kernel (AAK): The observation bus and rule engine. We built this using SQLAlchemy and asyncpg connected to an Alibaba Cloud ApsaraDB RDS PostgreSQL instance. We track the effectiveness of dynamically generated rules using a historical success rate metric within the AAK: Rule Effectiveness ( E

)

N success + α N total + β Rule Effectiveness(E)= N total ​ +β N success ​ +α ​ Where N success N success ​ is the number of successful deployments under the rule, N total N total ​ is the total deployments, and α , β α,β are Laplace smoothing parameters to handle new rules with low sample sizes.

Challenges we ran into

Enforcing Strict Outputs: Early on, getting Qwen to output strictly formatted JSON without wrapping it in markdown code blocks or omitting keys was challenging. We solved this by strictly defining the schema in the system prompt and explicitly including the word "JSON" to trigger the {"type": "json_object"} response format constraint correctly. API Key Routing: We initially faced 401 Unauthorized errors because we were trying to route our international Qwen Cloud keys (home.qwencloud.com) through the domestic Chinese endpoints. Rerouting the base URL to dashscope-intl.aliyuncs.com/compatible-mode/v1 instantly solved the issue. The "Demo-Grade" Mock Adapter: During testing, we wanted to ensure the AAK could catch malformed HTML. Our initial mock API check merely counted if < equaled >. It took several iterations of our "intentional failure" injection to actually trigger the AAK learning loop properly!

Accomplishments that we're proud of

We are immensely proud of successfully building a self-healing intelligence loop. Watching the Adaptive Agent Kernel intentionally fail a deployment, pass that failure trace back to Qwen-Max, and watch Qwen successfully diagnose its own mistake ("The HTML content provided for deployment contained an unclosed tag") to generate a permanent global constraint rule was a massive "Aha!" moment. It proved that agents can manage their own context evolution.

What we learned

We learned how deeply capable Qwen-Max is at structured data extraction and self-reflection. When provided with a stack trace of its own failure, its ability to formulate an accurate hypothesis and corrective action is genuinely state-of-the-art. We reinforced our understanding that an LLM is only as good as the tools and constraints built around it. Building the AAK taught us that agentic architectures need "memory of failures" just as much as they need execution tools.

What's next for LoopWeb

Moving from prototype to production, the next steps are clear:

Real HTML DOM Validation: We plan to upgrade our deployment adapters to include strict DOM-tree validation using lxml before any payload hits the external APIs. Human-in-the-Loop Rule Approval: Currently, the AAK promotes new constraints automatically. We want to implement a dashboard where senior engineers can review and edit Qwen's hypothesized rules before they are injected into the active prompt payload. Multi-CMS Support: Expanding our adapters beyond WordPress to Shopify, Webflow, and SquareSpace to service a broader array of local businesses.

Built With

Share this project:

Updates