Repository navigation
AIエージェントのPoC設計書を追加 - #6476
AIエージェントのPoC設計書を追加#6476
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough自然言語の曖昧な目的地入力から実在駅を最大5件提案し、既存フローへ接続するAIエージェントPoCの設計書を追加した。API、検証、アプリ連携、運用、テスト、リリース方針を定義し、READMEからリンクした。 Changes行き先相談AIエージェント
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/spec/ai-agent/destination-agent.md`:
- Around line 214-218:
本文・シーケンス図・テスト条件・コスト試算で、ツール呼び出し上限の定義を統一してください。1イテレーション1回なら最大3回として記載を修正し、最大5回を維持する場合は並列呼び出しを明示して図と各関連説明を更新してください。
- Around line 417-420: Define and document timeout, cancellation, and retry
behavior for the BFF’s outbound LLM API and sapi-bff calls in the
destination-agent specification, rather than covering only the client-side
30-second timeout. Specify server-side deadlines and cancellation propagation,
and state how retries must avoid duplicating timed-out requests and costs.
- Around line 470-482: 「セキュリティ・プライバシー」節に、採用する LLM
プロバイダーごとの会話データ保持期間・処理リージョン・削除方法を追記し、契約条件とユーザー同意・プライバシー審査を実装開始前の必須条件として明記してください。既存の自社バックエンドでの非永続化方針と併記し、プロバイダー側の保持設定を確認・適用する責任も定義してください。
- Around line 297-300: 駅グループ ID
のフィールド名を、ツール結果とレスポンススキーマで統一してください。`stationsByName` の軽量 JSON では正式名称として
`stationGroupId` など一つの名称を採用し、`StationFields` の `groupId`
から変換する明示的なマッピングを仕様に追加してください。駅検索結果とレスポンススキーマの両方で同じ名称を使用し、再取得キーとの不一致を防いでください。
- Around line 270-295:
ツール定義節を、共通の論理スキーマとプロバイダ別アダプターに分離して記述してください。`search_stations_by_name`
の共通入力契約を定義したうえで、Anthropic の `input_schema` と OpenAI の `parameters`
など各形式への変換方針を明記し、GPT 候補にも同じスキーマを適用できる実装手順を追加してください。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a10bcc7f-0c39-401f-b8be-6f738f54b8bf
📒 Files selected for processing (2)
docs/README.mddocs/spec/ai-agent/destination-agent.md
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Fixes Applied SuccessfullyFixed 1 file based on 5 CodeRabbit feedback item(s). Files modified:
Commit: 対応内容:
The latest autofix changes are on the |
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/spec/ai-agent/architecture.md (1)
461-480: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win会話リクエストのAI Gatewayキャッシュを既定で有効にしないでください。
本書は会話本文を既定で永続化しない方針ですが、AI Gatewayのキャッシュはリクエストに対する応答を保存します。動的な会話では
cf-aig-skip-cache: trueを付けるか、Gateway側でキャッシュを無効化し、静的なFAQなど安全な対象だけを明示的にキャッシュしてください。 (developers.cloudflare.com)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/spec/ai-agent/architecture.md` around lines 461 - 480, Clarify the Cloudflare AI Gateway guidance in the architecture document so conversation requests do not use caching by default. Specify applying cf-aig-skip-cache: true or disabling caching at the Gateway, and limit any enabled caching to explicitly approved safe content such as static FAQs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/spec/ai-agent/architecture.md`:
- Around line 516-529: コスト試算の補足を、通常ケースと最大ケースに分けて更新してください。通常ケースは本体LLM
2回、最大ケースは最大3イテレーションに基づく呼び出し回数と費用で再計算し、AI
Gatewayのログ上限はアカウント全体で10万件であること、既存ログがある場合は月約6万件でも収まる保証がないことを明記してください。
- Around line 646-648: Update the AI Gateway logging policy section in
architecture.md to explicitly require cf-aig-collect-log-payload: false or an
equivalent Gateway-side setting before stating that prompt and response bodies
are disabled by default. Distinguish this prerequisite from the metadata-only
policy and add a test that verifies payload logging is disabled.
---
Outside diff comments:
In `@docs/spec/ai-agent/architecture.md`:
- Around line 461-480: Clarify the Cloudflare AI Gateway guidance in the
architecture document so conversation requests do not use caching by default.
Specify applying cf-aig-skip-cache: true or disabling caching at the Gateway,
and limit any enabled caching to explicitly approved safe content such as static
FAQs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9ed756e6-9af6-4bd2-b9e3-4551fc62f1d8
📒 Files selected for processing (2)
docs/README.mddocs/spec/ai-agent/architecture.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/README.md
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnRRyAc1vPjnWCuBadp8cf
Fixes Applied SuccessfullyFixed 1 file based on 2 CodeRabbit feedback item(s). Files modified:
Commit: 対応内容:
The latest autofix changes are on the |
概要
Issue #6474 の成果物として、親 Issue #6473 の要件定義に基づく AI エージェントの PoC 設計書を追加します。曖昧な目的地の要望から実在する駅を最大 5 件提案し、既存の行き先決定フローに接続する機能の全体設計です。
変更の種類
変更内容
docs/spec/ai-agent/architecture.mdを新規追加trainlcd-workerの新設POST /agent/chatに集約し、Cloudflare AI Gateway 経由で GPT / Claude を呼ぶ)と 1 ターンの処理シーケンスを Mermaid 図で記載(AIエージェントの開発 #6473 実装備考の Mermaid 活用に対応)stationsByName実在確認 + サーバ側でツール結果と突合して幻覚提案を破棄する二段構え(MUST 要件対応)claude-opus-5/claude-haiku-4-5)のコスト試算を記載ai・@ai-sdk/*・zod・langsmithのみ、アプリ側はゼロ)DestinationAgentScreen、既存RouteSearchScreen選択ロジックの共有フック化、remoteConfigキルスイッチ)、レート制限、テスト戦略、段階的リリース計画、未決事項を整理docs/README.mdのドキュメント一覧に設計書へのリンクを追記テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること省略: コード本体(
src/等)に変更がないため。ドキュメントに対してはmarkdownlint-cli2(0 件)と Mermaid 図のレンダリング検証(mermaid-cli)を実施済み。関連Issue
Closes #6474
Refs #6473
スクリーンショット(任意)
Summary by CodeRabbit