智能体
dev.to ·
@Sohail Khan
开发者实践:多数客户要的 AI Agent 其实只是一个定时任务加一次 API 调用
一位开发者分享案例:客户要求构建全天候监控评论的自主 AI Agent,实际需求只是每小时读取新 Google 评论、将负面评论快速送达创始人。最终方案为一条 cron 定时任务、每条评论一次 LLM 调用(总结并标记负面)、一个 Slack webhook,未使用 Agent 框架、推理循环、向量数据库或记忆存储。作者称系统运行稳定、成本极低,但该结论基于单一项目经验,未提供量化评测。
AI推荐理由 这是一篇开发者经验分享,核心观点是许多客户要求的“自主 AI Agent”实际只需定时任务加单次 LLM 调用即可完成,并给出了具体实现(每小时拉取新评论、逐条调用模型标记负面评论、推送 Slack)。其价值在于对 Agent 过度工程化的务实反思,提供了可复用的简化架构思路;局限是仅为单一案例的博客叙述,无性能数据或对比评测,结论不能推广为普遍规律。
62
正文
A founder asked me to build an autonomous AI agent that monitors their reviews around the clock.
I nodded, asked what the agent should actually do, and listened.
Every hour, someone needs to read the new Google reviews. The negative ones must reach the founder fast. That is the whole job.
Here is what I shipped.
A cron job. One LLM call per review. A Slack webhook.
That is it. No agent framework. No elaborate reasoning loop. No vector database. No memory store.
Every hour, the job pulls reviews posted since the last run. Each review goes to the model exactly once with one instruction: summarize this and flag it if it is negative. The negative ones land in the founder's Slack channel. Everything else gets logged and ignored.
It runs perfectly, costs almost nothing, and the founder loves it.
The whole system
One cron line:
0 * * * * /usr/bin/node /home/app/review-watch.js
Enter fullscreen mode
Exit fullscreen mode
One small script:
// review-watch.js: read new reviews, flag the bad ones, ping Slack
import OpenAI from "openai";
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
async function main() {
const since = new Date(Date.now() - 60 * 60 * 1000).toISOString();
const reviews = await fetchNewReviews(since); // your reviews API here
for (const review of reviews) {
const verdict = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{
role: "system",
content: "Classify this review as positive, neutral or negative. Reply with one word, then a one line summary.",
},
{ role: "user", content: review.text },
],
});
const [label, summary] = verdict.choices[0].message.content.split("\n");
if (label.trim().toLowerCase() === "negative") {
await postToSlack(`Negative review from ${review.author}: ${summary}`);
}
}
}
async function postToSlack(text) {
await fetch(process.env.SLACK_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text }),
});
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
Enter fullscreen mode
Exit fullscreen mode
Two moving parts. You can read the entire system in one sitting.
Why this beat the agent
An agent would have added a planning loop, tool definitions, retry orchestration and state management. For what? The input is fixed: new reviews. The schedule is fixed: every hour. The output is fixed: a Slack message for the bad ones. There is no branching decision to make, no tool to choose, no memory to carry between runs.
Every layer an agent adds on top of that is a layer you get to debug at 3am. A script fails in obvious ways: the cron log tells you exactly which line broke. An agent fails in interesting ways: a tool call went sideways three steps deep inside a reasoning chain and nobody can reproduce it.
Selling an agent when a script would do is how projects get slow and expensive.
The honest framework
Build the agent when the job has real decision making:
The system must choose between tools based on what it reads
The path branches on intermediate results, not on fixed rules
It needs memory across steps to finish a single task
The input is ambiguous enough that one fixed prompt cannot handle it
Ship the script when the job looks like this:
It runs on a schedule or on a trigger
The inputs are known and the outputs are known
The model does one well defined thing, like classify or summarize
You can read the whole system in one file
Most of the agent requests I get land in the second list. That is not a failure of ambition. It is good engineering: the simplest system that does the job.
One note on cost
This runs one small model call per review, once an hour. There is no framework overhead, no repeated reasoning passes, no state store to maintain. The bill is a rounding error and the founder has never once asked what it costs. Compare that to an agent looping through a large model for the same hourly job and the difference pays for itself.
What is the most overbuilt "AI agent" you have seen? Or built? Drop it in the comments.
I'm Sohail Khan, a Senior Full Stack Developer building AI agents and automation. Tech Lead at LoopxCorp. I write about backend engineering, AI integration and practical system design.