Meta 如何以 AI 原生工程打造 Forum
原题How Meta Built Forum With AI-Native Engineering
读前速览
Meta 分享了一支小团队如何通过从 human-in-the-loop 转向 human-on-the-loop 的智能体工程来构建 Forum 应用,其中验证而非代码量定义了成功。
从 human-in-the-loop 到 human-on-the-loop 的转变,将工程师的角色从执行步骤重新定义为对结果和质量负责。
在 human-on-the-loop 模式下,智能体运行完整的规划-实现-构建-测试-修正循环,而工程师设定目标、监控偏差并批准结果。这使得循环可以重叠,并将工程师的时间引导至方向把控和判断,而非坐等每次迭代完成。
验证而非编译才是完成的标尺,智能体循环内的自动化通过/失败信号是关键的力量倍增器。
只有当自动化测试和视觉检查通过后,任务才算完成。构建状态、单元测试和 UI 规格匹配被直接集成到智能体循环中,生成带有预填测试计划和录制验证会话的可审查拉取请求,从而减少生成的代码量,也减少被丢弃的代码。
为智能体调整代码库和工具带来的收益大于提示词工程。
团队优先考虑架构可读性,将关键部分模块化,并在复用会拖慢智能体时进行重构。为智能体提供读取实时视图层级和查找目标视图的工具,大幅减少了误导向的编辑,而仅靠描述应用则会导致编辑错误屏幕等失败。
独立的构建变体将 AI 原型与生产环境隔离,同时共享同一代码库和设计系统。
通过插件/套接字架构,原型代码被完全排除在生产构建之外,因此设计师和合作伙伴可以自由制作原型而无需为每次变更配备工程师,沙盒工作可直接移植到生产环境,且任何原型代码都不会导致生产应用崩溃。
智能体通过可重复的压力场景成为测试者,在发布前捕获了一个内存问题。
模拟激进滚动、随机浏览和快速导航的常规压力运行产生了崩溃和内存增长等一致信号。一个智能体隔离了复现步骤,提出了修复方案,并在开发期间进行了验证,将内存使用和页面错误大约减半。
完整摘要
Meta 的工程博客详细介绍了小团队如何构建 Forum——一款独立的 Facebook Groups 应用——其核心思路是将 AI 智能体视为工程流程中的参与者,而非自动补全工具。关键转变是从 human-in-the-loop(工程师驱动每一步)转向 human-on-the-loop(智能体运行规划-实现-构建-测试-修正循环,工程师设定目标、监督并批准结果)。成功以经过验证、可投入生产的变更来衡量,而非代码量。团队构建了由规则、技能、智能体、命令和钩子组成的操作模型,调整代码库以提升智能体可读性,为智能体提供检查应用状态的工具而非仅靠描述,并创建了独立的构建变体以隔离原型与生产环境。智能体还运行了压力测试,发现了一个内存问题并在发布前修复。Forum 在八周内达到了与 Facebook Groups 的核心功能对等,不过文章也承认某些阶段仍需工程师参与每次迭代。
目录 · 8 节
- Meta 的最新应用 Forum 面向所有想要深入参与 Facebook 群组讨论的人。Meta’s newest app, Forum, is for anyone who wants to go deeper into the conversations in their Facebook groups.
- 为了构建 Forum,Meta 工程师将 AI 智能体引入开发周期,采用了一种全新的工作方式。To build Forum, Meta engineers adopted a whole new way of working by bringing an AI agent into the development cycle.
- 我们将分享使用智能体 AI 构建 Forum 所需的经验:我们如何调整代码库、测试用于智能体执行的框架和内部工具,以及哪些做法奏效、哪些没有。We’re sharing insights into what it took to build Forum with agentic AI: how we adapted the codebase, tested frameworks and internal tooling for agentic execution, what worked, and what didn’t.
Forum 是一款独立的 Groups 应用,由一个小团队从零开始打造。我们也在这里尝试了一种不同的工作方式:将 AI 智能体视为工程流程中的参与者,而不是更快的打字工具。Forum is a standalone Groups app that a small team built from scratch. It’s also where we tested a different way of working: treating an AI agent as a participant in the engineering process rather than a faster way to type.
这项实验需要一个成功的定义,而我们的标准并不是代码量。我们衡量的是经过验证、可用于生产环境的成果——也就是能够成功构建、通过测试并经得起评审的改动。That experiment needed a definition of success, and ours wasn’t code volume. We measured verified, production-ready outcomes — changes that build, pass tests, and survive review.
从人在回路中到人在回路上From Human-In-The-Loop to Human-On-The-Loop
仅仅让 AI 负责编码这一步,改变并不大。随着我们将这种方法扩展到实现前后的各个阶段——规划、构建、测试和验证——成果不断累积。要看清这种转变,最直观的方式是看看每个步骤由谁负责。Pointing AI at the coding step alone doesn’t change much. Our results compounded as we extended the approach to the stages around implementation — planning, building, testing, and verification. The clearest way to see the shift is in who owns each step.
采用人在回路的方式时,工程师主导每一步,AI 则在过程中提供辅助,例如自动补全函数、建议修复方案或回答问题。每次迭代都按照主导者的节奏推进。With human-in-the-loop, the engineer drives every step and the AI assists inside it by autocompleting a function, suggesting a fix, or answering a question. Each iteration advances at the pace of the person driving it.
在人类监督环路模式下,智能体自行运行整个迭代流程——规划、实现、构建、测试、修正、重复;工程师则设定目标、观察运行情况、在流程偏离时介入,并批准结果。人的职责从执行各个步骤转变为对结果负责并把守质量标准。这是我们正在努力实现的目标,而非已经完成的状态:如今有些阶段已能自主运行,另一些阶段的每次迭代仍需要工程师参与。With human-on-the-loop, the agent runs the iteration itself — plan, implement, build, test, correct, repeat — while the engineer sets the goal, watches the run, steps in when it drifts, and approves the result. The person’s job moves from executing the steps to owning the outcome and holding the quality bar. This is the target we are driving toward, not a finished state: some stages run autonomously today, while others still keep an engineer in each iteration.
当工程师负责监督时,工作就不再严格按顺序进行。过去一次只能运行一个的循环现在可以彼此重叠,工程师也能把时间花在指导和判断上,而不必一直盯着整个流程。但这只有在返回的结果值得信赖时才成立。缺乏验证时,AI 生成的代码会带来一个熟悉的问题:输出看起来似乎可行,却没人确认它确实能运行,于是工程师不得不阅读、调试,往往还要将其弃用。薄弱的信号并不能消除瓶颈,只是把瓶颈从编写代码转移到审查那些看似完成、实则未完成的代码上。When the engineer supervises, work stops being strictly sequential. Cycles that used to run one at a time can overlap, and an engineer’s time goes to direction and judgment rather than to sitting through the loop. But that only holds if what comes back can be trusted. Without verification, AI-generated code creates a familiar problem — plausible output that no one has confirmed actually works, which an engineer then has to read, debug, and often discard. Weak signals don’t remove the constraint; they move it from writing code to reviewing code that looks finished and isn’t.
因此,我们将门槛设在验证,而非编译。编译并非终点——只有自动化测试和视觉检查都通过后,任务才算完成。工程师审阅之前,智能体会先检查自己的工作,这意味着提交审查的成果数量更少、可信度更高,而不是一大堆需要筛选的输出。生成的内容更少,被舍弃的也更少。每项交付成果仍须经过工程师签字确认;我们所做的努力,是让这一确认过程更快速、更有依据,并将构建结果、测试结果和录制的验证过程附在变更中。So we set the bar at verification rather than compilation. Compiling isn’t the finish line — a task is complete only once automated tests and visual checks have passed. Agents check their own work before an engineer sees it, which means what reaches review is a smaller set of higher-confidence results rather than a pile of output to sift through. Less gets generated, and less gets discarded. Every shipped outcome still carries an engineer’s sign-off; our effort went into making that sign-off fast and well-evidenced, with build results, test outcomes, and recorded verification sessions attached to the change.
由于工程师不在每个周期内参与,循环必须能够独立安全地运行。四项能力使这成为可能:With the engineer outside of every cycle, the loop has to run safely on its own. Four capabilities make that possible:
将规划视为技术规范:智能体式执行要求极高的精确度。工程师或许能凭直觉消除的歧义,却会导致智能体执行失败。我们投入大量精力进行严谨的前期拆解,并提供机器可读的上下文,从而让工程师和智能体的工程迭代闭环都更加紧密。Planning as technical specification: Agentic execution requires extreme precision. Ambiguity that an engineer might resolve through intuition results in agent failure. We invested in rigorous upstream decomposition and machine-readable context, which tightened the engineering loop for engineers and agents alike.
循环内的自动化验证是关键的倍增器:我们将自动化的通过/失败信号——构建状态、单元测试和 UI 规格匹配——直接集成到智能体循环中。这使异步开发成为可能,能够产出可供审查的拉取请求,并预先填好测试计划、附上记录的验证会话。验证是最难做好的一环,而我们能安全地将多少工作交给循环处理,取决于我们对验证器的信任程度。Automated verification inside the loop is the force multiplier: We integrated automated pass/fail signals — build status, unit tests, and UI spec matching — directly into the agent loop. This enabled asynchronous development producing ready-to-review pull requests with pre-populated test plans and recorded verification sessions. Verification is the hard part to get right, and how much we can safely hand to the loop is gated by how much we can trust the verifiers.
使用智能体进行模拟用户测试:我们部署了导航智能体,让它们像真人一样与线上应用交互。这些智能体会执行操作、读取屏幕并报告回归问题。导航智能体能够持续运行相同的验证流程。Simulated user testing with agents: We deployed navigation agents that interact with the live app exactly like a person would. These agents perform actions, read the screen, and report regressions. Navigation agents are able to run the same verification paths continuously.
智能体生产运维:上线后,智能体会帮助自动执行根因分析。当 Forum 用户提交反馈时,智能体会利用这些反馈调查可能出现的回归问题。随后,智能体会将分析结果转交给工程师,由他们决定下一步行动。Agentic production operations: After launch, agents help automate root-cause analysis. When someone using Forum submits feedback, the agents use that feedback to investigate possible regressions. The agents then forward the analysis to engineers who decide the next course of action.
运营模式The Operating Model
这种所有权模型需要由五个关键组件构成的机制:That ownership model needs machinery with five key components:
- 规则是永久性的项目指令。当智能体重复犯错超过两次时,我们会将纠正方法记录一次,供所有人使用。Rules are permanent project instructions. When the agent repeats a mistake more than twice, we encode the correction once, for everyone.
- 技能将团队约定转化为可加载的步骤,供智能体调用。Skills turn team conventions into loadable steps the agent can invoke.
- 智能体自动执行以往需要人工检查的任务。Agents automate checks that previously required a manual pass.
- 命令将技能和代理串联成工作流。它们会评估问题的复杂程度、复现缺陷、规划并实施修复、创建拉取请求,并开展多阶段审查。Commands chain skills and agents into workflows. They assess complexity, reproduce a bug, plan and implement a fix, create the pull request, and run a multi-stage review.
- Hooks 是自动化触发器,例如在代理每轮操作后运行代码检查器、安装前检查模拟器连接状态,以及创建拉取请求前验证测试。Hooks are automated triggers, such as running a linter after every agent turn, checking simulator connectivity before install, and validating tests before a pull request is created.
使环境适应模型Adapting the Environment to the Models
最大的提升来自对代码和工具链的改进,而不是对提示词的调整。The biggest gains came from changing our code and tooling, not our prompts.
架构清晰易懂,胜过沿袭复杂性:我们努力让 Forum 的代码库尽可能直观,并选择将架构中的关键部分模块化,以便利用经受过实战考验的基础设施,同时让智能体能够轻松即插即用。对于难以轻松实现模块化的部分,我们选择从头重建,以复用性换取智能体的执行吞吐量;事实证明,这让开发速度大幅提升。智能体会从所读代码中学习模式。只需修复一次薄弱模式,之后每次智能体会话都能继承这一改进;若放任不管,同样的捷径就会出现在智能体接下来编写的所有内容中。Architectural legibility over inherited complexity: We worked to keep Forum’s codebase as straightforward as possible and chose to modularize key pieces of the architecture in order to get the benefits of battle-tested infrastructure while also letting the agents plug and play easily. Where we couldn’t easily do so, we rebuilt from scratch, trading reuse for agentic throughput, and it proved rewarding in development speed. Agents learn patterns from the code they read. Fix a weak pattern once and every future agent session inherits the improvement; leave it and the same shortcut shows up in everything the agent writes next.
给智能体提供工具,而不是描述:我们遇到的主要问题是,智能体会搞不清自己在应用中的位置——比如被要求修改群组首页,却去编辑主信息流,或者凭猜测点击屏幕坐标。因此,我们没有向智能体描述应用,而是给它提供了检查工具:在采取任何操作之前,从模拟器读取实时视图层级、列出屏幕上实际显示的元素,并查找目标视图的路径。误操作的编辑大幅减少。凡是智能体需要与我们的系统交互,我们都采用了同样的方法:让智能体能够直接检查状态,而不是只给它一段描述供其推断。Give agents tools, not descriptions: Our main failure mode was the agent losing track of where it was in the app — editing the home feed when asked to change the group home screen, or guessing at screen coordinates. So instead of describing the app to the agent, we gave it tools to check: read the live view hierarchy from the simulator, list the elements actually on screen, and look up the path to a target view — all before it acts. Misdirected edits dropped sharply. We applied the same approach wherever agents touched our systems: give the agent a way to check state directly rather than a description to reason from.
构建级隔离,保障 AI 原型开发安全:随着 Forum 逐步迈向生产环境,我们希望早期原型和由智能体生成的实验项目有足够空间运行,同时严格确保生产应用只包含已完成并经过审核的工作。我们希望获得比单靠功能开关更强的保障,因为功能开关仍会让原型代码留在生产构建中。我们的解决方案是采用独立的构建变体:一个沙盒应用,与生产环境共享完全相同的代码库、框架和设计系统,同时通过插件/套接字架构,在生产构建中彻底排除原型代码。Build-level isolation for safe AI prototyping: As Forum matured toward production, we wanted early-stage prototypes and agent-generated experiments to have room to run while keeping the production app strictly limited to finished, reviewed work. We wanted a stronger guarantee than feature gating alone, where prototype code still exists inside the production build. Our solution was a separate build flavor, a sandbox app that shares the exact same codebase, frameworks, and design system as production, but compiles prototype code out of the production build entirely via a plugin/socket architecture.
这让我们同时得到了三样东西:This gave us three things at once:
- 设计师和跨职能合作伙伴可以自由使用 AI 工具制作原型,无需每次修改都让工程师参与其中。Designers and cross-functional partners could prototype freely using AI tools without needing an engineer in the loop for each change.
- 在沙箱中构建的任何内容都可以直接移植到生产环境,无需重新构建。Anything built in the sandbox could be ported directly to production with no rebuild.
- 由于原型代码在该构建版本中根本不存在,因此不可能导致生产应用崩溃。No prototype code could crash the production app because it physically didn’t exist in that build.
这种模式让我们在已有真实用户需要保护的情况下,仍能快速迭代 AI。The pattern let us keep fast AI iteration after we had real people using the app to protect.
通过 AI 压力测试发现真实漏洞Finding Real Bugs With AI Stress Testing
对环境进行调整,不仅让构建智能体的效率更高,也让它成为了测试人员。我们没有让它针对某个特定缺陷进行测试,而是设置了可重复的压力场景,模拟真实用户行为(快速滚动、随机浏览群组、快速导航、重复加载媒体),并在每个构建版本上定期运行。由于这些测试会产生一致的信号(崩溃、内存增长、页面错误、UI 回归),智能体能够对异常进行分类,缩小范围以定位触发问题的操作序列,然后调查根本原因。Adapting the environment did more than make the agent faster to build with — it made the agent a tester. We didn’t point it at one specific defect. Instead, we set up repeatable stress scenarios that mimic real user behavior (aggressive scrolling, random group browsing, rapid navigation, repeated media loading) and ran them routinely across builds. Because these runs produce consistent signals (crashes, memory growth, page faults, UI regressions), the agent can triage anomalies, narrow to the triggering sequence, and then investigate the root cause.
一次这样的运行暴露出一个内存问题。该智能体隔离出一个可复现用例,提出修复方案并完成验证——这一切都发生在开发阶段,应用尚未交付给用户。该修复显著降低了多轮压力测试期间设备端的内存增长和缺页错误。One such run surfaced a memory issue. The agent isolated a repro, proposed a fix, and verified it — all during development, before the app reached users. The fix materially reduced on-device memory growth and page faults across repeated stress sessions.
工程师负责做出架构决策,而检测和回归监控则实现了自动化且可重复;一旦检测到异常,智能体就能借助同一套测试框架复现 → 隔离 → 提出修复方案 → 验证。While engineers made the architectural decisions, the detection and regression monitoring were automated and repeatable; once an anomaly was detected, the agent could reproduce → isolate → propose a fix → verify with the same harness.
将同样的规范应用于 Forum 的动态流Applying the Same Discipline to Forum’s Feed
我们在两个地方采用了人类监督的方式:We applied the human-on-the-loop approach in two places:
构建技术栈:智能体梳理了架构方案及其权衡,随后由工程师进行评估并作出选择。我们刻意将目标保留给人来决定——判断什么才算好的结果,属于产品层面的决策,不应该由系统自行定义。Building the stack: Agents mapped the architectural options and trade-offs; engineers then evaluated and chose. What we deliberately kept human was the target — deciding what a good outcome looks like is a product judgment, not something the system should define for itself.
运行技术栈:过去需要由熟悉相关代码路径的工程师回答的问题,现在交给调查代理处理。它会收集所需信息,并提交一份附有建议修复方案的调查报告。我们对一批真实调查进行人工评分后,确定了一套工作流程:代理负责压缩机械性工作,并向工程师提交结构化报告;工程师随后验证发现的问题究竟是真正的 bug,还是有意为之的权衡。Operating the stack: Questions that used to require whichever engineer knew the relevant code path now go to an investigation agent that gathers what it needs and posts a write-up with suggested fixes. After hand-scoring a batch of real investigations we arrived at a workflow where the agent compresses the mechanical work and delivers a structured write-up to an engineer, who then validates whether a finding is a real bug or an intentional trade-off.
提升质量的并非更好的提示词,而是上下文。有一类反复出现的调查任务,结果一直不尽如人意,直到我们把相关代码、示例查询和设计文档的指引提供给智能体——这些也正是我们第一天会交给任何新工程师的资料。此后,这类任务的质量显著提升。与培训人类新员工不同的是,你只需培训一次,此后的每次会话都会从这些内容开始。What improved quality wasn’t better prompting. It was context. One recurring category of investigation came back weak until we gave the agent the same pointers to the relevant code, example queries, and design docs that we’d give any new engineer on day one. The quality of that category jumped. The difference from human onboarding is that you train once, and every future session starts from it.

