匠人学院 JR Academy
  • Position

    Where am I now, and where should I go?

    How your job is changing, where your experience can take you and what you still need for a target role, worked out from what you have actually done. Free, and the full result needs no sign-up.

    Analyse my career and skills

    Look up a career

    Will AI replace my job?AI impact and transition paths for common careersNew jobs in the AI eraWhat they do, what they need, how to move in

    Focused tools

    AI Engineer interview readiness30 timed questions on what you still need before interviewsCareer personality testDirections that suit how you workReturning to China checkJob prospects in China by school, major and graduation date

    AI coach

    Talk to your AI coachStill unsure after your result? Talk through what is holding you back
  • Core courses

    AI Engineer BootcampEngineering bootcamp from LLM apps to agentsAI Engineer Full-Stack Project Class16 weeks · RAG and full-stack AI projectsVibe Coding Masterclass8 weeks · direct agents to build and ship a productAI Essentials10 hours · use AI for email, reports, data and copyAI Office Automation Course8 weeks · help a whole company adopt AIOne-Person Company (OPC) Bootcamp15 weeks in person · build a one-person company with AIAll courses →

    AI engineering

    Machine Learning & Data Engineering Full-Stack ClassAI Agent & MCP Project BootcampAI Engineer Core TechniquesAI Engineer FoundationsAI Engineer Advanced: RAG to Agents and TuningClaude Code TasterAll AI engineering courses →

    AI at work

    AI Coding for everyoneClaude Code One-Day Masterclass (Non-Technical)Enterprise AI Automation BootcampAI Marketing BootcampAI Risk, Governance and Audit CourseOpenClaw 4-Week Personal AI Assistant BootcampAll AI-at-work courses →

    Career development

    AI Product Manager (BA) Bootcamp + InternshipAustralia IT Interview BootcampAustralia IT Technical Interview BootcampAustralia IT Resume BootcampAustralia Big Tech Job Search BootcampAustralia IT Career Planning BootcampAll career courses →

    Learn free first

    Vibe CodingAI for office workPrompt MasterAI EngineerAI data analysisResource centerInstructorsAll learning paths →
  • Evidence

    What will convince an employer?

    Certifications, projects, team work and competition entries, collected into one portfolio.

    See the portfolio

    Certifications

    Cert Master · all certificationsPrep and mock exams for AWS, Azure, GCP, Claude and moreAWS CLF-C02Entry-level AWS cloud certificationAWS SAA-C03Entry certification for cloud architectsClaude certificationsAnthropic Claude certification seriesAll certifications →

    Projects and team work

    P3 team projectsBuild a project with real teammates in a simulated team workflowP3 project experienceThe parts of a P3 project that go on your resumeDemo DayProject showcaseP3 certificatesProof once a project is completeAll of P3 →

    Competitions and work

    HackathonsBuild something against the clockSubmit your workAdd your project to the showcaseCareerOS portfolioDo tasks in the desktop app; your results become portfolio pieces
    Cert MasterBrowser extension, app and mini programScreenshot a question for analysis and practise anywhereAbout Cert Master
  • Connect

    How do I get myself in front of employers?

    Resume, interviews, referrals and mentors. See how far you are from the target role first, then decide what to fix.

    Start with Jobpin

    Resume and openings

    Graduate careersGraduate preparation across Australia, China, Malaysia, Singapore, the US and UKJobpinAI job search workspace: resume, roles, applicationsAI resumeRewrite your resume against a job descriptionReferralsRoles shared by students and mentorsOpportunitiesInternships, projects and collaborationsOffer boardOffers students have received

    Interviews

    AI Engineer interview guideSeven areas, with worked examplesFDE interview guideFive rounds, from scoping to the customer roundAI mock interviewPractise by text or voice and see the gapsInterview storiesReal interview experiencesSystem Design handbookPrepare for system design interviewsAll interview prep →

    Mentors

    1:1 mentorsBook AI, career and technical mentors by the hourGroup tutoringShare a tutor with a few others and pay less eachCareer coachingResume, interview and direction packages
    Jobpin desktopOne workspace for the whole job searchOrganise real experience and refine resume versions for target roles on macOS or Windows.About Jobpin
