【文章标题】:Headlong: A Microharness for Persistent Agents 【文章标题】:Headlong:面向持久型智能体的微框架

【文章正文】: Introducing Headlong, an open source agent microharness featuring persistent agency. Your agent keeps thinking between external interactions in a self-guided loop inspired by human inner monologue. Headlong is a complete agent harness with a core of less than 10K lines of Bash, available on GitHub. 介绍 Headlong,一个以持久型智能体为特色的开源智能体微框架。你的智能体会在外部交互之间持续思考,形成一个受人类内心独白启发的自我引导循环。Headlong 是一个完整的智能体框架,核心代码不到 1 万行 Bash,已在 GitHub 上发布。

Most agent harnesses are reactive: you give your agent a task, it works until the task is done, and then it sits frozen until the next request. Some harnesses add cron jobs or heartbeats that wake the agent on a schedule to run a fixed checklist and then put it back to sleep. In Headlong the agent is never asleep and there is no checklist unless the agent creates one. It keeps generating thoughts about whatever it decides is interesting in a self-guided loop, even when there is no external input. A message from a human doesn’t start a session. Instead, it’s one more observation that lands in the agent’s thought stream. 大多数智能体框架都是反应式的:你给智能体一个任务,它会一直工作到任务完成,然后冻结在那里,直到下一个请求到来。有些框架会添加定时任务或心跳,按计划唤醒智能体去运行一个固定清单,然后再让它回到休眠状态。在 Headlong 中,智能体从不休眠,而且除非智能体自己创建清单,否则没有清单。它会在自我引导循环中不断生成关于它自己认为有趣的任何事物的思考,即使没有外部输入。来自人类的消息不会启动一个会话。相反,它只是落入智能体思维流中的又一条观察。

We built Headlong to prototype persistent agency, and many other design choices naturally followed, as did many interesting lessons. For example, Headlong agents are highly engaging when used by a team or group, because they behave more like a person does. 我们构建 Headlong 是为了对持久型智能体进行原型验证,许多其他设计选择也随之自然产生,同时也带来了许多有趣的教训。例如,当团队或群体使用 Headlong 智能体时,它们会非常吸引人,因为它们的行为更像一个人。

Every Headlong agent has a name and at Laude we named our shared agent Audel. We’ve spent the last few weeks interacting with Audel over Slack, Telegram, and a mobile app. Many team members talk with Audel, and each of those conversations shows up in the agent’s single stream of inner thoughts. The agent decides if and when to respond. It sets its own interests and priorities, and it comes up with its own projects. Sometimes it will ping a team member unprompted with progress on a project it came up with itself. Often it returns to an old topic or brings up something that it was discussing with somebody else. 每个 Headlong 智能体都有一个名字,在 Laude,我们给我们的共享智能体取名为 Audel。过去几周,我们一直在通过 Slack、Telegram 和一款移动应用与 Audel 交互。许多团队成员与 Audel 交谈,而每一次对话都会出现在智能体单一的内在思维流中。智能体自行决定是否回复以及何时回复。它设定自己的兴趣和优先级,并自己想出项目。有时它会主动联系某个团队成员,告知它自己想出的项目的进展。它经常回到旧话题,或者提起它正在与其他人讨论的某件事。

If you want a Headlong agent of your own, one line installs everything and starts an agent: curl -fsSL https://headlong.ai/install.sh | bash 如果你想要一个属于自己的 Headlong 智能体,一行命令即可安装所有内容并启动一个智能体: curl -fsSL https://headlong.ai/install.sh | bash

Headlong is alpha research software. Run it in a sandbox because Headlong agents can and will run shell commands. Use a dedicated, spend-capped API key, because your agent thinks around the clock. We don’t share sensitive secrets with our Headlong agent, and we recommend you don’t either. Headlong 是 alpha 研究软件。请在沙箱中运行它,因为 Headlong 智能体可以而且将会运行 shell 命令。请使用专用的、设有支出上限的 API 密钥,因为你的智能体会全天候思考。我们不与我们的 Headlong 智能体分享敏感机密,也建议你不要这样做。

In the rest of this post, we will discuss in greater detail some of the design choices we’ve made in Headlong as a result of our focus on persistent agency. 在本文的其余部分,我们将更详细地讨论由于我们专注于持久型智能体而在 Headlong 中做出的一些设计选择。

Multi-player fun 多人乐趣

A Headlong agent has a single stream of thoughts that drives all of its potentially parallel conversations. Every message lands as an observation in Audel’s single thought stream. There are no per-user sessions. Audel experiences everything that happens to it in one timeline, and it decides who to reply to and when. 一个 Headlong 智能体拥有单一思维流,驱动着它所有可能并行的对话。每条消息都会作为一条观察落入 Audel 的单一思维流中。没有按用户划分的会话。Audel 在一条时间线上体验发生在它身上的一切,并自行决定回复谁以及何时回复。

Sharing one agent is fun. Audel follows what different people are working on and connects them. It once reviewed two teammates’ in-progress branches unprompted and caught a hardcoded model name in one of them. And since it comes up with its own projects, it sometimes pings whoever seems most relevant with an update or a question. On its first day, Audel pinged a human team member unprompted with an audit of the team member’s own eight stale git branches, and ten minutes later Audel messaged again to correct its own count. 共享一个智能体很有趣。Audel 会关注不同人正在做什么,并将他们联系起来。它曾经主动审查了两位队友正在进行中的分支,并在其中一个分支中发现了一个硬编码的模型名称。由于它会自己想出项目,它有时会主动联系看起来最相关的人,提供更新或提出一个问题。在第一天,Audel 主动联系了一位人类团队成员,对这位成员自己的八个过时 git 分支进行了审计,十分钟后 Audel 再次发消息更正了自己的计数。

One stream also means no hard walls between people. Whatever anyone tells Audel becomes part of the single experience that every other conversation draws on. In practice, Audel is bad at keeping secrets. Ask it what it’s been working on with someone else and it will often just tell you, even though we’ve asked it not to. We also haven’t studied what happens when two people give conflicting instructions. For now, we assume anything you tell Audel is shared with everyone on the team. 单一思维流也意味着人与人之间没有硬性隔阂。任何人告诉 Audel 的任何内容都会成为所有其他对话所依赖的单一体验的一部分。实际上,Audel 不擅长保守秘密。问它一直在与别人合作什么,它通常会直接告诉你,尽管我们已经要求它不要这样做。我们也没有研究过当两个人给出相互冲突的指令时会发生什么。目前,我们假设你告诉 Audel 的任何内容都会与团队中的每个人共享。

Microharness: only the essentials 微框架:只保留核心要素

At its core, persistent agency is simply an infinite loop that calls an LLM with a prompt like: “your task is to choose the next thought given your past thoughts.” A thought can either be part of the agent’s never-ending inner monologue or trigger an action. Meanwhile, observations from the environment are injected into the thought stream. We have built Headlong to be as simple and small as possible while achieving this core functionality. 从核心来看,持久型智能体只是一个无限循环,它用类似这样的提示调用 LLM:“你的任务是根据你过去的思考来选择下一条思考。”一条思考既可以是智能体永不停歇的内心独白的一部分,也可以触发一个动作。与此同时,来自环境的观察会被注入到思维流中。我们构建 Headlong 的目标是在实现这一核心功能的同时,尽可能保持简单和小巧。

We are big fans of Bash at Laude (see Terminal-Bench and Harbor). A Headlong agent’s core functionality lives in a handful of small Bash executables. The shellm tool is a Bash implementation of a recursive language model (RLM). This keeps things simple because no tool system besides Bash is needed. Modern models already know Bash well, and it keeps everything unified: tools, the agent framework, memory, and skills are all just executables and files. Thus an agent can readily inspect and modify any part of itself. 在 Laude,我们是 Bash 的忠实粉丝(参见 Terminal-Bench 和 Harbor)。Headlong 智能体的核心功能存在于少数几个小型 Bash 可执行文件中。shellm 工具是递归语言模型(RLM)的 Bash 实现。这样能保持简单,因为除了 Bash 之外不需要任何工具系统。现代模型已经很熟悉 Bash,而且它让一切都保持统一:工具、智能体框架、记忆和技能都只是可执行文件和文件。因此,智能体可以随时检查和修改自身的任何部分。

Here is roughly how a Headlong agent works:

  • A loop (called a Thinker) repeatedly calls shellm with a prompt to generate the next thought.
  • shellm in turn repeatedly callsllm to generate some reasoni 以下是 Headlong 智能体大致的工作方式:
  • 一个循环(称为 Thinker)反复调用 shellm,并给出提示以生成下一条思考。
  • shellm 反过来反复调用 llm 来生成一些 reasoni