---
id: 16596
lang: en
title: "One AI Agent Instead of Seven: Shop-Floor Task Triage Drops from 11 to 0.13 Cents"
published_at: "2026-11-21 01:24:38"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1107392/?utm_campaign=1107392&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/16596"
categories: ["llm", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# One AI Agent Instead of Seven: Shop-Floor Task Triage Drops from 11 to 0.13 Cents

> **Краткая суть (BLUF):** The author built a seven-agent AI pipeline for a factory but gave the "Triage with AI" button in the phone app to just one agent. A single short message ran through five agents in a row, took 22.7 seconds and cost about 11 cents ($0.108). One call to Haiku 4.5 costs about 0.13 cents ($0.0013). Part of the checking happens on the server before the model runs, and part happens when a person reviews the form afterward. If the input type is known in advance, start with a single model call rather than a chain.  • A five-agent pipeline: 22.7 seconds for one short message • Four response-parsing bugs were hidden behind the validator_skipped flag • The agent cannot issue a work order or write off material at any level of confidence

Picture a machine operator dictating into a phone: "To the designer by Friday, urgent, bearing cap." The author of the Habr article first built a seven-agent pipeline on Claude models for cases like this. But a single short message passed through five agents in a row, took 22.7 seconds and cost about 11 cents (to be precise, $0.108). For the "Triage with AI" button in the app, he ultimately kept just one small agent: a single call to Haiku 4.5 costs roughly 0.13 cents ($0.0013). The large pipeline now sits idle, waiting for an input that calls for it.

## Seven agents and why they existed

Anything can arrive on the shop floor: "the third machine is leaking," "we're out of 6204 bearings," a photo of a delivery note, a PDF drawing, a request to turn a part. A person has no time to choose a section; they just speak or type, and the system prepares a draft action. The work was divided into roles:

- **Normalizer** (Haiku 4.5) brings the input into one form: text, attachments, source.
- **Classifier** (Haiku 4.5) decides what it is: a remark, a shortage, a delivery note, an initiative, a task, or a document.
- **Extractor** (Sonnet 4.6) pulls out the fields for its type. Each of the six types has its own prompt and its own schema.
- **Composer** (Sonnet 4.6) turns the fields into a draft: a task, a remark, a purchase request.
- **Validator** (Sonnet 4.6) queries the database through tools and checks the draft against real records, for no more than five rounds.
- **Shortage agent** (Sonnet 4.6) runs in the background, calculates material shortages with SQL queries and sets priorities.
- **Controller** (Sonnet 4.6) runs once a day, finds stuck items and writes a digest.

The first five run as a chain through Celery. Each message gets a ten-minute lock in Redis so it isn't processed twice. On failure, the task is retried up to three times with pauses of 60, 120 and 240 seconds. Every model call is logged: model, tokens, price, time, confidence. Without this log, the article would not contain a single number.

A separate safety rule: the agents do not write to reference tables directly. Each action type has one of three fates in a policy table: it applies automatically when confidence is above a threshold, it stays a draft awaiting confirmation, or it is forbidden. The agent cannot approve a drawing revision, write off material or issue a work order to the shop floor at any level of confidence. The model may be wrong, so let the error stay a draft.

## What the first full run showed

The phrase "Turn 10 caps for the AD-1 motor" went through the entire chain in 22.7 seconds and $0.108. If the message is a voice note, roughly 15 seconds of server-side Whisper transcription is added on top. The validator found one remark on the draft, meaning for the first time it actually checked something.

It also turned out that the validator_skipped flag was hiding four bugs. It was meant as a safety net: if the validator's response couldn't be parsed, the draft moved on marked "not verified." In practice, the following errors lived underneath it:

1. The model wrote a preamble before the JSON, while the code looked for the code block only at the start of the response.
2. Writes to JSONB failed because Pydantic objects were stored instead of dictionaries.
3. Sometimes the JSON arrived without a code block, and the author switched to raw_decode from the Python standard library.
4. The model put null in a field the schema expected to be a string.

There was also a fifth bug, already in the Composer: it occasionally returned an empty payload. For now it is covered by a workaround, and strict schemas for each action type remain on the to-do list. One more evening went to a deployment error: the code was copied to the host, but the container still ran the old version baked into the image at build time.

## Why one agent was enough on the phone

The author worked out how this looks for the person at the machine: they wait more than 20 seconds for five model calls, pay 11 cents, and then still look at the form themselves and check the assignee and the deadline. The five verification steps turned out to be unnecessary.

Now the button works like this:

- The phone itself handles speech recognition, so no server-side Whisper is needed.
- A single call to Haiku 4.5, with a response capped at 800 tokens, fills in the form: title, description, type, urgency, deadline, and what needs clarifying.
- The server finds the assignee itself from the staff list by comparing word stems, and replaces the name with "[assignee]", so employee names never reach Claude. If two people match, the field stays empty.
- Instead of tools, the model receives in its request up to 30 projects and up to 12 similar tasks, and the server keeps only what exists and is visible to the author.

Three parses in the first test cost $0.004 in total, which comes to about $0.0013 per parse, against $0.108 for the pipeline. That is roughly 80 times cheaper.

## Where seven agents are still needed

The pipeline is useful when it's not known in advance what has arrived. A photo of a delivery note first has to be identified, then its line items extracted, then each one matched against the materials reference. "We're out of 6204 bearings" is a shortage, "bearings have arrived" from a delivery-note photo is a warehouse receipt, and "the third machine is leaking" is a production remark. Each case needs its own fields.

A task form is different: the input type is known, the form is known, and a person is right there. Every extra agent adds seconds and cents. An honest limitation: the author did not measure accuracy, only cost and time. The conclusion matches the study "Is Multi-Agent Worth It?", in which teams of agents lost to a single agent on most tasks, both in accuracy and in cost.

The practical takeaway for developers: start where the person stands, with a single model call tailored to a specific form. Add a second agent when the first one stops keeping up. Set up a log of price and time for every call from day one, and make flags such as validator_skipped loud, so that errors don't hide behind one another.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1107392/?utm_campaign=1107392&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/16596
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