BusinessMembershipDownload CareerOS
0
匠人学院 JR Academy

Follow Us

linkedinfacebooktwitterinstagramyoutube

We Accept

/image/layout/pay-paypal.png/image/layout/pay-visa.png/image/layout/pay-master-card.png/image/layout/pay-airwallex.png/image/layout/pay-alipay.png
Airbotix · AI learning & creation for kids Another Life · AI story game
Products46

CareerOS and tools

  • CareerOS
  • Cert Master
  • Jobpin
  • Jobpin web
  • Jobpin report
  • Jobpin desktop download
  • My job search reports
  • Buy report credits
  • Jobpin billing
  • AI Toolbox
  • AI Skill Marketplace

Membership

  • Membership
  • AI membership

Courses

  • Bootcamps
  • Training Camp
  • Kanban learning
  • AI Builder course
  • MCP course
  • NotebookLM workshop
  • Business Analyst course
  • Web Full-Stack Bootcamp
  • DevOps Bootcamp
  • Data Engineering Bootcamp
  • Data Analysis Bootcamp
  • Coding for Beginners
  • Algorithm Bootcamp

Career services

  • Graduate careers
  • Graduate careers in Australia
  • Graduate careers in China
  • Graduate careers in Malaysia
  • Graduate careers in Singapore
  • Graduate careers in the US
  • Graduate careers in the UK
  • 1:1 coaching
  • Career coaching
  • AI Engineer VIP
  • BA & PM Internship
  • Data Science Internship
  • Data Analysis Internship
  • Marketing Internship
  • Resume Review
  • Interview Coaching
  • Job Application Service
  • Job Monitoring
  • LinkedIn Management
  • LinkedIn Networking
Library57

Learning paths

  • All Learning Paths
  • AI Engineer
  • Context Engineering
  • Vibe Coding
  • Prompt Master
  • AI Builder
  • AI Product Manager
  • Python Basics
  • AI Productivity
  • AI Data Analysis
  • AI Finance
  • AI Content Creation
  • AI Image Creation
  • Frontend Development
  • Hermes Agent
  • OpenClaw Local Agent

Interactive labs

  • Prompt Lab
  • Frontend Lab
  • JavaScript Lab
  • Python Lab
  • AWS Lab
  • Azure Lab
  • LLM Lab
  • Git Lab

Reference and guides

  • Resources
  • Wiki
  • Cheat sheets
  • Roadmaps
  • AI roadmaps
  • Videos
  • Ebooks
  • Blog
  • Interview handbook
  • Mock exams
  • Free resources

Cities

  • Sydney
  • Melbourne
  • Brisbane
  • Adelaide
  • Singapore
  • Kuala Lumpur
  • London
  • New York
  • San Francisco
  • Los Angeles
  • Seattle
  • Toronto
  • Vancouver

Immigration

  • Australia Immigration
  • Skilled Visa 189/190/491
  • Employer Sponsored 482/186/494
  • Business Visa 188/888
  • UK Immigration
  • US Immigration
  • Canada Immigration
  • Singapore immigration
  • Malaysia immigration
Business20

For business

  • AI for Business
  • Business portal sign-in
  • Corporate Training
  • Internship Partnership
  • Recruitment Partnership
  • Enterprise (EN)

Metatree AI Lab

  • Metatree AI Lab (Chinese)
  • AI solutions (Chinese)
  • Digital employees (Chinese)
  • Case studies (Chinese)
  • Metatree AI Lab
  • AI services
  • Digital employees
  • Case studies

AI education for kids

  • Airbotix — AI Learning & Creation for Kids
  • AU Family Resource Hub
  • NAPLAN Report Guide
  • My School Data Guide
  • Sydney Private School Fees 2026
  • Kids Coding Programs
About15

