# Shopify explains Reflex, a way for agents to verify native mobile app behavior

> Original title: Shopify Reflex：让 AI 不靠模拟器，也能验证原生 App 的行为

- Source: meng shao
- Published: 2026-11-06T08:31:13.000Z
- Bad Influence: https://badinfluence.news/items/nkcd6qo47n1pl9l9qv2jr0ptf
- Original: https://x.com/shao__meng/status/2118622217525416174

## Summary

Shopify Engineering describes Reflex, an architecture that separates business logic from the UI so agents can read state, run actions, and verify results from the command line without simulators. iOS and Android stay native but share behavior tests, with over 1,700 tests finishing in about 4 minutes in CI. Shopify says Reflex does not verify pixels or confirm buttons are wired correctly, and it is not yet an installable open-source library.

## Post

Shopify Reflex：让 AI 不靠模拟器，也能验证原生 App 的行为

来自 Shopify Engineering 博客，Reflex 是 Shopify 为 AI 编程设计的移动应用架构：把业务逻辑与界面分开，让 Agent 通过命令行直接读取状态、执行操作和验证结果。iOS、Android 仍分别写原生代码，但共享行为测试。

# 瓶颈从写代码变成验证

Agent 几分钟就能写出一个页面，但验证仍要启动模拟器、构建应用、模拟点击。Shopify 即使改进了模拟器工具，也碰到了速度上限。

Reflex 的思路不是继续加速点击，而是让应用本身提供一种不启动界面也能运行和检查的方式。

# 核心机制：直接操作界面背后的状态

应用核心层不依赖界面和设备，可以直接在 macOS 或 JVM 上运行。每个页面的 ViewModel（管理页面状态和操作的组件）都暴露统一接口：当前状态、可执行动作，以及子组件。

Agent 通过命令行发送动作，再读取 JSON 状态，验证业务逻辑、输入校验、导航和错误处理。它运行的是真实业务代码，而不是另一套模拟实现；网络等外部依赖则用预设数据替代，行为测试还会强制阻止真实 HTTP 请求。

关键原则是 “共享测试，而不是共享代码”：Swift 和 Kotlin 各自实现，同一份行为测试在两端运行，两边都通过才能合入。这样既保留原生实现，也用测试约束双端行为一致。

# 效果与边界

Shopify 报告，超过 1,700 条行为测试在持续集成环境中双端约 4 分钟跑完。文中示例在预热后，无设备运行只需几百毫秒，同一测试在 iOS 模拟器上约需 2 秒。

但它不验证像素，也不能证明界面按钮正确连接到了对应操作。视觉检查仍靠设计系统对照、少量截图测试和实际使用。Reflex 目前也不是可直接安装的开源库，团队需要自行实现这套架构和适配层。

![](https://badinfluence.news/api/img-proxy?u=https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FHWbbrLAbAAEsrLD.jpg&mode=thumb&exp=1794182400&sig=ae113a49a73e6d7a)

## Quoted post @ShopifyEng

> We rebuilt our mobile apps in Swift and Kotlin with agents. To keep pace and hold our quality bar, we built Reflex: an agentic-first architecture that lets agents build and verify app behavior across iOS and Android without needing devices or simulators.
> 
> Here's how it works, piece by piece:
> http://shopify.engineering/reflex

https://x.com/ShopifyEng/status/2118369291711975654
