Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mastering Agentic Development: Harness Engineer...

Mastering Agentic Development: Harness Engineering for Effective Coding Agents

効果的にコーディングエージェントを活用するためのハーネスエンジニアリングについて
※ 例として Kiro CLI を取り上げていますが、どのコーディングエージェントでも置き換え可能です

Avatar for Kyosuke Konishi

Kyosuke Konishi

September 25, 2026

More Decks by Kyosuke Konishi

Other Decks in Technology

Transcript

  1. Mastering Agentic Development: Harness Engineering for Effective Coding Agents Kyosuke

    Konishi Amazon Web Services Japan G.K. ISV/SaaS Solutions Architect © 2026, Amazon Web © 2026, Services, Amazon Inc. or Web its Services, affiliates.Inc. All or rights its affiliates. reserved.All Amazon rights Confidential reserved. Amazon and Trademark. Confidential and Trademark. 1
  2. ⾃⼰紹介 ⼩⻄ 杏典 (Kyosuke Konishi) Amazon Web Services Japan G.K.

    Solutions Architect ISV/SaaS 企業のお客様を中⼼に ソリューションアーキテクトとして技術⽀援に従事 • 好きなサービス Amazon EKS @_konippi Kiro CLI https://x.com/_konippi konippi https://github.com/konippi © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 2
  3. エージェントにおける期待通りの⾏動とギャップ 期待通りの⾏動 期待とのギャップ 要求・完了条件・品質制約を 判断基準として作業する 意図や制約などを エージェントが遵守しない 実⾏結果を検証する コードを実⾏し、テスト・ログ・ 画⾯から振る舞いを確認する

    確認⼿段が作業に組み込まれず、 エージェントが正否を判断できない 修正を重ねて完遂する 失敗をフィードバックとして 取り込み、完遂まで修正を続ける 完了条件と進捗を追跡できず、 未完了のまま終了する ⽬的と制約に沿う © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 6
  4. 期待とのギャップの正体 期待とのギャップは、現状モデル (プロンプト改善を含む) だけでは解決できない 意図や制約などを エージェントが遵守しない LLM は⾮決定的で、 明⽰しても動作は確率的 確認⼿段が作業に組み込まれず、

    エージェントが正否を判断できない LLM は⽣成器であって、 検証器ではない 完了条件と進捗を追跡できず、 未完了のまま終了する LLM はステートレスで、 完遂を追う状態を持たない © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 7
  5. モデル単体は、エージェントではない Agent Loop Tool Execution Input Context © 2026, Amazon

    Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. Tool Call Response 8
  6. モデル単体は、エージェントではない Agent Loop セッションを跨いだ状態保持 コードの理解やツール実⾏ Tool Execution Input Context 安全な実⾏環境の構築

    © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. Tool Call Response 実⾏結果の観測 9
  7. = Model + “If you're not the model, you're the

    harness.” — Vivek Trivedy, The Anatomy of an Agent Harness (LangChain, 2026) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 10
  8. ハーネスは、モデルの周囲にある実⾏システム Context Action Model Persist Control Observe & Verify ©

    2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 11
  9. ハーネスには 2 つの設計主体がある User Harness AGENTS.md Skills Hooks Rules ユーザーハーネス:

    ユーザーが実装するハーネス Agent Harness Context Management ... Tools ... エージェントハーネス: Model © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. エージェント提供元が実装するハーネス 12
  10. ハーネスには 2 つの設計主体がある User Harness AGENTS.md Skills Hooks Rules ユーザーハーネス:

    ユーザーが実装するハーネス Agent Harness Context Management ... Tools ... エージェントハーネス: Model © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. エージェント提供元が実装するハーネス 13
  11. Feedforward 制御 と Feedback 制御 • Feedforward 制御: エージェントが⾏動する前に、望ましい⽅向を教え、失敗を予防する •

    Feedback 制御: エージェントが⾏動した後に、結果を観測し、誤りを検出して⾃⼰修正させる Feedforward 制御 Feedback 制御 決定的 LSP や MCP テストや静的解析 ⾮決定的 規約や参照ドキュメント レビューや評価 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 19
  12. Kiro CLI における ハーネスエンジニアリング実践 © 2026, Amazon Web Services, Inc.

    or its affiliates. All rights reserved. Amazon Confidential and Trademark. 20
  13. Kiro CLI とハーネスエンジニアリング Steering 恒久的に適用される方針や規約 “That harness is the product:

    the canonical place where the capabilities live.” Hooks 特定の操作をトリガーに自動実行 MCP 外部ツールや API などに接続 — Massimo Re Ferre (Kiro team) Permissions 操作の可否をルールで制御 Which Kiro app should I pick? Custom agents 役割特化エージェント Agent Skills 再利用可能な手順パッケージ … © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 21
  14. Kiro CLI における Feedforward 制御 × 決定的 LSP や CLI

    のように速くて決定的に動く⼿段をエージェントに渡す。 推論に頼ることなく、エージェントが「できること」そのものを増やす。 コードインテリジェンス (LSP) /code init コマンドで Language Server を 有効化し、定義ジャンプや参照検索などを⾜す MCP サーバー 外部ツールや API などを接続し、 モデルの推論を補完する TypeScript Language Server Python Language Server AWS MCP Server MCP LSP Playwright MCP Server Kiro CLI Rust Language Server © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. PostgreSQL MCP Server 22
  15. Kiro CLI における Feedforward 制御 × ⾮決定的 ⾃然⾔語のまま規約や判断基準などをエージェントに渡し、実装時の判断に利⽤させる Agent Skills

    再利用可能な手順パッケージ 説明は起動時に常駐、本文は必要な時のみロード Description をわかりやすく端的に Steering / AGENTS.md Knowledge Base 普遍的な原則・規約 大量の資料やコードベース 毎リクエストでコンテキストに常駐 検索時にのみコンテキストを消費 必要なものだけ、なるべく薄く ログや設定は Fast モード、 ⽂書は Best モード © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 23
  16. Kiro CLI における Feedback 制御 × 決定的 テストや静的解析を変更ごとに適⽤し、検査結果をエージェントへ返す .kiro/hooks/verify-typescript.json {

    "version": "v1", "hooks": [{ "name": "Verify TypeScript", "trigger": "PostFileSave", "matcher": "\\.(ts|tsx)$", "action": { "type": "command", "command": "npm run lint && npm test" } }] } © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 1. Change エージェントがファイルを編集する 2. Trigger PostFileSave フックが自動で発火する 3. Check 静的解析、テスト、フォーマッターなどを 実行する 4. Feedback 成功の場合は標準出力、失敗の場合は 標準エラーを返す 24
  17. Kiro CLI における Feedback 制御 × ⾮決定的 異なるコンテキスト環境において、レビューエージェントが実装後の差分を読み、 実装エージェントに対してレビュー結果をフィードバックする Agents

    reliably skew positive when grading their own work. — Anthropic, “Harness design for long-running application development” Context A Context B レビュー依頼 Implementer Agent © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. レビュー結果を フィードバック Reviewer Agent 25
  18. (再掲) Feedforward 制御 と Feedback 制御 • Feedforward 制御: エージェントが⾏動する前に、望ましい⽅向を教え、失敗を予防する

    • Feedback 制御: エージェントが⾏動した後に、結果を観測し、誤りを検出して⾃⼰修正させる Feedforward 制御 Feedback 制御 決定的 LSP や MCP テストや静的解析 ⾮決定的 規約や参照ドキュメント レビューや評価 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 26
  19. 失敗を「資産」に変える エージェントが失敗したら、⼆度と同じ失敗をしないように仕組みを作る 失敗を観測 原因を分析 ハーネスへ反映 次の実行で修正 規約違反、検証不⾜、 どの機能・制約が AGENTS.md、ツール、 更新したハーネスで

    危険な操作、不完全な ⾜りなかったかを特定 フック、権限などへ 再実⾏し、成功するま 反映して仕組み化 で修正をする 実装などを観測 制御は「この⽅が良さそう」で追加するのではなく、 発⽣した失敗を根拠に必要な分だけ追加することが⼤切 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 29
  20. モデルが変われば、ハーネスの前提を疑うべき Every component in a harness encodes an assumption about

    what the model can't do on its own. — Anthropic, “Harness design for long-running application development” 1. 不要になった制御は削る あるハーネスコンポーネントは「モデルの何を補っているのか」を 説明できなければ、モデルの性能を抑え込むノイズになるので削除する 2. 制御を能⼒境界へ移す 制御は「モデルがまだできないこと」にだけ適⽤し、 境界が動けばそこに制御を移す © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 30
  21. ⼈間の介⼊はなくすものではなく、移すもの 優れたハーネスによって⼈間の介⼊を排除することを⽬指すのではなく、 ⼈間の介⼊を最も重要となる場所に移すべきである なぜ排除できないのか どこへ移すのか 組織のコンテキスト 逐次レビューから、⼀度のハーネス更新へ チームで何を優先し、過去にどう 同じ指摘を毎回繰り返すのではなく、 失敗したかは外から注⼊できない。

    ハーネスに⼀度反映する。 正しさの定義 実装の確認から意図の定義へ 何が正しいかを決めるのは⼈間で、 意図と受け⼊れ条件を定め、 決めない限り検証のしようがない。 判断が必要な場⾯だけを引き受ける © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 31
  22. まとめ • なぜハーネスエンジニアリングが必要なのか モデル単体はエージェントではない。期待はずれの多くはモデルではなく、ハーネスの不⾜。 仕組みを設計し、実⾏結果から改善し続ける活動がハーネスエンジニアリング。 • ハーネスをどう設計するのか Feedforward 制御と Feedback

    制御を、決定的・⾮決定的の 4 象限で設計する。 決定的な制御は変更のたびに安く速く、⾮決定的な制御は時間をかけて意味の判断を担う。 • ハーネスをどう運⽤・改善するのか 制御は思いつきではなく、発⽣した失敗を根拠に必要な分だけ追加する。 モデルの変化に伴ってハーネスを疑い、不要になったものは削除する。 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 33
  23. Thank you! © 2026, Amazon Web Services, Inc. or its

    affiliates. All rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 34