feat: AgentCore Runtime improvements — MCP server_instructions, iteration limit, Code Interpreter option, S3 link format#1526
Open
okamoto-aws wants to merge 17 commits intomainfrom
Open
feat: AgentCore Runtime improvements — MCP server_instructions, iteration limit, Code Interpreter option, S3 link format#1526okamoto-aws wants to merge 17 commits intomainfrom
okamoto-aws wants to merge 17 commits intomainfrom
Conversation
added 9 commits
April 9, 2026 22:52
The UI's LinkRenderer detects S3 URLs in Markdown links and converts them to presigned URLs for download. Without Markdown link format, S3 URLs for non-image files (e.g. .pptx) are rendered as plain text and cannot be downloaded.
- Revert cdk.json formatting noise and createGenericAgentCoreRuntime back to false (default) - Add agentCoreCodeInterpreterEnabled to correct location (default false) - Add agentCoreCodeInterpreterEnabled to English DEPLOY_OPTION.md - Remove sdpm-specific example from Japanese DEPLOY_OPTION.md - Update CDK test snapshots
e449f5c to
99e44aa
Compare
added 5 commits
April 9, 2026 23:24
Adds a write_file tool that allows agents to create and append to files under /tmp/ws without requiring Code Interpreter. This enables MCP tools that expect file paths (e.g. generate_pptx with slides_json_path) to work without the Code Interpreter sandbox isolation issue. Path traversal is prevented by requiring all paths to be under WORKSPACE_DIR.
Allows agents to fetch text content from URLs. HTML is automatically stripped of scripts/styles/tags for readability. Useful for reading documentation, reference materials, or API responses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AgentCore Runtime の汎用的な機能改善をまとめたPRです。MCP サーバーとの連携を強化し、ビルトインツールを拡充して、複雑なワークフローへの対応力を向上させます。
Changes
1. MCP Server Instructions の注入
MCP サーバーが提供する
server_instructionsを収集し、エージェントのシステムプロンプトに注入するようにしました。これにより、MCP サーバーが自身のツールの使い方をエージェントに直接伝えられるようになります。tools.py: MCP クライアント初期化時にserver_instructionsを収集agent.py: 収集した instructions をシステムプロンプトに追加server_instructionsサポートに必要)2. ARM64 platform 指定
x86_64 ホスト(Intel/AMD)で Docker ビルドする際に ARM64 イメージが正しくビルドされるよう、CDK の
platformを明示的に指定しました。3. DEFAULT_MAX_ITERATIONS 100
デフォルトのイテレーション上限を 20 → 100 に変更しました。複数ツールを組み合わせる複雑な MCP ワークフローでは 20 回では不足するケースがありました。
4. agentCoreCodeInterpreterEnabled オプション
AgentCore チャットで Code Interpreter を有効化するオプションを新設しました。
cdk.json/parameter.tsでagentCoreCodeInterpreterEnabled: trueを設定可能code_execution_enabledパラメータとして渡される5. S3 URL の Markdown リンク形式出力
upload_file_to_s3_and_retrieve_s3_urlで取得した S3 URL を、画像以外のファイル(.pptx, .csv, .pdf 等)でも Markdown リンク形式([filename](URL))で出力するようシステムプロンプトに追記しました。フロントエンドのLinkRendererが S3 URL を検出して presigned URL に変換するため、Markdown リンク形式でないとダウンロードリンクとして機能しません。6. ビルトインツールの拡充
AgentCore Runtime に以下のビルトインツールを追加しました:
write_file/tmp/ws配下へのファイル作成・追記・部分置換(str_replaceモード)concat_filesweb_fetchwrite_fileは Code Interpreter のサンドボックス分離問題を解決します。エージェントがホストのファイルシステムに直接ファイルを書き込めるため、MCP ツールがそのファイルを読み取れます。concat_filesは LLM の出力制限によるタイムアウトを回避するために、分割書き出し → 結合のワークフローを可能にします。web_fetchはエージェントが URL からドキュメントや参考資料を取得できるようにします。7. ドキュメント・テスト更新
agentCoreCodeInterpreterEnabledの説明を追加Testing
Breaking Changes
なし。全て後方互換性のある変更です。
agentCoreCodeInterpreterEnabledはデフォルトfalseで既存の動作に影響しません。Checklist
npm run cdk:testand updated snapshots withnpm run cdk:test:update-snapshot