Flue 2 发布:为 Agent 引入 React 风格 Hooks
React for Agents: Astro Creator Brings Hooks to his Meta-Harness, Flue
Agent frameworks for developers are still at an early stage, with the likes of Vercel’s eve and Fred Schott’s Flue — both launched this year — setting the early template.
面向开发者的智能体框架仍处于早期阶段,Vercel 的 eve 和 Fred Schott 的 Flue(均于今年推出)等正在设定早期模板。
Schott is the creator of the web framework Astro, which led to his company being acquired by Cloudflare in January. He’s just released version 2 of Flue, its first stable release, which has as its foundation React-style “Agent Hooks.”
Schott 是 Web 框架 Astro 的创建者,这导致他的公司于 1 月被 Cloudflare 收购。他刚刚发布了 Flue 2,这是其首个稳定版本,其基础是 React 风格的“Agent Hooks”。
In Flue, an agent is represented by a JavaScript function. This function “re-renders on every turn,” meaning before every model call.
在 Flue 中,智能体由 JavaScript 函数表示。该函数“在每一轮重新渲染”,即在每次模型调用之前。
The addition of hooks came after Schott realized that React’s composability would be a great fit for agent development.
添加 hooks 是在 Schott 意识到 React 的可组合性非常适合智能体开发之后。
“I originally tweeted that we were building the Astro for agents or the Next.js for agents,” he told us. “But then I realized: maybe no one has even built the React for agents.”
“我最初发推文说我们正在为智能体构建 Astro 或为智能体构建 Next.js,”他告诉我们。“但后来我意识到:也许还没有人为智能体构建 React。”
Editor’s Note: we last talked about the React for Agents with Bret Taylor, CEO of Sierra and Chairman of OpenAI:
编者按:我们上次与 Sierra 首席执行官兼 OpenAI 董事长 Bret Taylor 讨论了“智能体的 React”:
“We’re still trying to figure out who the reactive agents are and the jury is still out… We’re sort of in the jQuery era of agents, not the react era.”
“我们仍在试图弄清楚什么是响应式智能体,结论尚未确定……我们大致处于智能体的 jQuery 时代,而不是 React 时代。”
Hooks are authored in TypeScript. According to the Flue 2 launch post, they “let you build dynamic agents that can manage their own state, listen to agent lifecycle events, and even attach different resources and capabilities dynamically to enhance themselves at runtime.”
Hooks 使用 TypeScript 编写。根据 Flue 2 的发布文章,它们“让你能够构建动态智能体,这些智能体可以管理自己的状态、监听智能体生命周期事件,甚至动态附加不同的资源和能力,以在运行时增强自身。”
There are 16 built-in hooks in Flue 2, including useSkill(), useTool(), useSubagent(). You can also add custom hooks.
Flue 2 内置了 16 个 hooks,包括 useSkill()、useTool()、useSubagent()。你还可以添加自定义 hooks。
How Flue evolved via React-style hooks; diagram by Richard MacManus
Flue 如何通过 React 风格的 hooks 演变;图表由 Richard MacManus 提供
What hooks open up for developers is that they make an agent much more dynamic, by allowing its configuration to change as a conversation or workflow progresses. Schott said this is needed to build “real support bots, real triage bots,” because they can’t be fully configured in advance. The agent can’t just be static — it has to adapt in real-time to what the user wants or the situation demands.
Hooks 为开发者带来的好处是,它们使智能体更加动态,允许其配置随着对话或工作流程的进展而改变。Schott 表示,这是构建“真正的支持机器人、真正的分类机器人”所必需的,因为它们无法提前完全配置。智能体不能只是静态的——它必须实时适应用户的需求或情况的要求。
Agent hooks bring those capabilities to Flue. For example, a support agent might bring in an account management tool after first verifying a user.
Agent hooks 将这些能力带给了 Flue。例如,支持智能体可能首先验证用户,然后引入账户管理工具。
File based magic is an antipattern
基于文件的魔法是一种反模式
Schott’s thinking about how to build an agent framework has evolved rapidly since he publicly launched Flue 1 in early May. Initially, he wanted to take existing web framework concepts and apply them to his new agent framework. He uses file-based routing as an example.
自 5 月初公开发布 Flue 1 以来,Schott 对如何构建智能体框架的思考迅速演变。最初,他想将现有的 Web 框架概念应用于他的新智能体框架。他以基于文件的路由为例。
“So we kind of naively ported that over to Flue, thinking — great, well, I’ll put your five agents in these five files, and that’ll be the five routes that they expose. But for a lot of people building with Flue, especially the bigger customers, their whole company is one agent. They don’t care about routing. There’s one agent.”
“所以我们有点天真地把它移植到 Flue 上,想着——太好了,我会把你的五个代理放在这五个文件中,那就是它们暴露的五条路由。但对于很多用 Flue 构建的人来说,尤其是较大的客户,他们的整个公司就是一个代理。他们不关心路由。只有一个代理。”
So after the first Flue users showed these early patterns, composability became front of mind for Schott. That led him back to React.
因此,在第一批 Flue 用户展示了这些早期模式后,可组合性成为 Schott 关注的重点。这让他回到了 React。
“As you can see from the Flue 2 API, we’re taking it more from React [...] than we are from Astro or Next.js — where it’s less about routing and these website concepts and more about, at its base level, how do you compose an agent on many different things?”
“正如你从 Flue 2 API 中看到的,我们更多地从 React 中汲取灵感,而不是从 Astro 或 Next.js——它更少涉及路由和这些网站概念,而更多地在基础层面上,你如何在一个代理上组合许多不同的东西?”
Flue’s central proposition: agents need a harness
Flue 的核心主张:代理需要一个 harness
A key concept in Flue is that an agent must have a harness — meaning that it’s in an environment where it has access to the context and capabilities needed to accomplish various tasks.
Flue 中的一个关键概念是,代理必须有一个 harness——这意味着它处于一个环境中,可以访问完成各种任务所需的上下文和能力。
“Instead of you and your code driving the LLM and telling it what to do with scripts, you’re putting the agent into this harness, and it is able to drive itself and work through problems,” explained Schott.
“不是你和你的代码驱动 LLM,用脚本告诉它做什么,而是你把代理放入这个 harness 中,它能够自我驱动并解决问题,”Schott 解释道。
Flue is built on top of Pi, an open source minimal harness. Essentially, Flue is an opinionated take on Pi — adding features that Schott thinks are helpful to developers building agents. For example: hosted agents in Flue 2 are now built with Vite, an open source build tool.
Flue 构建在 Pi 之上,Pi 是一个开源的最小化 harness。本质上,Flue 是对 Pi 的一种有主见的看法——添加了 Schott 认为对构建代理的开发人员有用的功能。例如:Flue 2 中的托管代理现在使用 Vite 构建,Vite 是一个开源构建工具。
Indeed, Schott likens Pi’s role to the foundational role that Vite now plays beneath Astro.
事实上,Schott 将 Pi 的作用比作 Vite 现在在 Astro 之下所扮演的基础性角色。
“I think Pi can serve that role, where it’s the right abstraction — it doesn’t do too much, but it gives the right APIs that then we can go and say, well, let’s have an opinionated take on this that does more.”
“我认为 Pi 可以扮演这个角色,它是一个合适的抽象——它不会做太多事情,但提供了正确的 API,然后我们可以说,好吧,让我们对此有一个有主见的看法,做更多的事情。”
Building on Pi meant committing to having a built-in agent harness.
基于 Pi 构建意味着承诺拥有一个内置的代理 harness。
“Our early bet was that the harness is actually not a feature, but it’s fundamental to what you think an agent is,” Schott said. “There is no agent without a harness.”
“我们早期的赌注是,harness 实际上不是一个功能,而是你对代理是什么的基本认知,”Schott 说。“没有 harness 就没有代理。”
Building Flue agents with coding agents
使用编码代理构建 Flue 代理
The Flue project began earlier this year within the Astro repository, as an issue-triage system. At first, it was an LLM-driven script or workflow reviewing issues. But then, explained Schott, it gained the ability to take actions in the repo.
Flue 项目始于今年早些时候,在 Astro 仓库内,作为一个问题分类系统。起初,它是一个由 LLM 驱动的脚本或工作流来审查问题。但后来,Schott 解释说,它获得了在仓库中采取行动的能力。
“It started to transition from just automation in a repo to wanting to take the Claude Code experience, make it headless, make it hostable and run it in the cloud.”
“它开始从仓库中的单纯自动化过渡到想要采用 Claude Code 体验,使其无头化、可托管并在云端运行。”
So that’s when the idea of a harness as anchor emerged. Indeed, in his v1 launch post in early May, Schott described Flue as “like Claude Code, but 100% headless and programmable.”
所以,这就是“工具架作为锚点”这一想法的由来。事实上,在5月初的v1发布帖子中,Schott将Flue描述为“像Claude Code,但100%无头且可编程”。
I myself tested out Flue using Claude Code, which guided me through setting up my first Flue agent. And Schott confirmed this is how many developers use Flue.
我自己也使用Claude Code测试了Flue,它引导我设置了第一个Flue代理。Schott证实,这正是许多开发者使用Flue的方式。
“We very much are building for them,” he said, regarding AI coding agents. “Our whole onboarding flow is that, you know, pass this prompt to your agent, it’s gonna guide you through it. All of our docs have markdown support.”
“我们很大程度上是为他们而构建的,”他在谈到AI编码代理时说。“我们的整个入门流程就是,你知道,把这个提示词交给你的代理,它会引导你完成。我们所有的文档都支持Markdown。”
Where Flue fits in the agent development stack
Flue在代理开发栈中的位置
The closest comparison to Flue is Vercel’s eve, which also treats the harness as foundational. Vercel and Cloudflare have been known to beef in public, but Schott is generous in his opinion of eve.
与Flue最接近的比较对象是Vercel的eve,它也把工具架视为基础。Vercel和Cloudflare在公开场合有过争执,但Schott对eve的评价很慷慨。
“Eve, I think, is the most directly competitive,” Schott said. “It came around at the same time, so it had that same take that a harness is built-in.”
“我认为Eve是最直接的竞争对手,”Schott说。“它差不多同时出现,所以也有同样的看法,即工具架是内置的。”
Schott also referenced what he called the “OG agent frameworks,” which came before Flue and so weren’t created with a harness as the central concept. He listed Vercel’s AI SDK, Cloudflare’s Agents SDK, and Mastra (developed by the same team that built Gatsby, a web framework predating Astro).
Schott还提到了他所谓的“OG代理框架”,这些框架出现在Flue之前,因此并非以工具架为核心概念。他列出了Vercel的AI SDK、Cloudflare的Agents SDK,以及Mastra(由构建Gatsby的同一团队开发,Gatsby是一个早于Astro的Web框架)。
While these “OG agent frameworks” are all adding harnesses now, Schott considers that an added feature — whereas Flue and eve both have built-in harnesses.
虽然这些“OG代理框架”现在都在添加工具架,但Schott认为那是一个附加功能——而Flue和eve都有内置的工具架。
I asked where Flue sits compared to emerging “meta-harnesses,” like Databricks’ Omnigent and perhaps even the self-improving Exo harness.
我问Schott,Flue与新兴的“元工具架”(如Databricks的Omnigent,甚至可能还有自我改进的Exo工具架)相比处于什么位置。
Note: we’re also publishing our interview with Exo coauthor Alex Krentsel this weekend; it’s worth a watch and has a bonus discussion on OpenClaw architecture!
注意:我们本周末还会发布对Exo合著者Alex Krentsel的采访;值得一看,并且还有关于OpenClaw架构的额外讨论!
Schott rightly noted that there’s confusion about what the term meta-harness even means at this early stage. Regardless, he thinks having one API for working across all harnesses would muddle the story for Flue. His framework specifically defines how skills work in Flue, how subagents work, and so on. As he put it, “the framework [Flue] and the harness are very intertwined.”
Schott正确地指出,在这个早期阶段,人们对“元工具架”这个词的含义甚至都存在困惑。尽管如此,他认为拥有一个跨所有工具架工作的API会混淆Flue的故事。他的框架具体定义了技能在Flue中如何工作、子代理如何工作等等。正如他所说,“框架[Flue]和工具架是紧密交织在一起的。”
He personally finds the meta-harness discussion fascinating, and has played with Exo, but says it’s “a different interest scenario that isn’t really related to hosted agents.”
他个人觉得元工具架的讨论很有趣,也玩过Exo,但表示“这是一个不同的兴趣场景,与托管代理并没有真正的关系。”
The Cloudflare connection
Cloudflare的连接
Throughout the interview, Schott referenced being able to take advantage of his employer Cloudflare’s tooling and infrastructure. But he was also very clear that Flue is an “open source framework for every host,” as he put it, and he wants it to stay that way.
在整个采访中,Schott 提到了能够利用其雇主 Cloudflare 的工具和基础设施。但他也明确表示,Flue 是一个“适用于所有主机的开源框架”,正如他所说,他希望保持这种状态。
“The best tools are the ones that float above the host,” he said. “That opens the door for the most developer adoption and the most innovation.”
“最好的工具是那些凌驾于主机之上的工具,”他说。“这为最多的开发者采用和最多的创新打开了大门。”
Host portability is one of Flue’s defining principles — and perhaps that’s where the fundamental difference to Vercel’s eve is. While eve can also be self-hosted, it is optimized to take advantage of Vercel’s many features. Of course that’s a known playbook of Vercel, which does the same thing with Next.js.
主机可移植性是 Flue 的核心原则之一——也许这正是它与 Vercel 的 eve 的根本区别。虽然 eve 也可以自托管,但它经过优化以利用 Vercel 的众多功能。当然,这是 Vercel 的惯用做法,他们对 Next.js 也采取了同样的策略。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力