<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/four-mechanisms-behind-egp-code-an-ai-powered-landing-page-editor-p0exjkqxt" -->

---
title: Four Mechanisms Behind EGP Code, an AI-Powered Landing...
description: A deep dive into four internal mechanisms powering EGP Code, Mercari&#x27;s AI-driven landing page editor. The post covers: (1) a recursive agent loop where the AI...
canonical: https://daily.dev/posts/four-mechanisms-behind-egp-code-an-ai-powered-landing-page-editor-p0exjkqxt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Four Mechanisms Behind EGP Code, an AI-Powered Landing Page Editor | daily.dev
og:description: A deep dive into four internal mechanisms powering EGP Code, Mercari&#x27;s AI-driven landing page editor. The post covers: (1) a recursive agent loop where the AI...
og:url: https://daily.dev/posts/four-mechanisms-behind-egp-code-an-ai-powered-landing-page-editor-p0exjkqxt
og:image: https://api.daily.dev/og/posts/p0ExjkQxT.png
og:image:alt: Four Mechanisms Behind EGP Code, an AI-Powered Landing Page Editor
og:image:width: 1200
og:image:height: 630
og:locale: en
---

[Mercari Engineering](https://daily.dev/sources/mercari)

[Read post](https://api.daily.dev/r/p0ExjkQxT)

# [Four Mechanisms Behind EGP Code, an AI-Powered Landing Page Editor](https://api.daily.dev/r/p0ExjkQxT "Go to post")

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](/tags/webdev "Check all #webdev posts")[#ai-agents](/tags/ai-agents "Check all #ai-agents posts")[#web-components](/tags/web-components "Check all #web-components posts")[#firestore](/tags/firestore "Check all #firestore posts")

Aug 06•12m read time•From [engineering.mercari.com](https://api.daily.dev/r/p0ExjkQxT "engineering.mercari.com")

[![Post cover image](https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d11bb12e4dfb17c1ffc437630fa2a99?_a=AQAEuop)](https://api.daily.dev/r/p0ExjkQxT "Go to post")

Table of contents

[Mechanism 1: A recursive agent loop that bundles context and tools](https://api.daily.dev/r/p0ExjkQxT "Mechanism 1: A recursive agent loop that bundles context and tools")[Mechanism 2: Real-time sync using Firestore as the handoff point for instructions](https://api.daily.dev/r/p0ExjkQxT "Mechanism 2: Real-time sync using Firestore as the handoff point for instructions")[Mechanism 3: A test runner that runs entirely in the browser](https://api.daily.dev/r/p0ExjkQxT "Mechanism 3: A test runner that runs entirely in the browser")[Mechanism 4: A mapping table linking preview elements to positions in the HTML](https://api.daily.dev/r/p0ExjkQxT "Mechanism 4: A mapping table linking preview elements to positions in the HTML")[Conclusion](https://api.daily.dev/r/p0ExjkQxT "Conclusion")

880 Impressions1 Upvote

Comment

Bookmark

Copy

![Placeholder image for anonymous user](https://media.daily.dev/image/upload/s--qsFuKGv_--/t_logo,f_auto/public/noProfile)Share your thoughtsPost

[![Mercari Engineering's image](https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/cdde515cd83640748689d74c2d938fcf)](https://daily.dev/sources/mercari)

[Mercari Engineering](https://daily.dev/sources/mercari "https://daily.dev/sources/mercari")

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

32 Followers

•

371 Upvotes

#### Would you recommend this post?

Copy link

WhatsApp

Facebook

X

New Squad

Copy linkShare with your friends

1

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Four Mechanisms Behind EGP Code, an AI-Powered Landing Page Editor","url":"https://daily.dev/posts/four-mechanisms-behind-egp-code-an-ai-powered-landing-page-editor-p0exjkqxt","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/four-mechanisms-behind-egp-code-an-ai-powered-landing-page-editor-p0exjkqxt"},"datePublished":"2026-08-06T00:15:51.002Z","dateModified":"2026-08-06T02:58:29.228Z","description":"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...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d11bb12e4dfb17c1ffc437630fa2a99?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d11bb12e4dfb17c1ffc437630fa2a99?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Mercari Engineering","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Mercari Engineering","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/cdde515cd83640748689d74c2d938fcf","url":"https://daily.dev/sources/mercari"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/four-mechanisms-behind-egp-code-an-ai-powered-landing-page-editor-p0exjkqxt","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,ai-agents,web-components,firestore","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Mercari Engineering","item":"https://daily.dev/sources/mercari"},{"@type":"ListItem","position":3,"name":"Four Mechanisms Behind EGP Code, an AI-Powered Landing Page Editor"}]}
```

