
LLMアプリは「ハーネス」が9割 ── Perl/CGIの現役SaaSにAIエージェントを組み込んで学んだことA developer shares lessons from integrating an AI agent into a legacy Perl/CGI…
匿名の公開いいねです。記事の保存・お気に入りではなく、Featured、Top 3、重要度、掲載順位には影響しません。仕組みとプライバシーAnonymous public likes are reactions, not saved articles or bookmarks. They do not affect Featured, Top 3, importance, or listing order.How it works and privacy
レガシーなPerl/CGI製SaaSにAIエージェントを統合した実践から、LLMアプリ開発の本質はモデルよりも「ハーネス(周辺制御構造)」にあると学んだ知見を共有している。
A developer shares lessons from integrating an AI agent into a legacy Perl/CGI SaaS, concluding that the surrounding harness—not the LLM itself—accounts for most of the engineering effort.
要約と収集メタデータをもとに生成した AI 解説本文です。元記事全文の転載・翻訳ではありません。This AI explainer is generated from the summaries and collected metadata, not from a reproduction or translation of the full source article.
大規模言語モデル(LLM)を実際のアプリケーションに組み込む際、開発の成否を分けるのはモデルそのものではなく、その周囲を固める「ハーネス」だ──。Zennに公開されたある開発者の記事は、稼働中のPerl/CGI製SaaSにAIエージェントを統合した経験から、こうした教訓を共有している。
ここで言うハーネスとは、LLMを取り巻く制御構造の総称を指す。具体的には、プロンプトの構築、外部ツールやAPIの呼び出し、出力の検証と整形、エラー時のリトライ、会話履歴やコンテキストの管理といった、モデル本体の外側にある仕組み全体を含む。筆者によれば、実務におけるエンジニアリングの労力の大半はこの部分に費やされ、どのモデルを選ぶかよりも実運用への影響が大きいという。
今回の事例が興味深いのは、対象が最新のフレームワークではなく、Perl/CGIという成熟した技術で書かれた現役のSaaSである点だ。CGIは1990年代から使われてきた古典的な仕組みで、リクエストごとにプロセスを起動する構成が一般的とされる。こうしたレガシー環境は、モダンなPython中心のAI開発スタックとは前提が異なるため、エージェントを組み込む際には独自の工夫が必要になったと見られる。
近年はLangChainやLlamaIndexといったフレームワーク、あるいはOpenAIやAnthropicが提供する関数呼び出し(ツール利用)機能など、ハーネスを構築するための選択肢が急速に整いつつある。一方で、既存の業務システムにこれらをそのまま適用できるとは限らず、言語やアーキテクチャの制約に合わせた設計が求められる場面は多い。
この記事が示唆するのは、AIエージェント開発の実像が「賢いモデルを呼ぶだけ」という単純なものではないという現実だろう。モデルの性能が向上しても、それを安全かつ確実に動かすための周辺構造の重要性は変わらない、あるいはむしろ増していく可能性がある。レガシーシステムを抱える多くの現場にとって、モデル選定以上にハーネスの設計が実運用の鍵を握るという視点は、参考になりそうだ。
A developer writing on the Japanese engineering platform Zenn has published a set of lessons from embedding an AI agent into a long-running commercial SaaS built on Perl and CGI, arguing that most of the engineering effort in an LLM application goes into the "harness" — the surrounding control structure — rather than into the language model itself. The observation matters because it pushes back against the common assumption that picking the best model is the decisive move, suggesting instead that the scaffolding around the model determines whether a feature is reliable enough to ship.
In this context, the harness refers to everything that wraps the model call: assembling and trimming context, defining and validating tool interfaces, parsing and checking outputs, handling retries and failures, enforcing guardrails, and wiring the whole loop into an existing product. The author's framing that this accounts for roughly ninety percent of the work is a rhetorical estimate rather than a measured figure, but it aligns with a broader shift in how practitioners describe agent development. As models have become more capable and more interchangeable, the differentiating engineering has moved outward toward orchestration, evaluation, and integration.
The legacy stack makes the point vivid. Perl with CGI is one of the oldest web application architectures still in production, dating to the 1990s, and the Common Gateway Interface model typically spawns a fresh process per request with little shared state between them. That design sits awkwardly next to modern agent patterns, which often assume persistent sessions, streaming responses, asynchronous calls to external APIs, and multi-step tool use that can run for many seconds. Bridging those two worlds appears to require deliberate architectural choices, such as isolating the agent logic behind a defined boundary, managing conversation or task state outside the short-lived CGI process, and treating the LLM provider as one more external service with its own latency and failure characteristics.
Several of the reported lessons are broadly applicable beyond Perl. Reliable tool calling generally depends on strict schemas and validation, because a model can return plausible-looking but malformed arguments that will break downstream code if passed through unchecked. Context management matters because feeding too much or poorly structured information degrades both cost and answer quality, while feeding too little starves the agent of what it needs. Error handling is central because model outputs are probabilistic, so the harness has to anticipate incorrect formats, hallucinated fields, timeouts, and partial results, and decide when to retry, when to fall back, and when to surface an error to the user. These concerns are less about prompt wording and more about defensive software engineering, which is likely why an experienced developer of a legacy system found the transition tractable despite the unusual stack.
The account fits alongside a wider industry movement toward agent frameworks and standardized tooling. Libraries and orchestration layers such as LangChain, LlamaIndex, and the various vendor agent SDKs exist largely to provide reusable harness components, and the Model Context Protocol, introduced by Anthropic and since adopted more widely, is an attempt to standardize how models connect to external tools and data sources. The Zenn category placement under local LLM also hints at a related theme: teams increasingly weigh whether to call a hosted API or run a smaller model locally, a decision that changes the harness around latency, privacy, and cost, even when the surrounding control logic stays similar. The core argument is that these frameworks succeed or fail based on how well they handle the unglamorous plumbing, not on which model they wrap.
For readers maintaining older systems, the takeaway appears to be encouraging. It suggests that integrating AI does not necessarily require rewriting a working application in a modern language, and that conventional software discipline — clear interfaces, input validation, state management, and robust error handling — transfers directly to LLM work. The piece stops short of claiming that model choice is irrelevant; capability, context window, and cost still shape what is possible. Its more measured position is that once a sufficiently capable model is available, the remaining and often larger challenge is engineering the system around it. That perspective is a useful corrective for teams tempted to treat model selection as the whole project rather than as one component within it.
本ページの本文と要約は AI による自動生成です。日本語版と英語版は言語ごとに独立して生成されるため、表現や詳しさが異なる場合があります。正確性は元記事 (zenn.dev) をご確認ください。The body and summaries are AI-generated independently for each language, so wording and detail may differ. Verify accuracy at the original source (zenn.dev).