Company

  • About Us
  • Our Mentors
  • Become a Mentor
  • Metaverse Classroom
  • JR Careers
  • Another Life — AI Story Game
  • Contact Us

Help and policies

  • FAQs
  • Terms & Conditions
  • Privacy Policy
  • Cancellation & Refund Policy
  • Site map

Friend links

  • CS Browser

Contact

  • hello@jiangren.com.au
  • 0421-672-555

Offices

Level 10b, 144 Edward Street, Brisbane CBD (Headquarter)
Level 2, 171 La Trobe St, Melbourne VIC 3000
45A13, Block B, Oriental Hope Tianxiang Plaza, 500 Tianfu Avenue Middle Section, Wuhou District, Chengdu, Sichuan, China
Business Hub, 155 Waymouth St, Adelaide SA 5000
Disclaimer
footer-disclaimerfooter-disclaimer

JR Academy acknowledges Traditional Owners of Country throughout Australia and recognises the continuing connection to lands, waters and communities. We pay our respect to Aboriginal and Torres Strait Islander cultures; and to Elders past and present. Aboriginal and Torres Strait Islander peoples should be aware that this website may contain images or names of people who have since passed away.

All content on the JR Academy website, including course materials, logos, and information provided, is protected under Australian intellectual property laws. Unauthorized use, sale, distribution, reproduction, or modification is strictly prohibited. Violations may result in legal action. By accessing our website, you agree to respect our intellectual property. JR Academy Pty Ltd reserves all rights, including patents, trademarks, and copyrights. Any infringement will be subject to legal prosecution. View Terms of Service

© 2017-2026 JR Academy Pty Ltd. All rights reserved.

ABN 26621887572

HomeLearnCoursesCerts
  1. Home
  2. Learn
  3. Blog
  4. n8n 自动化工作流实战指南 — n8n AI Agent 深度实战:Claude + 记忆 + 工具 + RAG 知识库
JR Academy · BlogCareer insights

n8n 自动化工作流实战指南 — n8n AI Agent 深度实战:Claude + 记忆 + 工具 + RAG 知识库

用 n8n 构建有记忆、会调工具、能查知识库的 Claude AI Agent——从单节点到 Human-in-the-Loop 完整实战

Published2026-11-30
Reading time3 min
Author

Contents

  • AI Agent 的完整结构
  • 接入 Claude(推荐 Sonnet 4)
  • 配置步骤
  • Memory:选对记忆类型
  • Window Buffer Memory(最常用)
  • Postgres Chat Memory(生产首选)
  • Simple Vector Store Memory(语义检索)
  • 给 Agent 配工具
  • HTTP Request Tool:调任意外部 API
  • Code Tool:让 AI 执行自定义逻辑
  • n8n Workflow Tool:调用子工作流
  • RAG 知识库:让 Agent 知道你的业务
  • 知识库搭建(一次性)
  • 实战:用 Qdrant 搭 JR Academy 课程知识库
  • Human-in-the-Loop:关键操作前人工审批
  • 配置方法
  • 完整实战:多工具 Claude 客服 Agent
  • 性能与成本控制

第2章的案例四(Telegram 客服 Bot)只是入门。这章深入讲 n8n AI Agent 的完整架构:选对记忆类型、给 Agent 配工具、接入向量数据库做 RAG,以及加上人工审批让 AI 不乱来。


AI Agent 的完整结构

n8n 的 AI Agent 节点基于 LangChain 构建,是一个编排层——它自己不做任何事,而是协调下面挂载的子节点:

AI Agent 节点
├── [Chat Model] 必填:提供语言能力(OpenAI / Claude / Gemini / Ollama)
├── [Memory]    可选:对话历史(没有就每次从零开始)
├── [Tool 1]    可选:让 AI 可以调用的"手"
├── [Tool 2]    可选:(可以挂多个工具)
└── [Tool N]    ...

每次用户发消息,Agent 的推理过程大致是:

  1. 读取 System Prompt + 历史对话(Memory)
  2. 思考:要不要调用工具?调哪个?传什么参数?
  3. 调工具 → 看结果 → 继续思考(可能循环多次)
  4. 输出最终答案

