Mercari Engineering
Read post

Four Mechanisms Behind EGP Code, an AI-Powered Landing Page Editor

A deep dive into four internal mechanisms powering EGP Code, Mercari's AI-driven landing page editor. The post covers: (1) a recursive agent loop where the AI reasons, calls tools, and self-corrects on errors; (2) real-time sync using Firestore so users see live progress without WebSockets; (3) a browser-native test runner built on @vitest/expect and Testing Library that runs inside an iframe; and (4) a mapping table using injected data-egp-src-id attributes to link rendered preview elements back to their positions in the HTML source, enabling Monaco editor jumps and precise AI instructions. The article also details real-time steering — injecting mid-flight instructions into an already-running agent loop — and how Zero Data Retention requirements led to self-managed conversation history.

    #webdev#ai-agents#web-components#firestore
Yesterday•12m read time•From engineering.mercari.com
Post cover image
Table of contents
Mechanism 1: A recursive agent loop that bundles context and toolsMechanism 2: Real-time sync using Firestore as the handoff point for instructionsMechanism 3: A test runner that runs entirely in the browserMechanism 4: A mapping table linking preview elements to positions in the HTMLConclusion
168 Impressions
Mercari Engineering's image
Mercari Engineering

Mercari's platform is a resource for developers and technology enthusiasts, offering insights into e...

29 Followers

•

368 Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard