Two-Stage Filtering for Proactive AI Agents
An article presents an 80-line, standard-library Python simulator that applies deterministic Fast Path admission checks before sending candidate events to an LLM-based Slow Path for semantic triage. In the six-event test, three events are filtered by the program layer and one is rejected by the simulated semantic layer; two qualify for dispatch or logging. The simulator supports observe and auto modes and uses deterministic keyword rules in place of a real LLM. DeepSeek’s latency, token-consumption, and routing figures come from self-reported simulated or synthetic tests that were not independently audited.
The implementation shows how deterministic authorization and noise filtering can reduce the number of events sent to model-based triage, while explicitly separating runnable simulator behavior from unaudited performance claims. Its keyword-based Slow Path does not demonstrate real-LLM semantic performance, and the underlying project is described as a research prototype that is not production-ready.
主动性 Agent 工程周 · Day 2(周二)。昨天拆了 dsh-superagent 的整体架构,今天进入最容易被做歪的一环:一条环境事件从进来到"开工"或"闭嘴",中间到底发生了什么。 本文含一个 80 行、纯标准库、可离线复跑的两级过滤模拟器,文末输出经实际运行验证。
一、为什么不能每条消息都过模型
接入真实群聊和代码平台后,事件流有个残酷特征:高噪音、低触发率。一个研发群一天几百条消息,闲聊占九成以上;真正该让 Agent 动手的触发,一天可能一两次。
如果每条消息都调 LLM 从头判断"要不要动",延迟和成本都不可接受。DeepSeek 在《Super-agent 设计探索》里搬来了计算机系统的经典思路 Fast Path / Slow Path:
- Fast Path(程序层策略):把明确、稳定的高频判断固化成确定性代码——事件来源、群组范围、用户/Bot 白名单,直接代码准入检查。毫秒级、零模型成本,在调模型前滤掉大部分噪音。
- Slow Path(语义层策略):通过程序层准入的候选事件,才交给 LLM,按提示词里的策略判断"随口吐槽还是真问题"。