接入 Claude(推荐 Sonnet 4)

n8n 原生支持 Anthropic,直接搜 "Anthropic Chat Model" 节点。

配置步骤

  1. 创建 Anthropic Credential

    • 左侧菜单 → Credentials → Add → 搜 "Anthropic"
    • 填入 API Key(从 console.anthropic.com 获取)
  2. 在 AI Agent 的 Chat Model 插槽点击 +,选 "Anthropic Chat Model"

  3. 节点参数

    参数 推荐值 说明
    Model claude-sonnet-4-5 高性价比首选
    Max Tokens 4096 回答长度上限
    Temperature 0.3 降低随机性,让客服回复更稳定
  4. Claude 特有优势:超长上下文 + XML prompt

    Claude 支持 200K token 上下文,适合处理长文档场景。Prompt 用 XML 标签结构化效果最好:

    <role>你是 JR Academy 的课程顾问,专注澳洲 IT 就业辅导</role>
    
    <rules>
    - 只回答与 JR Academy 课程和澳洲 IT 行业相关的问题
    - 不透露内部定价政策,报价引导用户联系顾问
    - 遇到无法回答的问题说:我来帮你转接专业顾问
    - 所有回复控制在 150 字以内
    </rules>
    
    <context>
    {{ $json.companyBackground }}
    </context>
    

Memory:选对记忆类型

不同场景选不同 Memory 节点,选错了要么浪费资源要么数据丢失。

Window Buffer Memory(最常用)

保留最近 N 轮对话,按 Session Key 区分不同用户。

配置:
  Context Window Length: 10   (保留最近10轮,超出自动滚动丢弃)
  Session Key: {{ $("Telegram Trigger").item.json.message.chat.id }}

存储在 n8n 内存里,重启后丢失。适合:客服 Bot、轻量对话助手。

Postgres Chat Memory(生产首选)

把对话历史存到 PostgreSQL,重启不丢、支持多实例横向扩展。

配置:
  Table Name: n8n_chat_histories  (首次使用会自动建表)
  Session ID: {{ $("Webhook").item.json.userId }}
  Context Window Length: 20

适合:有数据持久化需求的正式产品。

Simple Vector Store Memory(语义检索)

把历史对话向量化,每次检索语义最相关的几条,而不是最近几条。适合历史很长但 token 预算有限的场景。


给 Agent 配工具

工具(Tool)是 Agent 的"手"——AI 自主决定何时调用、传什么参数。工具描述写得好不好,直接决定 AI 能不能用对工具。

HTTP Request Tool:调任意外部 API

Tool Name: get_exchange_rate
Description: 查询两种货币之间的汇率。当用户问到汇率或货币转换时调用。
             输入参数:from(源货币代码,如 AUD)、to(目标货币,如 CNY)
Method: GET
URL: https://api.exchangerate-api.com/v4/latest/{{ $fromTool.from }}

Code Tool:让 AI 执行自定义逻辑

// Tool Name: calculate_course_fee
// Description: 根据课程名称和折扣码计算最终价格
const coursePrices = {
  "Full Stack": 8990,
  "Data Analytics": 6990,
  "AI Engineering": 9990
};

const discounts = { "JR2026": 0.1, "EARLY": 0.15 };

const price = coursePrices[input.course] || 0;
const discount = discounts[input.code] || 0;
const final = price * (1 - discount);

return { original: price, discount: `${discount * 100}%`, final };

n8n Workflow Tool:调用子工作流

这是 2026 年最强大的工具——让一个 Agent 触发另一个独立的 workflow,实现多 Agent 协作:

Tool Name: search_knowledge_base
Description: 在 JR Academy 知识库中搜索课程、师资、就业数据等信息。
             当用户问具体课程内容、师资背景、就业率时调用。
Workflow: 选择 "知识库搜索 workflow"(独立 workflow,内部做 RAG)

RAG 知识库:让 Agent 知道你的业务

RAG(Retrieval-Augmented Generation)= 先从知识库检索相关段落,再让 AI 基于这些内容回答,避免 AI 胡编乱造。

知识库搭建(一次性)

[Document Loader](读 PDF/网页/Notion 等)
    ↓
[Text Splitter](切成 500-1000 字的块)
    ↓
[Embeddings](向量化,用 OpenAI text-embedding-3-small 或 Anthropic)
    ↓
[Vector Store](存到 Qdrant / Supabase PGVector / Pinecone)

n8n 原生支持的向量数据库:Qdrant、Pinecone、Supabase(pgvector)、Weaviate、MongoDB Atlas、Postgres PGVector。

实战:用 Qdrant 搭 JR Academy 课程知识库

Step 1:建立索引 workflow(手动跑一次)

Manual Trigger
    ↓
Read Binary Files(读取课程 PDF 文件夹)
    ↓
PDF Loader
    ↓
Recursive Character Text Splitter
  chunk_size: 800
  chunk_overlap: 100
    ↓
OpenAI Embeddings(text-embedding-3-small)
    ↓
Qdrant Vector Store(Operation: Insert, Collection: jr_academy_kb)

Step 2:查询 workflow(每次用户提问时调用)

Workflow Trigger(被主 Agent 调用)
    ↓
Qdrant Vector Store(Operation: Retrieve, Top K: 5)
    ↓
[连接到 AI Agent 的 Tool 插槽或直接返回结果]

Step 3:在主 AI Agent 的 System Prompt 里告诉它怎么用:

<tools_guidance>
当用户问到课程详情、价格参考、师资、就业数据时,
先调用 search_knowledge_base 工具获取准确信息,
基于返回的内容回答,不要凭空编造数据。
</tools_guidance>

Human-in-the-Loop:关键操作前人工审批

AI 不是永远可信的。对于高风险操作(发邮件、修改数据库、转账),在 n8n 里加一个人工审批节点,让 Agent "暂停等人确认"。

配置方法

在需要审批的 Tool 节点里开启 "Require human approval":

[AI Agent]
    └── [Tool: Send Promotional Email]
            ✅ Require Human Approval: ON

触发时,workflow 暂停并向指定渠道(Email/Slack/Telegram)发送审批请求:

🔔 AI 请求执行操作:
工具:发送促销邮件
收件人:zhangsan@example.com
内容摘要:Python 课程限时 8 折...

[✅ 批准] [❌ 拒绝]

点击按钮后 workflow 继续执行或放弃该工具调用。

哪些操作应该加审批:

  • 发送邮件 / 短信 / Slack 消息
  • 修改、删除数据库记录
  • 调用付费 API(防止 AI 循环调用导致账单暴涨)
  • 触发对外 Webhook(发送到第三方系统)

完整实战:多工具 Claude 客服 Agent

把上面所有内容组合成一个能实际上线的 Agent:

Chat Trigger(网站聊天窗口)
    ↓
AI Agent
  ├── [LLM] Anthropic Claude Sonnet 4
  ├── [Memory] Postgres Chat Memory(持久化,按用户 ID 隔离)
  ├── [Tool] search_knowledge_base(RAG,查课程知识库)
  ├── [Tool] get_course_schedule(HTTP Request,查开课日期 API)
  └── [Tool] create_inquiry(HTTP Request + 审批,创建 CRM 线索)
    ↓
Respond to Chat

System Prompt(完整版):

<role>
你是 JR Academy 的 AI 课程顾问 "小 JR"。
JR Academy 是澳洲专业 IT 职业培训机构,专注帮助华人移民进入 IT 行业。
</role>

<capabilities>
- 回答课程内容、学习方式、时长、适合人群
- 查询开课时间(调用 get_course_schedule)
- 查询详细课程信息(调用 search_knowledge_base)
- 收集用户意向,创建顾问跟进线索(调用 create_inquiry)
</capabilities>

<boundaries>
- 不承诺具体就业薪资
- 不透露内部折扣政策,引导用户联系顾问
- 不回答与 IT 培训无关的问题
</boundaries>

