Run production AI agents in n8n with Amazon Bedrock AgentCore harness
https://aws.amazon.com/blogs/machine-learning/run-production-ai-agents-in-n8n-with-amazon-bedrock-agentcore-harness/📌 【AWS 新功能】在 n8n 中打造生產級 AI Agent:透過 Amazon Bedrock AgentCore 實現持久記憶與工具調用
TL;DR:透過新推出的開源 n8n 節點,無需撰寫基礎設施程式碼,即可在 n8n 中使用 AgentCore 架構部署具備持久記憶與工具能力的 AI Agent。
🎣 從單次模型調用到生產級 Agent 的鴻溝
在 n8n 中使用內建的 AI Agent 節點來進行單次模型調用(Model Call)非常方便,但要將其推向「生產環境」,僅有模型是不夠的。一個真正的生產級 Agent 需要具備以下能力:
- 持久記憶:能夠跨越單次執行流程保留對話狀態。
- 工具使用:能夠操作瀏覽器或在程式碼沙箱(Code Sandbox)中執行指令。
- 任務處理能力:能夠處理複雜且長期的任務,而非僅僅是單次問答。
開發這些「腳手架」(Scaffolding)通常是工程師最耗時的部分。
🧩 Amazon Bedrock AgentCore:為 Agent 提供運作骨架
Amazon Bedrock AgentCore 是一個用於大規模構建、連接與最佳化 Agent 的平臺。其核心能力 AgentCore harness 現已正式發佈(GA),它扮演了「架構支撐」的角色。
當模型負責「推理」時,Harness 則負責「執行」:
- 執行編排迴圈(Orchestration loop)。
- 調用工具(Call tools)。
- 管理上下文視窗(Context window)。
- 維持跨回合的狀態(State across turns)。
- 從錯誤中恢復並隔離每個會話(Session isolation)。
🎯 整合至 n8n:無需基礎設施程式碼的視覺化開發
透過全新的開源社群節點 @aws/n8n-nodes-agentcore,你可以直接在 n8n 的視覺化編輯器中調用完整的 AgentCore 架構。
💡 關鍵特性與設計理念
- 多模型支援:不綁定單一供應商,支援 Amazon Bedrock、OpenAI、Google Gemini 以及所有由 LiteLLM 支援的供應商;甚至可以在同一個對話的不同回合間切換模型。
- 記憶體層級結構:
- Agent 層:持有共享的配置。
- Actor ID 層:將不同使用者的記憶體進行隔離。
- Session ID 層:在同一個使用者內,隔離不同的對話紀錄。
- 工具與技能(Skills):支援加入程式碼解釋器(Code Interpreter)、雲端瀏覽器、遠端 MCP 伺服器,以及從 S3 或 Git 載入的「技能包」(Skills)。
- VPC 私有化部署:支援在你的虛擬私有雲(VPC)中運行,確保 Agent 在私有網路環境下運作。
📊 實作流程與開發重點
在 n8n 中配置該節點時,主要透過 Harness ARN 進行操作。開發流程大致如下:
- 配置憑證:使用與 AWS Lambda 或 S3 節點相同的 AWS 憑證模式。
- 啟動 Agent:首次執行時,AWS 會自動配置 Agent(約需 30-60 秒),並自動建立受管理的記憶體儲存空間。
- 建立記憶:透過提供相同的
Session ID,Agent 能從先前的對話中讀取資訊(例如:記住使用者的飲食偏好)。 - 賦予工具:例如加入一個沙箱環境下的程式碼解釋器,讓 Agent 能精準計算平均值或標準差,而非僅靠模型估算。
- 部署至 VPC:設定 Subnet 與 Security Group,讓 Agent 可以在不經由 NAT Gateway 的情況下,透過 VPC Endpoint 存取 ECR 與 S3。
⚠️ 注意事項與成本管理
- 權限原則:建議使用 AWS IAM Identity Center 或 STS 的臨時憑證,並遵循最小權限原則。
- 資源清理:AgentCore harness、受管理的記憶體儲存空間以及 VPC Endpoints 均會產生 AWS 費用。完成測試後,請務必刪除不再需要的資源。
🎯 實務啟示
對於需要將 AI 流程從「實驗」轉向「生產」的工程師來說,AgentCore harness 解決了最困難的基礎設施層面問題。透過 n8n 的視覺化介面,開發者可以快速驗證「具備記憶與工具能力」的 Agent 邏輯,而無需從零開始撰寫複雜的編排與狀態管理程式碼。
🔗 來源
- 標題:Run production AI agents in n8n with Amazon Bedrock AgentCore harness
- 作者/機構:Sundar Raghavan @ AWS ML
- 連結:https://aws.amazon.com/blogs/machine-learning/run-production-ai-agents-in-n8n-with-amazon-bedrock-agentcore-harness/
#AI #n8n #AmazonBedrock #AgentCore #AWS #MachineLearning #AIAgents #Automation #OpenSource #CloudComputing
原始資料 AWS ML · 收集於 2026-08-06
摘要原文
If you build and automate workflows in n8n without writing much code, you’ve probably used its AI Agent node to add a model call to a workflow. It’s a great start. But a production agent needs more than a single model call: memory that lasts beyond one run, tools it can actually use like a browser or a code sandbox, and room to work through longer tasks. Building that scaffolding yourself is the hard part. Amazon Bedrock AgentCore is a platform to build, connect, and optimize agents at scale, with any framework or model. AgentCore harness, a capability of Amazon Bedrock AgentCore, is now generally available and provides that scaffolding for you. A new open-source community node brings it into n8n’s visual editor. You get production agents with persistent memory, real tools, and the model provider of your choice, without writing infrastructure or agent code. You’re not tied to one model either. The node works with Amazon Bedrock, OpenAI, Google Gemini, and LiteLLM-supported providers, and you can switch providers between turns of the same conversation. In this post, you will install the node, @aws/n8n-nodes-agentcore , and build agents step by step in the n8n editor. You will start with an agent that remembers a conversation, scope memory to individual users, add a code interpreter tool, give the agent skills, and finish by running an agent privately in your own virtual private cloud (VPC). The node is open source under the MIT license, and AgentCore harness is powered by Strands Agents , the open source agent framework from AWS. An agent is more than a model. The model reasons, but the harness does the work around it: it runs the orchestration loop, calls tools, manages the context window, keeps state across turns, recovers from failures, and isolates each session. Building that layer is where most teams spend their time. AgentCore harness gives you that layer as a managed capability. You define an agent in configuration, including the model it uses, the tools it calls, the skills it has access to, and the instructions it follows, and AgentCore assembles and runs the loop for you. Each session runs in its own isolated environment with a filesystem and shell, memory across sessions, and web browsing. When configuration isn’t enough, you can export the harness to Strands code and keep running on the same system. n8n’s built-in AI Agent node is a good fit for a single model call in a workflow. The community node goes further by exposing the full harness in the n8n editor. It has one operation with a single deciding field, Harness ARN : The node uses the same AWS credential pattern as the existing n8n AWS Lambda and Amazon Simple Storage Service (Amazon S3) nodes , so it feels familiar if you already automate AWS services in n8n. Before you begin, make sure you have the following: Important: Where you can, use temporary credentials from AWS IAM Identity Center or AWS Security Token Service (AWS STS), and follow the principle of least privilege when you configure IAM permissions. Don’t commit credentials to source control. Note on cost : The AgentCore harness, the managed memory store it provisions, and (if you use it) VPC endpoints are billed AWS resources. Follow the Clean up section at the end to remove what you create for this walkthrough, and refer to the AgentCore documentation for pricing. You configure the AWS credential once, the same way you would for other AWS nodes in n8n. Amazon Bedrock AgentCore API credential in n8n, showing the access key, Region, and execution role ARN, with a successful connection test In this walkthrough, you build an agent that remembers details across turns of a conversation. Memory is on by default, so the node provisions a managed memory store for you and there’s nothing extra to configure. The first run takes about 30-60 seconds while AWS provisions the agent. The output includes the agent’s response, token usage, and a summary of what the node provisioned, including the memory store it created for you. Turn 1. The node output shows the agent’s response and a harness summary that confirms managed memory with a provisioned memory ARN. Now change only the Prompt to Suggest one destination and one dish I’d enjoy, based on what you know about me , keep the same session ID, and run again. Turn 2. The agent recalls the preferences from turn 1, warm beaches and vegetarian, because the conversation persisted through the same session ID. The output field sessionSource reads provided when you supply a session ID, and the input token count rises on turn 2 because the node loads the prior conversation before the agent reasons. If you leave the session ID blank, each run starts a new conversation. When one agent serves many people, you can keep each person’s memory separate with an Actor ID . Memory is scoped by actor and session, so different actors get isolated histories from the same agent. The scoping is a hierarchy: the agent holds the shared configuration, the Actor ID isolates one user’s memory from another’s, and the Session ID isolates individual conversations within an actor. One actor can have many sessions. A different actor with the same session ID still gets its own separate memory. The node configured with an actor ID and session ID for a specific user. Turn 1 for the actor user-alice, which stores a preference. Turn 2 for the same actor. The agent returns the value it stored for this user. A different actor ID keeps its own separate memory. Agents become far more capable when they can use tools. In this walkthrough, you give the agent a code interpreter that runs code in a sandboxed environment. The agent writes and runs code in the sandbox and returns computed results for the mean, median, and standard deviation, rather than estimating them. The harness summary shows one tool configured. You add other tools the same way, including a cloud browser, AgentCore Gateway (a capability of Amazon Bedrock AgentCore), and remote Model Context Protocol (MCP) servers. Skills are bundles of instructions and scripts that give an agent domain knowledge on demand. You load them from the AWS curated catalog, a Git repository, Amazon S3, or a filesystem path, and the harness loads them only when the task calls for them. The agent applies the loaded skills to produce guidance, and the harness summary shows the number of skills configured. For agents that need private network access, you can run the harness in your VPC. You set the network configuration on the credential, so every agent that credential provisions runs privately. The credential configured for VPC mode with subnet and security group IDs. Your subnets don’t need internet access. The harness pulls its managed container image from a private Amazon ECR repository in the same Region, so you need VPC endpoints for Amazon ECR and Amazon S3 rather than a NAT gateway. Refer to the AgentCore harness network configuration documentation for the required endpoints and the execution role permissions. Refer to the AgentCore harness security documentation for the required endpoints and the execution role permissions. The node output for a VPC agent. The harness summary shows the network mode is VPC. Each agent you create is a harness resource in your AWS account, and it can provision a managed memory store. To avoid ongoing charges, delete the agents you no longer need. If you enabled a VPC, you might also want to remove any interface VPC endpoints you created for this walkthrough, because interface endpoints incur charges while they exist. This post walked through memory, per-user scoping, a code interpreter tool, skills, and VPC networking. The node already supports more of the Amazon Bedrock AgentCore harness feature set. Here’s what to try next, each configured the same way you configured the features above: The examples folder in the GitHub repository includes importable workflows for many of these.
由 tencent/hy3:free 自動生成