Auto Marketing — Multi-Agent Architecture với n8n
Bài 9/21Thực hành

Bài 9 — Manager Agent: AI Agent Node + Tools (OpenAI/Gemini/Claude)

Cấu hình Tools Agent: System Prompt + sub-workflow tools cho Sheets, Docs, Drive, Publish.

35 min
Mục tiêu bài học
  • Cấu hình AI Agent node (Tools Agent) trên n8n Cloud
  • Viết System Prompt Manager 200–400 từ
  • Gắn 4 Tool: save_sheet, create_doc, upload_drive, publish_social
Expression / output AI Agent — preview quyết định tool được gọi
Manager Agent trả lời Telegram + log tool_calls vào Sheetdocs.n8n.io

Mô hình Manager Agent + Tooling

Thay vì hard-code Switch 20 nhánh, Manager Agent (Tools Agent) dùng LLM hiểu intent từ unified payload Bước 1, rồi gọi đúng Tool (sub-workflow). Đây là pattern AI kết hợp Tooling — cốt lõi Multi-Agent hiện đại trên n8n.

System Prompt Manager (mẫu)

Bạn là Manager Agent của hệ Auto Marketing [Tên startup].
Nhiệm vụ: phân tích input từ Telegram và gọi ĐÚNG tool.

Tools available:
- save_to_sheet: lưu/cập nhật sản phẩm CRM (Google Sheets)
- create_google_doc: tạo bản thảo bài đăng (Google Docs)
- upload_to_drive: lưu ảnh/video (Google Drive)
- generate_captions: AI tạo caption đa nền tảng
- publish_social: đăng qua Sage Marketing API
- get_report: lấy metrics tuần

Quy tắc:
1. Luôn xác nhận action trước khi publish
2. Ảnh/video → upload_to_drive trước, rồi generate_captions
3. Voice → transcribe (Whisper) rồi xử lý như text
4. Trả lời Telegram ngắn gọn, tiếng Việt

Cấu hình trên n8n Cloud

  1. Credentials → OpenAI API / Google Gemini / Anthropic (chọn 1)
  2. Thêm node AI Agent → Agent type: Tools Agent
  3. Dán System Prompt → Connect Chat Model (GPT-4o hoặc Gemini Flash)
  4. Thêm Tool Workflow nodes → trỏ wf-save-sheet, wf-create-doc, wf-upload-drive, wf-publish
  5. Input từ wf-input-normalizer qua Execute Workflow

Bài tập thực hành

  • Tạo wf-manager-agent với Tools Agent + 2 tool stub (save_sheet, upload_drive)
  • Test: gửi /product → Agent gọi save_to_sheet
  • Test: gửi ảnh → Agent gọi upload_to_drive
  • Log tool_calls vào Sheet tab AgentLog

Tiếp tục lộ trình

Hoàn thành từng bài thực hành để xây hệ Auto Marketing Multi-Agent của riêng bạn.

Bài 9 — Manager Agent: AI Agent Node + Tools (OpenAI/Gemini/Claude) — Auto Marketing — Multi-Agent Architecture với n8n | Sage Marketing