<style>
亲切自然,像朋友聊天而非正式客服。回复控制在 200 字以内。
适当用 emoji 增加亲和感,但不要过度。
</style>

这个 Agent 上线后可以处理 80% 以上的初步咨询,只有真正需要深入沟通的用户才转给人工顾问。


性能与成本控制

优化点 做法
降低 LLM 成本 分类问题先用 Haiku 判断,复杂问题才升级用 Sonnet
减少 RAG 检索次数 在 System Prompt 里指定何时才需要检索,避免每句话都查
Memory 控制 Token Window Buffer Length 设 10-15,超长对话用 Summary Memory 压缩
工具调用超时 所有 HTTP Request Tool 设置超时(建议 30s),超时后告诉用户重试
监控异常 配置 Error Workflow,AI Agent 出错立即推 Slack 告警
Author
Share or copy the link

Related certifications

Start with a few sample questions or a free chapter. The exam guide covers what the exam tests; the question bank lets you practise by exam domain.

Foundational

Claude Certified Architect – Foundations

CCAR-F

Sample questionsExam guide
Foundational

Claude Certified Developer – Foundations

CCDV-F

Question bankExam guide
Associate

Claude Certified Associate – Foundations

CCAO-F

Question bankExam guide

Related learning resources

  • AI learning hub
  • Prompt engineering
  • AI Engineer learning path
← Previous articlen8n 自动化工作流实战指南 — n8n 自托管部署完全指南:从零到生产环境Next article →n8n 自动化工作流实战指南 — n8n MCP 实战:让 Claude / Cursor 直接调用你的工作流

Related articles

🇦🇺测一下:袋鼠国码农能当FDE吗?

2026-12-01

Monash 研究:肠道酸度是膳食纤维降血压的关键;AI 搬运新闻冲击维州选举信息;MPAC 公布 2027 演出季

2026-12-01

Adelaide 物理学家获 $250,000 总理科学奖;全球葡萄酒消费六十年降四分之一;残障师范生实习障碍研究

2026-12-01

DVA-C03今日上线首发 · Google Cloud AI Agent认证完整解析 · AZ-401本月GA替代AZ-400

2026-12-01

Anthropic推迟下一代模型并调百人做安全,AWS推出AI办公三件套,Google让用户单独关掉AI训练

2026-12-01

GitHub Copilot 实战指南 — Copilot AI Code Review:30 秒让 AI 帮你审 PR,三档深度随需切换

2026-11-30
View all articles →

Done reading? Next steps

Not sure what to learn next? Tell us where you are

Tell us what you do now and where you want to go. See your gaps in skills, evidence, experience, expression and positioning, and what to work on first. No sign-in needed.

Compare with my situation
  • SkillAI Engineer Bootcamp13 weeks, 12 Theory + 13 Practice live classes. You build one Agent system across Context, RAG, Tools, Memory and production Evals. Built for Applied AI and Agent Engineer roles.See the program →
  • PositioningLearning roadmaps by roleFrontend, backend, data, AI and more, laid out stage by stage in the order to learn them.All roadmaps →
  • ExpressionTry an AI mock interviewPick a role and run a mock interview to practise explaining your experience and projects.Practise now →

Not sure what to do next?

Take this page's topic with you and see where your gaps are.

Compare with my situation
JR Academy
AI learning for the global Chinese community
BootcampsFree resourcesLearn AICareer coaching
精选推荐
AI Career Impact Map
Assess career exposure and explore transition paths and learning options
Popular tool
AI & Data Bootcamps
Build your skills through structured courses and hands-on projects
Popular courses
1:1 Career Coaching
Work with an experienced mentor on your resume and interview preparation
Career coaching
Custom Corporate Training
AI training tailored to your team
Business services
Popular tags
Vibe CodingAI codingCursorClaudeJob searchPromptFrontend developmentBackend development
Subscribe to updates

Receive AI learning resources, technical tutorials and career advice by email.

We respect your privacy and do not send spam.