成功了吗?Did It Work?
除了交付速度更快,我们的交付也更加稳定。持续验证在开发过程中就暴露了系统性问题——例如上文提到的内存瓶颈——而不是等到上线后才发现。成果体现在性能概况中:Beyond shipping faster, we shipped cleaner. Continuous verification surfaced systemic issues — like the memory bottleneck above — during development rather than after launch. The results show up in the performance profile:
- 质量问题及早发现:自主压力测试循环在开发期间而非上线后发现并修复了上述内存问题,使内存使用量和页面错误大约减少了一半。Quality, found early: The autonomous stress-testing loop caught and fixed the aforementioned memory issue during development rather than post-launch, roughly halving memory use and page faults.
- 速度:Forum 在八周内实现了与 Facebook Groups 的核心功能对等,AI 承担了大部分常规实现工作,让工程师能够专注于架构、产品决策和质量。Velocity: Forum reached core feature parity with Facebook Groups in eight weeks, with AI handling much of the routine implementation so engineers could focus on architecture, product decisions, and quality.
- 持续发挥价值:发布后,由智能体驱动的调查帮助工程师对用户反馈进行分类处理并查明根本原因。Leverage that lasted: After launch, agent-driven investigation helped engineers triage and root-cause user feedback.
AI 所做的不只是生成代码。它还完善了我们的质量反馈闭环,帮助小团队以更少的后续返工交付高质量应用。The AI did more than generate code. It tightened our quality loop, helping a small team deliver a high-quality app with less ongoing rework.
哪些奏效了,哪些没有奏效What Worked, and What Did Not

致谢Acknowledgements
感谢 Neeharika Sinha、Jane Kou、Gang Yang、Guohao Zhang、Zeya Zhang、Kinnary Jangla 和 Yonghui Lu 作出的宝贵贡献。We thank Neeharika Sinha, Jane Kou, Gang Yang, Guohao Zhang, Zeya Zhang, Kinnary Jangla, andYonghui Lu for their valuable contributions.