8.4.1 Engineering ロードマップ:Async、API、Logs、Deploy
Engineering は、動く LLM demo をソフトウェアに変えます。Prompt、model、documents、users が変わったあとも、deploy、debug、measure、maintain できる状態にします。
まず LLMOps ループを見る



最初の engineering 目標は単純です。回答が間違ったとき、どの層が原因か説明できることです。
Trace readiness チェックを動かす
本番に近い LLM 機能には、悪い回答を 1 件 debug できるだけの trace fields が必要です。
trace = {
"request_id": "demo-001",
"prompt_version": "rag-v2",
"retrieval_hits": 2,
"model_ms": 850,
"format_ok": True,
"cost_usd": 0.003,
}
required = ["request_id", "prompt_version", "retrieval_hits", "model_ms", "format_ok", "cost_usd"]
print("trace_ready:", all(field in trace for field in required))
print("debug_fields:", ", ".join(required))
出力:
trace_ready: True
debug_fields: request_id, prompt_version, retrieval_hits, model_ms, format_ok, cost_usd
これらの field がないと、debug は推測になります。機能を増やす前に logs を追加します。
この順番で学ぶ
| 手順 | 読む内容 | 実践アウトプット |
|---|---|---|
| 1 | 非同期プログラミング | timeout、retry、concurrency limit、cancellation の考え方を入れる |
| 2 | API 設計 | request/response schema と error code を定義する |
| 3 | ログと監視 | prompt version、retrieval hits、latency、cost、failures を記録する |
| 4 | Docker デプロイ | 再現可能な実行手順でアプリを package する |
合格ライン
最小アプリに run command、API contract、error handling、logs、1 件の失敗調査メモがあれば、この章は合格です。
出口ミニプロジェクトは engineering evidence pack です:1 件の trace log、1 つのよくある error、1 回の fix、1 回の regression check、1 つの deployment note を残します。