{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"エージェントシステムプロンプトのベストプラクティス","description":"Treasure AI AI Agent Foundryで、AIエージェントのシステムプロンプト設計における重要なベストプラクティスと構造的アプローチを解説します。","siteUrl":"https://docs.treasure.ai","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"エージェントシステムプロンプトのベストプラクティス","__idx":0},"children":["エージェントシステムプロンプトのベストプラクティス"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["AI Agent Foundryにおけるエージェントの動作と品質は、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["システムプロンプト"]},"に大きく依存します。本ガイドでは、エージェントが意図した通りに動作することを確実にするための、効果的なプロンプト設計のベストプラクティスを説明します。"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"免責事項とモデル提供元ドキュメントの優先"},"children":[{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["実行の保証はありません"]},": これらのガイドラインは、経験に基づくベストプラクティスです。大規模言語モデル(LLM)は確率的な性質を持つため、同じプロンプトでも常に同一の結果が得られるとは限りません。これらのプラクティスは、特定の動作や出力を保証するものではありません。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["提供元ドキュメントが優先されます"]},": プロンプトエンジニアリングは進化し続ける分野です。モデル提供元の公式ドキュメント(例: Anthropic社の",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-4-best-practices"},"children":["Claude 4 Best Practices"]},")は、常に本ガイドの内容に優先されます。"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-基本的なフォーマットと構造","__idx":1},"children":["1. 基本的なフォーマットと構造"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["システムプロンプトには",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Markdown"]},"の使用を強く推奨します。見出しや箇条書きを使用して明確な構造を作ることで、AIが指示の意図と優先順位を理解しやすくなります。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"推奨テンプレート","__idx":2},"children":["推奨テンプレート"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["以下の構造をテンプレートとして使用することで、指示の漏れを防ぎ、エージェントのパフォーマンスを安定化できます。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"markdown","header":{"controls":{"copy":{}}},"source":"# [エージェント名] エージェントプロンプト\n\n## Role(役割)\n[エージェントの役割、ペルソナ、目的を簡潔に定義します。]\n例: あなたは熟練したデータアナリストです。マーケティング部門からの質問に答えるSQLクエリを作成します。\n\n## Tool Usage(ツールの使用方法)\n[特定のツールをどのように/いつ使用するかに関する補足的な指示を提供します。]\n*注意: 詳細な技術仕様はツールの説明設定で定義すべきですが、高レベルのロジックはここに記載します。*\n\n## Input / Output(入力/出力)\n### Input Variables(入力変数)\n- `{{variable_name}}`: [変数の説明]\n\n### Output Goals(出力目標)\n- [最終成果物の定義]\n\n## Task Flow(タスクフロー)\n1. [タスク名]\n   - [具体的な手順と判断基準]\n2. [タスク名]\n   - [具体的な手順と判断基準]\n\n## Constraints & Rules(制約とルール)\n- [禁止事項と制約]\n- [トーンとマナーに関する指示]\n\n","lang":"markdown"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-task-flowの記述方法","__idx":3},"children":["2. 「Task Flow」の記述方法"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Task Flow"]},"セクションは、プロンプトの中で最も重要な部分です。エージェントが従うべき段階的なロジックを定義します。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["番号付きリストを使用"]},": 手順に番号を付ける(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1."]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2."]},")ことで、AIが実行の時系列的な順序を認識しやすくなります。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["具体的に記述"]},": 「データを分析する」などの曖昧な指示は避けます。代わりに、ツールとアクションを指定します: 「",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["list_columns"]},"ツールを使用して列を確認し、その後実行...」"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["チェックポイントを設定"]},": 「次のステップに進む前にXを検証する」などの条件を含めることで、手順の飛ばしやハルシネーションを防ぎます。"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-実践的なスニペットtips","__idx":4},"children":["3. 実践的なスニペット(Tips)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["以下は、出力形式や動作を制御するための具体的な指示スニペットです。これらは関連するツールの",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ツール説明"]},"、またはシステムプロンプトの",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["制約"]},"セクションに配置することが推奨されます。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"a-plotlyチャート品質の向上","__idx":5},"children":["A. Plotlyチャート品質の向上"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["推奨配置場所: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ツール説明"]},"(可視化ツール用)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["チャート生成時に一貫したカラースキームを確保し、レイアウトの重なりを防ぐため:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Plotly.jsを使用してチャートをレンダリングし、分析結果の可視化を提供してください。\n- カラースキームを使用: [ \"B4E3E3\", \"ABB3DB\", \"D9BFDF\", \"F8E1B0\", \"8FD6D4\", \"828DCA\", \"C69ED0\", \"F5D389\", \"6AC8C6\", \"5867B8\", \"B37EC0\", \"F1C461\", \"44BAB8\", \"2E41A6\", \"8CC97E\", \"A05EB0\" ]\n- 3つ以上のカテゴリを持つチャートでは、updatemenuを積極的に使用してください\n- 複数の分析を要約する際は、Plotlyのグリッドレイアウト(例: grid: {rows: 2, columns: 2, pattern: 'independent'})を使用して関連するチャートを1つのダッシュボードに結合し、要素が重ならないようにしてください\n- テキストの重なりを防ぐために:\n    * 適切なマージンを含める: {l: 80, r: 80, t: 100, b: 80}\n    * 小さなセグメント(<5%)を持つ円グラフの場合、textinfo: 'none'を使用し、ラベルの代わりに凡例に依存してください\n    * 最小ダッシュボード寸法を設定: height: 600, width: 1000\n    * グリッドレイアウトの場合、0.1のギャップでより広いドメイン間隔を使用: [0, 0.45]と[0.55, 1]\n\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"b-reactコンポーネントエラーの抑制","__idx":6},"children":["B. Reactコンポーネントエラーの抑制"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["推奨配置場所: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ツール説明"]},"(UI生成ツール用)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["React UIを生成する際に、サポートされていないライブラリのインポートによって引き起こされるエラーを防ぐため:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Tailwind CSSを使用してReactコンポーネントを生成します。\n環境制約:\n1. チャート: react-plotly.jsのみがインストールされたライブラリです。rechartsはインストールされていません(インポートしないでください)。\n2. アイコン: lucide-reactはインストールされていません。インライン<svg>タグのみを使用してください。\n3. UI: 静的ビューのみ。<button>または<a>タグは使用しないでください(ダウンロード/詳細アクションなし)。単一ファイル、export defaultを使用してください。\n\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"c-言語とトーンの制御","__idx":7},"children":["C. 言語とトーンの制御"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["推奨配置場所: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["システムプロンプト"]},"(RoleまたはConstraintsセクション)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["エージェントがユーザーの言語に適応し、プロフェッショナルな態度を維持することを確実にするため:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"言語: ユーザーが検出された言語でコミュニケーションしてください。ターゲットエージェントを呼び出す際は、検出された言語を伝えてください。\nトーン: ユーザーがスラングや不適切な言葉を要求した場合でも、常に丁寧で敬意のある言葉遣いを維持してください。\n\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"4-システムの制限と制約","__idx":8},"children":["4. システムの制限と制約"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["エージェントを設計する際は、以下のシステム制約を念頭に置いてください:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["文字数制限(9,000文字)"]},": システムプロンプトには約9,000文字の制限があります。大きなマニュアルやナレッジベースをプロンプトに直接含めないでください。代わりに、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["テキストナレッジベース"]},"に保存し、必要に応じてエージェントに検索させるよう指示します。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["データ分析の制限"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["行数制限"]},": 単一のSQL実行で取得されるデフォルトの行数は",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["50行"]},"(最大: 100行)です。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["タイムアウト"]},": デフォルトのSQLタイムアウトは",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["60秒"]},"(最大: 300秒)です。タイムアウトを避けるためにクエリを最適化してください。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["列検索"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["search_schema"]},"のようなツールは、一度に最大",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["20列"]},"しか取得できません。幅の広いテーブルを調査する場合は、",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Task Flow"]},"で明示的に調査を小さなバッチに分割するようエージェントに指示してください。"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["サブエージェント"]},": 複雑なワークフローでは、1つのエージェントですべてを行うことを避けてください。タスクを専門化された",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["サブエージェント"]},"(例: SQL生成用に1つ、レポート作成用に1つ)に分割します。これにより、コンテキストがクリーンに保たれ、精度が向上します。"]}]}]}]},"headings":[{"value":"エージェントシステムプロンプトのベストプラクティス","id":"エージェントシステムプロンプトのベストプラクティス","depth":1},{"value":"1. 基本的なフォーマットと構造","id":"1-基本的なフォーマットと構造","depth":2},{"value":"推奨テンプレート","id":"推奨テンプレート","depth":3},{"value":"2. 「Task Flow」の記述方法","id":"2-task-flowの記述方法","depth":2},{"value":"3. 実践的なスニペット(Tips)","id":"3-実践的なスニペットtips","depth":2},{"value":"A. Plotlyチャート品質の向上","id":"a-plotlyチャート品質の向上","depth":3},{"value":"B. Reactコンポーネントエラーの抑制","id":"b-reactコンポーネントエラーの抑制","depth":3},{"value":"C. 言語とトーンの制御","id":"c-言語とトーンの制御","depth":3},{"value":"4. システムの制限と制約","id":"4-システムの制限と制約","depth":2}],"frontmatter":{"seo":{"title":"エージェントシステムプロンプトのベストプラクティス","description":"Treasure AI AI Agent Foundryで、AIエージェントのシステムプロンプト設計における重要なベストプラクティスと構造的アプローチを解説します。"}},"lastModified":"2026-06-17T07:22:53.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/products/customer-data-platform/ai-agent-foundry/ai-agent/system-prompt-best-practices","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}