Quick Guide to Using Jules

Jules is Google’s asynchronous AI coding agent that integrates directly with your GitHub repositories to perform tasks like fixing bugs, writing tests, building new features, and bumping dependency versions.

Getting Started:

  1. Connect GitHub: Visit jules.google, select your repository and branch

  2. Assign Tasks: Write a detailed prompt for Jules, or add the “jules” label to a GitHub issue

  3. Jules Works: Jules fetches your repository, clones it to a Cloud VM, and develops a plan using the latest Gemini 2.5 Pro model Jules – An Asynchronous Coding Agent

  4. Review & Approve: Jules provides a diff of the changes for you to browse and approve
  5. Create PR: Once approved, Jules creates a pull request for you to merge and publish on GitHub

Anthropic giới thiệu mô hình lập trình đỉnh nhất thế giới Claude Sonnet 4.5

Trong thế giới AI đang thay đổi từng ngày, các mô hình ngôn ngữ lớn (LLM — Large Language Models) không chỉ dừng lại ở khả năng hiểu – sinh văn bản, mà đang tiến sang khả năng tương tác thực tế, thực thi công cụ, duy trì trạng thái lâu, và hỗ trợ tác vụ đa bước. Claude của Anthropic là một trong những cái tên nổi bật nhất trong cuộc đua này — và phiên bản mới nhất Sonnet 4.5 được định vị như một bước nhảy quan trọng.

“Claude Sonnet 4.5 is the best coding model in the world. It’s the strongest model for building complex agents. It’s the best model at using computers.”Anthropic

1. Giới thiệu

Trong vài năm gần đây, các mô hình như GPT (OpenAI), Gemini (Google / DeepMind), Claude (Anthropic) đã trở thành xương sống của nhiều ứng dụng AI trong sản xuất, công việc hàng ngày và nghiên cứu. Nhưng mỗi dòng mô hình đều chọn hướng “cân bằng” giữa sức mạnh và an toàn, giữa khả năng sáng tạo và kiểm soát.

Claude, từ khi xuất hiện, đã xác định con đường của mình: ưu tiên an toàn, khả năng tương tác công cụ (tool use), kiểm soát nội dung xấu. Đặc biệt, dòng Sonnet của Claude được dùng như phiên bản “cân bằng” giữa các mô hình nhẹ hơn và các mô hình cực mạnh (Opus).

Vào ngày 29 tháng 9 năm 2025, Anthropic chính thức ra mắt Claude Sonnet 4.5, phiên bản được quảng bá là mạnh nhất trong dòng Sonnet, và là mô hình kết hợp tốt nhất giữa cấu trúc mã, khả năng dùng máy tính và agent phức tạp.

Thông báo chính thức khẳng định Sonnet 4.5 không chỉ là nâng cấp nhỏ mà là bước tiến lớn: nó cải thiện đáng kể khả năng lập trình, tương tác công cụ, reasoning & toán học, đồng thời giữ chi phí sử dụng không đổi với Sonnet 4 trước đó.

2. Những điểm nổi bật & cải tiến từ thông báo chính thức

2.1 “Most aligned frontier model” — Mô hình tiên phong có alignment cao nhất

Anthropic mô tả Sonnet 4.5 là mô hình hiện đại có alignment tốt nhất mà họ từng phát hành. Họ cho biết rằng so với các phiên bản Claude trước đây, Sonnet 4.5 đã giảm đáng kể các hành vi không mong muốn như:

  • Sycophancy (lấy lòng người dùng quá mức)
  • Deception (lừa dối hoặc đưa thông tin sai)
  • Power-seeking (tự nâng quyền lực)
  • Khuyến khích ảo tưởng hoặc suy nghĩ sai lệch (encouraging delusional thinking)

Ngoài ra, để đối phó với rủi ro khi mô hình tương tác với công cụ (agent, prompt injection), họ đã có những bước tiến cải thiện trong bảo vệ chống prompt injection — một trong những lỗ hổng nghiêm trọng nhất khi dùng mô hình kết hợp công cụ.

Sonnet 4.5 được phát hành dưới AI Safety Level 3 (ASL-3), theo khung bảo vệ của Anthropic, với các bộ lọc (classifiers) để phát hiện các input/output có nguy cơ cao — đặc biệt liên quan đến vũ khí hóa học, sinh học, hạt nhân (CBRN).

Họ cũng nói rõ: các bộ lọc đôi khi sẽ “cảnh báo nhầm” (false positives), nhưng Anthropic đã cải thiện để giảm tỷ lệ báo nhầm so với trước — kể từ phiên bản Opus 4, tỷ lệ nhầm được giảm mạnh.

Việc đưa thông tin này vào blog (với giải thích dễ hiểu) sẽ giúp độc giả thấy rằng Sonnet 4.5 không đơn thuần là “thêm mạnh hơn”, mà cũng là “thêm an toàn”.

2.2 Nâng cấp công cụ & trải nghiệm người dùng

Một loạt tính năng mới và cải tiến trải nghiệm được Anthropic công bố:

  • Checkpoints trong Claude Code: Bạn có thể lưu tiến độ và “quay lui” về trạng thái trước đó nếu kết quả không như ý.
  • Giao diện terminal mới & extension VS Code gốc: để người dùng phát triển dễ dùng hơn trong môi trường quen thuộc.
  • Context editing (chỉnh ngữ cảnh) & memory tool trong API: giúp agent chạy dài hơi, duy trì bối cảnh xuất hiện trong prompt, xử lý phức tạp hơn.
  • Trong ứng dụng Claude (trên web/app), tích hợp thực thi mã (code execution)tạo file (spreadsheet, slide, document) ngay trong cuộc hội thoại.
  • Claude for Chrome extension (cho người dùng Max) — giúp Claude tương tác trực tiếp qua trình duyệt, lấp đầy form, điều hướng web, v.v.
  • Claude Agent SDK: Anthropic mở nền tảng cho các nhà phát triển xây dựng agent dựa trên cơ sở mà Claude dùng. SDK này chứa các thành phần họ đã phát triển cho Claude Code: quản lý memory, quyền kiểm soát, phối hợp sub-agent, v.v.
  • Research preview “Imagine with Claude”: một chế độ thử nghiệm cho phép Claude tạo phần mềm “on the fly”, không dùng mã viết sẵn, phản ứng tương tác theo yêu cầu của người dùng — được mở cho người dùng Max trong 5 ngày.

Những điểm này là “chất” để bạn thêm vào blog khiến nó hấp dẫn và mang tính cập nhật kỹ thuật cao.

2.3 Hiệu năng & benchmark đáng chú ý

Anthropic cung cấp các con số benchmark để thể hiện bước nhảy lớn của Sonnet 4.5:

  • Trên SWE-bench Verified (benchmark chuyên về khả năng lập trình thực tế), Sonnet 4.5 được cho là state-of-the-art.
  • Họ dùng phép thử: 77,2 %, tính trung bình 10 lần thử nghiệm, không dùng thêm compute khi test, và budget “thinking” 200K tokens.
  • Với cấu hình 1M context, có thể đạt 82,0 %.
  • Trên OSWorld (benchmark thử AI sử dụng máy tính thực: tương tác máy tính, trang web, file, lệnh), Sonnet 4.5 đạt 61,4 %, vượt Sonnet 4 trước đó (42,2 %).
  • Trong các lĩnh vực chuyên môn như tài chính, y tế, luật, STEM, Sonnet 4.5 thể hiện kiến thức và reasoning tốt hơn so với các mô hình cũ (bao gồm Opus 4.1).
  • Anthropic cũng nói rằng người dùng đã thấy mô hình giữ “focus” trong hơn 30 giờ khi thực hiện tác vụ phức tạp đa bước.

Khi bạn đưa vào blog, bạn nên giải thích những con số này (ví dụ: SWE-bench là gì, OSWorld là gì), để độc giả không chuyên cũng hiểu giá trị của việc tăng từ 42 % lên 61 %, hay “giữ 30 giờ” là gì trong bối cảnh AI.

2.5 Ưu điểm về chi phí & khả năng chuyển đổi

Một điểm rất hấp dẫn mà Anthropic nhấn mạnh: giá sử dụng Sonnet 4.5 giữ nguyên như Sonnet 4 — không tăng phí, vẫn là $3 / $15 per million tokens (theo gói)

Họ cũng nhấn rằng Sonnet 4.5 là bản “drop-in replacement” cho Sonnet 4 — tức là nếu bạn đang dùng Sonnet 4 qua API hay ứng dụng Claude, bạn có thể chuyển sang Sonnet 4.5 mà không cần thay đổi nhiều.

Điều này làm tăng sức hấp dẫn của việc nâng cấp từ các phiên bản cũ lên Sonnet 4.5 — vì bạn được lợi nhiều hơn mà không phải trả thêm.

2.6 Thông tin kỹ thuật & lưu ý từ hệ thống (system card)

Trong thông báo, Anthropic cũng nhắc đến system card đi kèm Sonnet 4.5 — nơi họ công bố chi tiết hơn về các đánh giá an toàn, mitigations, phương pháp thử nghiệm, các chỉ số misaligned behaviors, cách họ đo lường prompt injection, v.v.

Ví dụ, trong system card có:

  • Biểu đồ “misaligned behavior scores” (hành vi lệch chuẩn) — càng thấp càng tốt — được đo qua hệ thống auditor tự động.
  • Phương pháp thử nghiệm và footnotes cho các benchmark: cách họ test SWE-bench, OSWorld, Terminal-Bench, τ2-bench, AIME, MMMLU, Finance Agent.
  • Ghi chú rằng các khách hàng trong ngành an ninh mạng, nghiên cứu sinh học, v.v. có thể được vào allowlist nếu cần vượt hạn chế CBRN.

3. Những cải tiến chính trong phiên bản 4.5

3.1 Hiệu năng lập trình & agent

Một trong những điểm mạnh lớn mà Sonnet 4.5 hướng tới là năng lực lập trình thực tế. Trên benchmark SWE-bench Verified, nó đạt ~ 77,2 % (khi test với scaffold, không dùng thêm compute), và ở cấu hình 1M context có thể lên đến ~ 82,0 %. Trong các thử nghiệm nội bộ, nó có thể giữ trạng thái làm việc liên tục hơn 30 giờ cho các tác vụ phức tạp.

Khi so sánh với Sonnet 4 trước đó, Sonnet 4.5 đạt 61,4 % trên benchmark OSWorld (AI thực thi máy tính thực tế), trong khi Sonnet 4 chỉ có ~ 42,2 %. Đây là bước nhảy lớn trong khả năng AI “dùng máy tính như người dùng thật”.

Ngoài ra, Sonnet 4.5 được thiết kế để thực thi nhiều lệnh song song (“parallel tool execution”) — ví dụ chạy nhiều lệnh bash trong một ngữ cảnh — giúp tận dụng tối đa “actions per context window” (số hành động trên khung ngữ cảnh) hiệu quả hơn.

3.4 Trải nghiệm người dùng & công cụ hỗ trợ

Sonnet 4.5 không chỉ mạnh mà còn dễ dùng:

  • Checkpoints trong Claude Code: cho phép người dùng lưu trạng thái, quay trở lại nếu cần.
  • Giao diện terminal mới, extension VS Code tích hợp gốc — giúp developer làm việc trong môi trường quen thuộc.
  • Context editing (chỉnh ngữ cảnh) và memory tool trong API: giúp agent theo dõi ngữ cảnh, nhớ các bước trước và hoạt động trong tác vụ dài hơn.
  • Trong ứng dụng Claude (app/web): hỗ trợ thực thi mãtạo file (spreadsheet, slide, document) ngay trong cuộc hội thoại — không cần chuyển sang công cụ ngoài.
  • Claude for Chrome: tiện ích mở rộng cho người dùng Max — giúp Claude tương tác trực tiếp với trang web: điều hướng, điền form, xử lý các tương tác web.
  • Claude Agent SDK: Anthropic mở mã để người dùng / developer xây agent dựa trên nền tảng mà Claude sử dụng — từ memory management đến phối hợp sub-agent, quyền kiểm soát, v.v.
  • Imagine with Claude: bản thử nghiệm (research preview) cho phép Claude “sáng tạo phần mềm on the fly” — nghĩa là không có phần mã viết sẵn, mà mô hình tự sinh & điều chỉnh theo yêu cầu người dùng. Được cung cấp cho người dùng Max trong 5 ngày.
3.3 An toàn và alignment

Sonnet 4.5 không chỉ mạnh mà còn chú trọng an toàn:

  • Áp dụng các bộ lọc (classifiers) để phát hiện các input/output nguy hiểm, đặc biệt trong các lĩnh vực CBRN — nhằm hạn chế khả năng sử dụng mô hình cho vũ khí hóa học, sinh học, hạt nhân.
  • Các bộ lọc này đôi khi “cảnh báo nhầm” (false positives), nhưng Anthropic đã cải tiến để giảm tỷ lệ này: so với trước, giảm 10× từ bản gốc, và giảm 2× so với Opus 4.
  • Việc phát hành ở mức AI Safety Level 3 (ASL-3) cho thấy Anthropic đặt giới hạn truy cập và bảo vệ bổ sung theo khả năng mô hình.
  • Biểu đồ “misaligned behavior scores” (điểm hành vi lệch chuẩn) được công bố — thể hiện mức độ giảm các hành vi như deception, sycophancy, power-seeking, khuyến khích ảo tưởng.
  • Bảo vệ chống prompt injection được cải thiện đáng kể, đặc biệt quan trọng khi mô hình dùng công cụ/agent.

Những yếu tố này rất quan trọng để người dùng tin tưởng dùng Sonnet 4.5 trong môi trường sản xuất, doanh nghiệp, ứng dụng thực tế.

3.4 Chi phí & chuyển đổi dễ dàng

Một điểm hấp dẫn là giá vẫn giữ như Sonnet 4: không tăng phí, vẫn là $3/$15 per million tokens (tùy gói)

Anthropic cho biết Sonnet 4.5 là drop-in replacement — tức nếu bạn đang dùng Sonnet 4 qua API hoặc ứng dụng, bạn có thể chuyển sang Sonnet 4.5 mà không cần thay đổi nhiều code hoặc cấu hình.

Đây là chi tiết quan trọng để độc giả của blog thấy rằng “nâng cấp” không đồng nghĩa “tăng chi phí lớn”.

4. Ứng dụng thực tiễn & tiềm năng nổi bật

Với những cải tiến kể trên, Claude Sonnet 4.5 có thể được ứng dụng mạnh trong nhiều lĩnh vực — phần này bạn có thể minh họa thêm bằng ví dụ thực tế trong blog của bạn.

4.1 Lập trình & phát triển phần mềm

  • Tạo mã (code generation) từ module nhỏ đến hệ thống lớn
  • Tự động sửa lỗi, refactor code, test, deploy
  • Phối hợp agent để quản lý dự án lập trình — chia nhỏ tác vụ, kiểm soát tiến độ
  • Hỗ trợ developer trong IDE (nhờ extension VS Code)

Ví dụ từ Anthropic: Sonnet 4.5 có thể hiểu mẫu mã code của một codebase lớn, thực hiện debug và kiến trúc theo ngữ cảnh cụ thể của dự án.

4.2 Ứng dụng doanh nghiệp & phân tích

  • Tự động hóa quy trình nội bộ: trích xuất, tổng hợp báo cáo, phân tích dữ liệu
  • Hỗ trợ phân tích tài chính, mô hình rủi ro, dự báo
  • Trong lĩnh vực pháp lý: phân tích hồ sơ kiện tụng, tổng hợp bản ghi, soạn bản nháp luật, hỗ trợ CoCounsel (như trích dẫn trong bài)
  • Trong an ninh mạng: red teaming, phát hiện lỗ hổng, tạo kịch bản tấn công (Anthropic trích dẫn việc Sonnet 4.5 được dùng cho các công ty an ninh mạng để giảm “vulnerability intake time” 44 % và tăng độ chính xác 25 %)

4.3 Trợ lý ảo – công việc văn phòng

  • Trong ứng dụng Claude: tạo slide, bảng tính, file văn bản trực tiếp từ cuộc hội thoại
  • Hỗ trợ xử lý email, lập kế hoạch, tổng hợp nội dung, viết báo cáo
  • Tương tác với nhiều hệ thống qua API, làm các tác vụ đa bước

4.4 Agent thông minh & tác vụ liên tục

Nhờ khả năng duy trì ngữ cảnh, nhớ lâu và tương tác công cụ, Sonnet 4.5 rất phù hợp để xây agent đa bước, làm việc liên tục qua nhiều giờ:

  • Quản lý dự án (lập kế hoạch → giám sát → báo cáo)
  • Agent giám sát, tự động hóa pipeline (CI/CD, triển khai sản phẩm)
  • Agent tương tác đa hệ thống (hệ thống CRM, ERP, API bên ngoài)
  • Agent tự điều chỉnh dựa trên phản hồi mới

Anthropic nhắc rằng Sonnet 4.5 có thể “giữ 30+ giờ tự chủ trong mã” — tức là trong tác vụ lập trình liên tục, mô hình vẫn giữ mạch lạc và không “rơi rụng”.

5. So sánh Sonnet 4.5 với các mô hình khác & ưu nhược điểm

Phần này giúp độc giả định vị Sonnet 4.5 trong “bản đồ AI” hiện tại.

5.1 So với Claude phiên bản trước (Sonnet 4, Opus 4)

Ưu điểm của 4.5 so với Sonnet 4 / Opus 4:

  • Nâng cao khả năng sử dụng công cụ & tương tác thực tế (OSWorld từ ~42,2 % lên ~61,4 %)
  • Tăng độ ổn định / duy trì trạng thái lâu hơn (“30+ giờ”)
  • Checkpoints, context editing, memory tool — các tính năng mà Sonnet 4 không có
  • Giá giữ nguyên so với Sonnet 4
  • Kích hoạt SDK agent, mở đường cho người dùng xây agent tùy biến
  • Cải thiện an toàn và alignment

Hạn chế so với Opus / mô hình cao cấp:

  • Có thể Opus 4 vẫn có lợi thế trong một số bài toán reasoning cực lớn
  • Sonnet 4.5 là phiên bản “cân bằng” — nếu bạn cần năng lực cực hạn, Opus có thể vẫn vượt trội
  • Dù giảm lỗi, Sonnet 4.5 vẫn có thể có sai sót trong môi trường thực, đặc biệt trong các domain ngoài dữ liệu huấn luyện

5.2 So với GPT-4 / GPT-5 / Gemini / các LLM khác

Lợi thế của Sonnet 4.5:

  • Khả năng dùng máy tính & thực thi công cụ nội tại — điểm mà GPT truyền thống cần mô hình kết hợp môi trường để làm
  • Agent lâu dài, giữ trạng thái dài, xử lý tác vụ đa bước
  • Tích hợp tính năng code execution, file creation ngay trong mô hình
  • Chi phí “không tăng khi nâng cấp” — tạo động lực để chuyển
  • An toàn & alignment là một trong các ưu tiên thiết kế

Thách thức so với GPT / Gemini:

  • Ecosystem plugin / cộng đồng hỗ trợ GPT / Gemini lớn hơn — nhiều tài nguyên, thư viện, ứng dụng kèm
  • GPT / Gemini có thể mạnh hơn về “ngôn ngữ tự nhiên / creative writing” trong nhiều tình huống
  • Tốc độ inference, độ trễ, khả năng mở rộng thực tế có thể là điểm yếu nếu triển khai không tốt

5.3 Ưu điểm & hạn chế tổng quan

Ưu điểm:

  • Kết hợp tốt giữa sức mạnh và khả năng dùng trong thực tế
  • Được cải tiến nhiều tính năng hữu ích (checkpoints, memory, chỉnh ngữ cảnh)
  • An toàn hơn — giảm nhiều loại hành vi không mong muốn
  • Giá ổn định, chuyển đổi dễ
  • Được phản hồi tích cực từ người dùng thật sự

Hạn chế & rủi ro:

  • Không hoàn hảo — vẫn có thể “bịa”, sai logic, đặc biệt trong domain mới
  • Khi agent liên tục tự hành động, nếu prompt hoặc giám sát không chặt có thể gây lỗi nghiêm trọng
  • Việc triển khai thực tế (cơ sở hạ tầng, độ ổn định, tài nguyên) là thách thức lớn
  • Mô hình mới nhanh chóng — Sonnet 4.5 có thể bị vượt nếu Anthropic hoặc đối thủ không tiếp tục đổi mới

6. Kết luận & lời khuyên cho người dùng

Claude Sonnet 4.5 là một bước tiến ấn tượng trong dòng Claude: nó mang lại năng lực cao hơn trong lập trình, tương tác công cụ, agent lâu dài và các ứng dụng thực tế. Nếu được sử dụng đúng cách, nó có thể là trợ thủ đắc lực cho lập trình viên, nhà phân tích, đội phát triển sản phẩm, và nhiều lĩnh vực khác.

Tuy nhiên, không có mô hình AI nào hoàn hảo. Người dùng cần hiểu đúng điểm mạnh, điểm yếu, luôn giám sát kết quả, thiết lập kiểm soát và luôn cập nhật khi có phiên bản mới.

Nếu bạn là nhà phát triển, nhà phân tích hay người chủ doanh nghiệp, Claude Sonnet 4.5 có thể là lựa chọn đáng cân nhắc cho các nhiệm vụ có tính logic cao, cần tương tác công cụ, hoặc muốn xây agent thông minh.

Tối ưu hóa PDF Cho LLM

PDF là định dạng tài liệu phổ biến nhất hiện nay: từ báo cáo, hợp đồng cho đến tài liệu kỹ thuật. Tuy nhiên, khi đưa PDF trực tiếp vào các mô hình ngôn ngữ lớn (LLM) để làm Q&A, RAG (Retrieval-Augmented Generation) hay tóm tắt, chúng ta thường gặp nhiều vấn đề:

  • PDF scan chỉ chứa ảnh, không thể đọc trực tiếp.

  • Layout phức tạp (2 cột, bảng, biểu đồ) → text extraction sai thứ tự.

  • File quá lớn → embedding tốn nhiều token, chi phí cao.

  • Nhiễu từ header/footer, số trang, ký tự đặc biệt.

Vì vậy, việc tối ưu PDF trước khi đưa vào LLM là bắt buộc nếu muốn đảm bảo kết quả chính xác, chi phí hợp lý và hệ thống dễ mở rộng.

Trong bài viết này, mình sẽ hướng dẫn cách triển khai pipeline xử lý PDF bằng Node.js: từ trích xuất văn bản, OCR cho PDF scan, làm sạch dữ liệu, chunk, tạo embedding và indexing bằng FAISS.


Workflow tổng quan

PDF → Phân loại (Text-based / Scanned)
├─ Text-based → pdf-parse → Làm sạch → Chunk → Embedding → Index
└─ Scanned → OCR (tesseract.js) → Làm sạch → Chunk → Embedding → Index

Bước 1. Cài đặt thư viện

npm install pdf-parse openai faiss-node tesseract.js pdf2pic
  • pdf-parse: trích xuất text từ PDF dạng text.

  • tesseract.js + pdf2pic: OCR cho PDF scan (ảnh).

  • openai: gọi API để tạo embeddings.

  • faiss-node: tạo vector index để search.


Bước 2. Trích xuất văn bản từ PDF (Text-based)

import fs from “fs”;
import pdf from “pdf-parse”;
const dataBuffer = fs.readFileSync(“sample.pdf”);
const extractPdf = async () => {
const data = await pdf(dataBuffer);
console.log(“Số trang:”, data.numpages);
return data.text;

};const rawText = await extractPdf();


Bước 3. Làm sạch dữ liệu

function cleanText(text) {
return text
.replace(/\s+/g, ” “) // bỏ khoảng trắng thừa
.replace(/Page \d+ of \d+/gi, “”) // bỏ số trang
.replace(/[^\x00-\x7F]/g, “”); // bỏ ký tự đặc biệt
}const cleanedText = cleanText(rawText);

Bước 4. Chunking văn bản

Chia nhỏ văn bản theo đoạn, tránh cắt cứng theo ký tự.

function chunkText(text, maxWords = 200) {
const sentences = text.split(/(?<=[.?!])\s+/);
const chunks = [];
let current = [];
let count = 0; for (const sentence of sentences) {
const words = sentence.split(” “).length;
if (count + words > maxWords) {
chunks.push(current.join(” “));
current = [];
count = 0;
}
current.push(sentence);
count += words;
}
if (current.length) chunks.push(current.join(” “));
return chunks;
}const chunks = chunkText(cleanedText);
console.log(“Số chunks:”, chunks.length);

Bước 5. OCR cho PDF Scan

Nếu PDF chỉ chứa ảnh, dùng tesseract.js để OCR:

import { fromPath } from “pdf2pic”;
import Tesseract from “tesseract.js”;const convert = fromPath(“scanned.pdf”, { density: 200 });for (let i = 1; i <= 3; i++) {
const page = await convert(i);
const result = await Tesseract.recognize(page.path, “eng”);
console.log(“OCR trang”, i, “:”, result.data.text.substring(0, 200));
}

Bước 6. Tạo Embedding & Indexing (OpenAI + FAISS)

import OpenAI from “openai”;
import faiss from “faiss-node”;const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });async function getEmbedding(text) {
const res = await client.embeddings.create({
model: “text-embedding-3-small”,
input: text,
});
return res.data[0].embedding;
}const embeddings = [];
for (const chunk of chunks) {
const emb = await getEmbedding(chunk);
embeddings.push(emb);
}// Tạo FAISS index
const dim = embeddings[0].length;
const index = new faiss.IndexFlatL2(dim);
index.add(embeddings);console.log(“Đã index:”, index.ntotal, “chunks”);

Bước 7. Tìm kiếm & Truy vấn

async function searchQuery(query, k = 3) {
const qEmb = await getEmbedding(query);
const { labels } = index.search([qEmb], k);
return labels[0].map(i => chunks[i]);
}const results = await searchQuery(“Nội dung chính của báo cáo là gì?”);
console.log(“Top matches:”, results);

Sau đó bạn đưa results vào prompt của GPT để Q&A hoặc tóm tắt.


Thực hành tốt nhất

  • Bảng (tables) → trích xuất thành CSV/JSON thay vì text để giữ cấu trúc.

  • Biểu đồ (figures/charts) → OCR + alt text mô tả.

  • Metadata → lưu page, section, title để dễ trace lại nguồn.

  • Large PDFs → xử lý batch 50–100 trang/lần.

  • Pre-check → phân loại PDF trước khi xử lý (text-based vs scanned).


Kết luận

Nếu không xử lý trước, PDF sẽ trở thành “nhiễu” đối với LLM: khó hiểu, tốn token và cho ra kết quả sai lệch. Bằng pipeline Node.js trên, bạn có thể tối ưu PDF từ raw file → dữ liệu sạch, có cấu trúc và dễ dàng search để đưa vào RAG hoặc các ứng dụng AI khác.

Benefits of Using MD vs XLSX for Knowledge Base on Dify

Why Use Markdown?

1. Better AI Processing

  • Semantic understanding: AI models process continuous text more effectively than fragmented cell data
  • Context preservation: Paragraph-based content maintains relationships between information
  • Effective retrieval: Vector embeddings capture meaning better from natural language text
  • Natural chunking: Content splits logically by sections, preserving context in each chunk

2. Cost Efficiency

  • Smaller storage: Plain text (5-10KB) vs Excel with formatting overhead (50-100KB+)
  • Lower token usage: Markdown structure is simpler, reducing embedding and processing tokens
  • Faster processing: Text parsing is significantly faster than Excel binary format

3. Operational Benefits

  • Version control friendly: Git tracks line-by-line changes effectively
  • Universal editing: Any text editor works, no proprietary software needed
  • Better collaboration: Merge conflicts are easier to resolve in plain text
  • Automation ready: Easily integrated into CI/CD and documentation workflows

4. When to Use Excel?

XLSX may be suitable when:

  • You need structured tabular data with calculations/formulas
  • Data is primarily numerical with specific formatting requirements
  • Direct import/export with database systems or business intelligence tools
  • Non-technical users need to edit data in familiar spreadsheet interface

However, for knowledge bases consumed by AI, converting to Markdown yields better results even for tabular data.

Demo: Converting XLSX to MD

You can create a custom plugin tool on Dify to convert Excel files to Markdown. Here’s how I built mine:

Implementation Steps

  1. Accept XLSX file input
    • Require Xlsx File parameter and wrap its blob in a BytesIO stream
  2. Configure column selection
    • Extract Selected Columns parameter (accepts list/JSON string/comma-separated string)
    • Ensure it is non-empty
  3. Set delimiter
    • Resolve Delimiter parameter for separating entries
  4. Parse Excel file
    • Read the first worksheet into a DataFrame using pandas
    • Verify all requested columns exist in the DataFrame header
    • Subset DataFrame to selected columns only
    • Normalize NaN values to None
  5. Transform to structured data
    • Convert each row into a dictionary keyed by selected column names
    • If no rows remain, emit message indicating no data and stop
  6. Generate Markdown
    • Build content by writing column: value lines per row
    • Append delimiter between entries
    • Join all blocks into final Markdown
  7. Output file
    • Derive filename from uploaded file metadata
    • Emit blob message with Markdown bytes and metadata

Sample

Input

 

Output

Spec Kit: A Smarter Way to Build Software with AI

Have you ever asked someone to help you with a project, only to get back something that looks right but isn’t quite what you wanted? That’s exactly what happens when we work with AI coding assistants today. We describe what we want, get code back, and often find ourselves saying “Well, it’s close, but…”

GitHub just released a free tool called Spec Kit that solves this problem by teaching us a better way to communicate with AI assistants. Think of it as a structured conversation method that helps both you and the AI stay on the same page.

The Problem: Why “Just Tell the AI What You Want” Doesn’t Work

Imagine you’re renovating your kitchen and you tell the contractor: “I want it to look modern and functional.” Without more details, they’ll make their best guess based on what they think “modern” and “functional” mean. The result might be beautiful, but probably won’t match your vision.

The same thing happens with AI coding assistants. When we give vague instructions like “build me a photo sharing app,” the AI has to guess at hundreds of details:

  • How should users organize their photos?
  • Can they share albums with friends?
  • Should it work on phones and computers?
  • How do they sign in?

Some guesses will be right, some won’t, and you often won’t discover the problems until much later in the process.

The Solution: Spec-Driven Development

Spec-Driven Development is like having a detailed conversation before starting any work. Instead of jumping straight into building, you:

  1. Clearly describe what you want (the “what” and “why”)
  2. Plan how to build it (the technical approach)
  3. Break it into small steps (manageable tasks)
  4. Build it step by step (focused implementation)

The magic happens because each step builds on the previous one, creating a clear roadmap that both you and the AI can follow.

How Spec Kit Makes This Easy

Spec Kit provides a simple toolkit with four phases that anyone can learn:

Phase 1: Specify – “What do you want to build?”

You describe your vision in plain language, focusing on:

  • Who will use it? (your target users)
  • What problem does it solve? (the main purpose)
  • How will people use it? (the user experience)
  • What does success look like? (your goals)

Example: Instead of “build a task manager,” you’d say:

“Build a team productivity app where project managers can assign tasks to engineers, team members can move tasks between ‘To Do,’ ‘In Progress,’ and ‘Done’ columns, and everyone can leave comments on tasks. It should be easy to see at a glance which tasks are yours versus others.”

Phase 2: Plan – “How should we build it?”

Now you get technical (but still in everyday terms):

  • What technology should we use? (website, mobile app, etc.)
  • What are the constraints? (budget, timeline, compatibility needs)
  • What are the rules? (security requirements, company standards)

Example:

“Build this as a simple web application that works in any browser. Store data locally on the user’s computer – no cloud storage needed. Keep it simple with minimal external dependencies.”

Phase 3: Tasks – “What are the specific steps?”

The AI breaks your big vision into small, manageable pieces:

  • Create user login system
  • Build the task board layout
  • Add drag-and-drop functionality
  • Implement commenting system

Each task is something that can be built and tested independently.

Phase 4: Implement – “Let’s build it!”

Your AI assistant tackles each task one by one, and you review focused changes instead of overwhelming code dumps.

Why This Approach Works Better

Traditional approach: “Build me a photo sharing app” → AI makes 1000 assumptions → You get something that’s 70% right

Spec-driven approach: Clear specification → Detailed plan → Small tasks → AI builds exactly what you described

The key insight is that AI assistants are incredibly good at following detailed instructions, but terrible at reading your mind. By being explicit upfront, you get much better results.

Getting Started with Spec Kit

Spec Kit works with popular AI coding assistants like:

  • GitHub Copilot
  • Claude Code
  • Gemini CLI

Installing and Using Spec Kit

1. Install Specify

uv tool install specify-cli –from git+https://github.com/github/spec-kit.git
specify init reading-assistant

2. Establish project principles

/constitution Create principles focused on code quality, testing standards, user experience consistency, and performance requirements

3. Create the spec

/specify
GOAL
– Input: URL (or pasted text)
– Process: Fetch article → summarize (150–250 words) → generate 3–5 practice questions
– Output: Markdown with Summary, Questions, Source
– Constraint: Minimal Python CLI

4. Create a technical implementation plan

/plan
ARCHITECTURE
– Python CLI with argparse
– Modules:
• fetcher.py: download HTML
• extractor.py: parse text with BeautifulSoup
• llm.py: call OpenAI (gpt-4o-mini)
• markdown.py: render Markdown
– Flow: URL/text → fetch & extract → LLM → Markdown → stdout

DEPENDENCIES
– requests, beautifulsoup4, python-dotenv

OUTPUT FORMAT
# Summary
<summary>

# Questions
1. …
2. …

# Source
<url or ‘pasted text’>

5. Break down into tasks

/tasks
– [ ] Setup project skeleton + requirements
– [ ] Implement fetcher (requests)
– [ ] Implement extractor (BeautifulSoup)
– [ ] Implement LLM client with prompt
– [ ] Implement Markdown renderer
– [ ] Wire CLI (argparse)
– [ ] Smoke test with one URL and one pasted file
– [ ] Add README with quick start

6. Execute implementation

/implement
FILES
1) requirements.txt
requests
beautifulsoup4
python-dotenv

2) app.py
– argparse: –url, –text
– orchestrate modules and print Markdown

3) fetcher.py
– fetch_url(url) with timeout, retry

4) extractor.py
– extract_text(html) → title + paragraphs

5) llm.py
– summarize_and_ask(text) → {“summary”: str, “questions”: [str]}
– uses OPENAI_API_KEY; friendly error if missing

6) markdown.py
– render(result, source) → Markdown string

7) README.md
– Quick start instructions
– Example commands

 

Result

 

References:

https://github.com/github/spec-kit

https://github.blog/ai-and-ml/generative-ai/spec-driven-development-with-ai-get-started-with-a-new-open-source-toolkit/

Agentic Web: Weaving the Next Web with AI Agents

Bài báo “Agentic Web: Weaving the Next Web with AI Agents” được công bố trên arXiv (7/2025) (arXiv+1), do một nhóm tác giả nghiên cứu về trí tuệ nhân tạo và Web viết.

Mục tiêu chính của bài báo là:

  • Định nghĩa khái niệm Agentic Web – tức một thế hệ Web mới, nơi các AI agents không chỉ là công cụ trả lời câu hỏi, mà có khả năng hành động tự chủ, phối hợp, và thực thi nhiệm vụ đa bước thay cho con người.

  • Đưa ra khung lý thuyết ba chiều (trí tuệ, tương tác, kinh tế) để phân tích và định hướng phát triển Web trong kỷ nguyên AI agent.

  • Khảo sát các xu hướng công nghệ hiện tại, từ mô hình ngôn ngữ lớn (LLMs), hệ thống multi-agent, đến các giao thức mới (MCP, A2A), đồng thời thảo luận các thách thức kỹ thuật, kinh tế, đạo đức, và pháp lý.

  • Định hình tầm nhìn tương lai của Web, từ một không gian thông tin sang một không gian “tác nhân” – nơi các agent tự động đàm phán, phối hợp, và tương tác để phục vụ nhu cầu con người.

Điểm đáng chú ý là bài báo không chỉ mang tính lý thuyết mà còn gắn với các tiến triển thực tế:

  • Sự xuất hiện của AI agent frameworks (AutoGPT, LangChain, CrewAI, v.v.)

  • Những giao thức chuẩn hóa đang được phát triển (như Model Context Protocol)

  • Xu hướng các công ty lớn (OpenAI, Anthropic, Google, Meta) đều đang thử nghiệm agent ecosystems.

Nói cách khác, bài báo vừa mang tính khái niệm (định nghĩa, khung phân tích) vừa mang tính dự báo (visionary), đặt nền móng cho việc nghiên cứu và triển khai Web thế hệ mới dựa trên agent.

Động cơ & Định nghĩa

  • Tác giả bắt đầu bằng việc nhìn lại quá trình phát triển của Web: từ Web PC (static, tìm kiếm), tới Web di động (UGC, hệ thống gợi ý/recommender), và nay đang tiến tới một kỷ nguyên mới là Agentic Web – Web đại diện cho các tác nhân AI (AI agents) hoạt động tự chủ, mục tiêu rõ ràng, thực hiện các tác vụ đa bước, phối hợp giữa các tác nhân để phục vụ người dùng. arXiv+1

  • Định nghĩa: Agentic Web là hệ sinh thái phân tán, tương tác, nơi các tác nhân phần mềm (thường sử dụng các mô hình ngôn ngữ lớn) đóng chức năng trung gian, có khả năng lập kế hoạch, phối hợp, thực thi các tác vụ có mục tiêu do người dùng đặt ra. Web trở nên năng động hơn, giữa các tác nhân với nhau tương tác, chứ không chỉ người dùng -> nội dung. arXiv+1

Ba chiều khung khái niệm

Tác giả đưa ra một mô hình ba chiều (dimensions) để hiểu và thiết kế Agentic Web:

  1. Trí tuệ (Intelligence): các khả năng nhận thức, suy luận, lập kế hoạch, học hỏi, sử dụng kiến thức đã học vs dữ liệu thời gian thực, tương tác với các công cụ, API. arXiv+1

  2. Tương tác (Interaction): cách thức các tác nhân tương tác với nhau, với người dùng, với dịch vụ, định dạng giao tiếp, giao diện máy-máy, quản lý cuộc hội thoại dài hạn, phân chia công việc giữa các agent. arXiv

  3. Kinh tế (Economics): cách thức trao đổi giá trị giữa người dùng, hệ thống, dịch vụ, giữa các agent; mô hình kinh doanh mới; nền kinh tế “agent attention economy” nơi các dịch vụ cạnh tranh để được các agent “triệu hồi”, metrics mới thay thế metrics truyền thống như click, lượt xem. arXiv

Những chuyển đổi kỹ thuật & kiến trúc

  • Thay từ truy vấn đơn giản + tìm kiếm sang tìm kiếm thông minh do agent khởi xướng, truy cập thông tin, công cụ theo ý định người dùng. arXiv+1

  • Từ hệ thống gợi ý cá nhân hóa sang lập kế hoạch (planning), phối hợp giữa nhiều agent để thực thi task phức tạp. arXiv+1

  • Từ agent đơn lẻ sang hệ multi-agent, cần có các protocol giao tiếp, chuẩn hoá APIs, đạo đức trong phối hợp agent. arXiv+1

  • Kiến trúc hệ thống: agent discovery (tìm agent có năng lực phù hợp), orchestration (điều phối agent), communication protocols như MCP (Model Context Protocol) hay A2A (Agent-to-Agent) được đề cập. arXiv

Ứng dụng, rủi ro, quản trị & vấn đề mở

  • Ứng dụng: đặt dịch vụ giao dịch tự động (ví dụ: đặt vé máy bay, lịch trình du lịch), khám phá thông tin sâu (deep research), trợ lý kiến thức trong doanh nghiệp, agent làm người trung gian giữa người dùng và các dịch vụ. arXiv

  • Rủi ro: an ninh, bảo mật, sai lệch (bias), agent làm việc không đúng mục đích, kiểm soát & tương tác giữa người và agent, đảm bảo alignment (mục tiêu AI vs mục tiêu người dùng), tin cậy giữa các agent. arXiv

  • Các vấn đề mở: học & thích ứng động (dynamic learning), hệ thống đa agent đảm bảo phối hợp tốt & tin cậy, giao diện người-agent (human-agent interface), rủi ro hệ thống quy mô lớn, tác động xã hội kinh tế. arXiv


Nhận định & Ý kiến

Dưới đây là quan điểm của mình về bài báo—những điểm mạnh, những khó khăn, và liệu nó có thực sự khả thi & đáng quan tâm.

Các điểm mạnh

  • Khái niệm rõ ràng, kịp thời: Xu hướng AI agents đang phát triển rất nhanh, nhiều sản phẩm thực tế đã bắt đầu dùng agent tự chủ hơn, vì vậy bài báo nắm bắt rất đúng xu hướng. Việc định nghĩa “Agentic Web” giúp tạo khung để bàn luận chuyên sâu.

  • Phân tích đa chiều: Ba chiều trí tuệ, tương tác, kinh tế là cách tiếp cận toàn diện — không chỉ về công nghệ mà cả về kinh tế, mô hình kinh doanh, xã hội. Điều này giúp tránh việc chỉ tập trung vào “agent làm gì” mà bỏ qua “ai trả tiền”, “ai chịu trách nhiệm”, “liệu người dùng có tin tưởng” v.v.

  • Đề xuất kiến trúc & protocol thực tế: Việc nhắc đến MCP, A2A, cần chuẩn hóa interfaces… là những điều cần thiết nếu Agentic Web muốn được triển khai quy mô rộng. Những ví dụ về ứng dụng thực tế giúp minh họa rõ các lợi ích.

  • Đánh giá rủi ro & vấn đề mở: Không lờ đi các thách thức — như alignment, bảo mật, tin cậy, trách nhiệm — điều này cho thấy tác giả có quan sát sâu sắc, không chỉ hô hào lý tưởng.

Các hạn chế / những vấn đề cần cân nhắc

  • Yêu cầu hạ tầng rất lớn & phức tạp: Để Agentic Web hoạt động tốt, cần chuẩn hóa protocol, APIs, dịch vụ, quản lý danh mục agent, tin cậy giữa các tác nhân, cơ chế định danh, bảo mật. Ở nhiều nơi hiện nay, hạ tầng Web, dịch vụ vẫn chưa chuẩn mực, do vậy việc triển khai thực tế có thể gặp rất nhiều rào cản.

  • Vấn đề đạo đức, pháp lý, trách nhiệm: Khi agent thực thi hành động thay người dùng (ví dụ: đặt vé, thanh toán, tương tác với các dịch vụ khác), nếu có sự cố xảy ra—ai chịu trách nhiệm? Ai đảm bảo quyền lợi người dùng? Rất nhiều câu hỏi chưa được giải đáp đủ, đặc biệt trong các vùng pháp luật khác nhau.

  • Chi phí & kinh tế chưa rõ: Mô hình “agent attention economy” rất hấp dẫn, nhưng để triển khai được nó, ai sẽ chịu chi phí phát triển, vận hành, duy trì? Dịch vụ nào có lợi? Có nguy cơ các “agent” nhỏ, nhà phát triển nhỏ bị lấn át bởi các tập đoàn lớn có nguồn lực mạnh.

  • Tính chấp nhận của người dùng: Người dùng có thực sự muốn giao quyền nhiều cho agent? Có những việc người dùng muốn kiểm soát chi tiết. Việc tin tưởng AI agent hoàn toàn, hay tin vào các kết quả agent trả về mà không kiểm tra, là rào cản lớn.

Liệu Agentic Web có khả thi?

Mình nghĩ là , nhưng không phải trong ngắn hạn trên phạm vi rộng. Agentic Web sẽ phát triển dần dần, từng phần:

  • Những tác vụ tự động hóa nhiều bước nhỏ (đặt chỗ, sắp xếp lịch, tìm thông tin) sẽ được agent hóa trước.

  • Những dịch vụ lớn, yêu cầu tính tin cậy, đạo đức cao (ví dụ y tế, pháp lý) sẽ bị chậm hơn vì rủi ro lớn.

  • Cần sự hợp tác giữa các bên: công nghệ, nhà làm luật, doanh nghiệp, người dùng để xây khung quản trị, chuẩn kỹ thuật, bảo vệ người sử dụng.

Tác động nếu được hiện thực hoá tốt

  • Nâng cao hiệu suất sử dụng Web: người dùng sẽ tiết kiệm thời gian, công sức, có thể giao cho agent làm các công việc lặp đi lặp lại.

  • Thay đổi mô hình kinh doanh của các công ty công nghệ: ai sở hữu agent registry, ai được chọn/recommended bởi agent, ai được trả công khi agent “invoke” dịch vụ…

  • Có thể làm tăng bất bình đẳng nếu chỉ những tổ chức lớn có tài nguyên triển khai agent mạnh mới thắng được — các dịch vụ nhỏ có thể bị loại bỏ khỏi “attention” của agent nếu không có khả năng cạnh tranh.


Kết luận

Bài báo là một đóng góp quan trọng, làm rõ hướng phát triển mới cho Web trong kỷ nguyên AI. Nó vừa có giá trị lý thuyết (khung khái niệm, phân tích) vừa có tính định hướng thực tiễn (ứng dụng, rủi ro). Mình nghĩ việc Agentic Web phát triển là chỉ là vấn đề thời gian nếu các công nghệ liên quan (LLMs, multi-agent, protocol chuẩn, bảo mật, luật pháp) tiếp tục tiến mạnh.

Genspark AI Docs – Intelligent Document Creation Tool

Introduction

Genspark AI Docs is the world’s first fully-agentic AI-powered document creation tool, designed to automatically generate comprehensive documents. It leverages advanced AI agents to conduct research, write content, and format documents seamlessly.

Key Features

  • Full-agentic AI approach: automates the entire document creation process, including research, content generation, formatting.
  • Visual integration: integrates visual elements, and provides intelligent design.
  • Multi-format support: supports both Rich Text and Markdown formats.

How It Works

  • Users simply enter a prompt describing the document they need.
  • AI analyzes the request and creates a complete document.
  • Documents adapt to user needs, incorporate uploaded or external content and support real-time iterative refinement.

Practical Applications

  • Technical Specs and API Documentation.
  • Meeting Minutes → Action Plan Transformer.
  • Sales Proposals and Pricing Sheets.
  • Internal SOPs and Onboarding Playbooks.
  • Project Proposals and Progress Reports.

Quick Start Guide

  1. Visit https://www.genspark.ai
  2. Sign up or log in to your account
  3. Select AI Docs from the dashboard
  4. Enter your desired prompt

  5. Wait for the content to be generated
  6. Click on any element to format it if needed
  7. Export the document as HTML, Word, or PDF when you’re ready

What is MCP (Model Context Protocol)?

In the era of multimodal artificial intelligence (AI), seamless communication between AI models, intelligent agents, and real-world applications is essential for delivering powerful and fluid user experiences. One of the emerging technical standards designed to solve this challenge is MCP – Model Context Protocol.

In this comprehensive article, we’ll explore:

  • What MCP is

  • Why MCP is crucial in modern AI architecture

  • In-depth explanation of key MCP components like MCP Host, MCP Server, MCP Agent, and MCP Plugin/Tool

  • Practical applications of MCP in real-world AI systems

1. What is MCP (Model Context Protocol)?

MCP (Model Context Protocol) is a specification designed to standardize how AI models (e.g., language, vision, audio, or multimodal models) interact with external environments and contextual information through a unified interface.

Rather than simply sending a string of text to a language model and waiting for a response, MCP allows:

  • Declaration, management, and transfer of complex context (e.g., time, goals, resources)

  • Coordination between different AI modules via a standard protocol

  • Session and state management in long-running AI conversations

MCP is not just an API — it’s an open protocol designed to help AI systems “understand” the world more like humans — with context, intent, and interaction.

2. Why is MCP important?

Today’s AI systems rarely rely on a single model. A typical AI application may involve:

  • Language models like GPT-4 or Claude

  • Vision models for image analysis

  • Audio models for ASR and TTS

  • External tools such as web browsers, code interpreters, or knowledge bases

To orchestrate these components effectively, a unified communication protocol is required. MCP provides this foundation.

Key Benefits of MCP:

  • Scalability – Easily add new tasks, models, or plugins.

  • Separation of concerns – Clean boundaries between agents, models, and tools.

  • Standardized context representation – Ensures consistency and efficiency.

3. Core Components of MCP

Let’s break down the primary elements of an MCP-based system:

a. MCP Host

The MCP Host is the main orchestration environment where agents, models, and tools are deployed. It is responsible for:

  • Managing AI agents and sessions

  • Routing requests to models or plugins

  • Providing context (history, environment, user data)

Think of it as the “operating system” for your AI infrastructure — handling coordination and execution.

For example, in OpenAI’s ChatGPT, the host is responsible for dispatching user messages to agents, choosing tools, and integrating results.

b. MCP Server

The MCP Server acts as a middleware layer between the host and individual models/tools. It handles:

  • Request dispatching

  • Context formatting and transformation

  • Managing responses from tools and models

The server ensures that all communications conform to the MCP standard and that each model receives input in the format it understands.

c. MCP Agent

An MCP Agent is an intelligent AI unit designed to complete tasks through interaction with the MCP ecosystem. Each agent:

  • Operates within a defined context

  • Has access to tools and models

  • Makes decisions using LLMs and/or predefined policies

Examples include:

  • A travel assistant agent

  • A customer support bot

  • A task planner integrated into your AI suite

The agent leverages context and tools to perform reasoning, planning, and action execution.

d. MCP Plugin / Tool

Plugins (or tools) are external functionalities that extend the AI system’s capabilities. They can:

  • Access external APIs

  • Read or write files

  • Render charts, analyze documents, etc.

These tools are activated by agents through the LLM (or other reasoning engines), but executed in a secure, controlled environment through the MCP Server.

4. How MCP Works in Practice

Here’s an example of a typical MCP request flow:

  1. User input: “Schedule a meeting with my team for next week.”

  2. Host creates a session and assigns the agent.

  3. Agent sends request to the LLM with full context (user preferences, calendar data).

  4. LLM identifies it needs a calendar plugin → sends structured request via MCP.

  5. Server routes it to the correct plugin and executes the action.

  6. Plugin creates the calendar event → sends result back.

  7. Agent composes a human-readable response → returns to user.

Throughout the flow, MCP ensures context is preserved and actions are traceable, reliable, and secure.

5. Real-World Applications of MCP

MCP-like architectures are already powering cutting-edge AI platforms, such as:

  • OpenAI’s GPTs & ChatGPT Agents – Contextual plugin execution, code interpreters, and file handling are managed using MCP-like abstraction layers.

  • Anthropic Claude – Tool usage patterns reflect similar context-managed architecture.

  • LangChain / AutoGen – Frameworks that standardize context flow and reasoning across agents, tools, and models.

As AI becomes increasingly capable and modular, having a protocol like MCP ensures safe, consistent, and powerful coordination.

6. Conclusion

Model Context Protocol (MCP) is more than a technical interface — it’s a foundational protocol that enables next-generation AI systems to act with contextual intelligence, tool coordination, and human-like reasoning.

By separating responsibilities among hosts, agents, models, and tools, MCP brings structure and scalability to AI systems that aim to be more adaptable, secure, and useful.

Gemini CLI vs. Claude Code CLI: A Comprehensive Comparison for Developers

1. Introduction to the Launch of Gemini CLI

Recently, Google launched Gemini CLI – an open-source AI agent that can be directly integrated into the terminal for work. In previous articles about Claude Code CLI, we already saw its powerful features. Now, with the interesting arrival of Gemini CLI, users have even more options when choosing which agent to use. In this article, we’ll explore and compare the different criteria between Claude Code CLI and Gemini CLI to see which agent might best suit your needs.

2. Comparison Criteria Between the Two CLI Agents

a. Platform Support

  • Claude Code CLI: This tool has certain limitations when it comes to operating system support. It works well on MacOS and Ubuntu, but for Windows users, it requires extra steps such as installing an Ubuntu WSL virtual machine. Even then, there are still some restrictions and a less-than-ideal user experience.

  • Gemini CLI: Google’s new tool supports all operating systems, allowing users on any platform to set up and use it quickly and easily.

b. Open Source

  • Claude Code CLI: This is a closed-source tool, so its development is entirely controlled by Anthropic.

  • Gemini CLI: Google’s tool is open source, licensed under Apache 2.0, which enables the user community to access and collaborate on making the tool more robust and faster.

c. AI Model

  • Claude Code CLI: Utilizes powerful Anthropic models such as Claude Opus 4 and Claude Sonnet 3.7, both highly effective for coding tasks.

  • Gemini CLI: Gives access to Gemini 2.5 Pro and Gemini 2.5 Flash, each useful for different needs.

d. Context Limitations

  • Claude Code CLI: This is a paid tool. Users can access it through their Claude account with various tiers, each offering different token limits (from 250K to 1M tokens per model). Users can also use Claude’s API key to pay based on token usage.

  • Gemini CLI: Google’s tool provides a free version, which allows access to Gemini 2.5 Pro, but can quickly hit the limit and drop down to Gemini 2.5 Flash.

e. Community and Extensibility

  • Claude Code CLI: As a closed-source tool, only the developer (Anthropic) can improve and maintain it.

  • Gemini CLI: Being open source, it has a large and vibrant community contributing to its rapid improvement and greater capabilities.

3. Gemini CLI

  • Link: https://github.com/mhieupham1/Flashcard_GeminiCLI

  • Prompt Example:

    • Please make for me a website about using flashcard for learning English with HTML, CSS, Javascript, do the best for UI/UX

    • A flashcard set can archive many words, user can add more word to a new set or existed set

    • Function for folder that can add existed flashcard sets or remove it

    • Function for flashcard set that can edit transfer user to a web to practice in this flashcard set

    • Dashboard need to have more eye-catching, good layout

    • And many prompts to ask Gemini CLI to fix their own bugs

    • Make the web has layout, functions like an official website with better CSS, JS, HTML

  • Strengths:

    • Can handle large token requests and good at reading context

    • Cost: Free version can access Gemini 2.5 Pro, but may quickly hit limits and fall back to Gemini 2.5 Flash. Sometimes, after logging out and back in, it works normally again with Gemini 2.5 Flash. A pro account offers a one-month free trial, after which users can cancel or continue with the stated price.

  • Weaknesses:

    • Requires a very large number of tokens (1M tokens for pro, 11M for flash) to build the website (even when incomplete)

    • Prone to repeated error loops, wasting tokens

    • Codebase is still weak and doesn’t always fully understand user intentions or basic web concepts, so prompts need to be very detailed

4. Claude Code CLI

  • Link: https://github.com/mhieupham1/Flashcard_ClaudeCodeCLI

  • Prompt Example:

    • Please make for me a website about using flashcard for learning English with HTML, CSS, Javascript, do the best for UI/UX

    • A flashcard set can archive many words, user can add more word to a new set or existed set

    • Function for folder that can add existed flashcard sets or remove it

    • Function for flashcard set that can edit transfer user to a web to practice in this flashcard set

    • Dashboard need to have more eye-catching, good layout

  • Strengths:

    • Understands user ideas very well, outputs high-quality, efficient, and minimal code without missing features

    • Only required 30K tokens for the flashcard web demo

    • Good, user-friendly UI/UX

    • Produced the demo with a single request (using only a pro account, not the max tier)

  • Weaknesses:

    • Requires a paid account or API key (tokens = dollars), but the code quality is worth the price

5. Conclusion

With the comparison above, it’s clear that Gemini CLI is currently much stronger than Claude Code CLI. However, a deeper dive into their practical efficiency and benefits for different use cases is still needed.

a. Gemini CLI

  • Strengths:

    • Free to use with high token limits, suitable for large projects needing a large context window

    • Highly compatible across platforms and easy to set up

    • Open source, ensuring rapid improvement through community contributions

    • Fast code reading and generation

  • Weaknesses:

    • Can randomly hit usage limits, dropping from Gemini Pro 2.5 to Gemini Flash 2.5, reducing effectiveness

    • Prone to repeated errors/loops, which can be difficult to escape’

    • Codebase may not be as efficient, often needing very detailed prompts

b. Claude Code CLI:

  • Strengths:

    • High-quality, thoughtful, and efficient codebase generation

    • Highly suitable for commercial projects thanks to token optimization

  • Weaknesses:

    • Requires a paid account, with different tiers for different performance levels; top tier is expensive

    • Limited cross-platform compatibility, making it less accessible or offering a poorer experience for some users

6. Which Should You Use? Summary of Best Use Cases

When is Claude Code CLI most convenient?
Claude Code CLI is the better choice if you prioritize high-quality, efficient, and minimal code output, especially for commercial projects that require clean UI/UX and robust functionality. It is also ideal when you want to achieve your result in a single, well-phrased prompt. However, you need to be willing to pay for a subscription or API access, and set up the tool on a supported platform.

When is Gemini CLI more convenient?
Gemini CLI is perfect if you need a free, open-source tool that works across all major operating systems and is easy to install. It’s best for large projects that require handling a lot of data or context, and for those who want to benefit from fast community-driven improvements. Gemini CLI is especially suitable for personal, experimental, or learning projects, or when you need flexibility and cross-platform compatibility—even though it might sometimes require more detailed prompts or troubleshooting.

Introducing Claude 4 and Its Capabilities

Claude 4 refers to the latest generation of AI models developed by Anthropic, a company founded by former OpenAI researchers. The most powerful model in this family as of June 2024 is Claude 3.5 Opus, often informally called “Claude 4” due to its leap in performance.

Claude Opus 4 is powerful model yet and the best coding model in the world, leading on SWE-bench (72.5%) and Terminal-bench (43.2%). It delivers sustained performance on long-running tasks that require focused effort and thousands of steps, with the ability to work continuously for several hours—dramatically outperforming all Sonnet models and significantly expanding what AI agents can accomplish.

Claude Opus 4 excels at coding and complex problem-solving, powering frontier agent products. Cursor calls it state-of-the-art for coding and a leap forward in complex codebase understanding. Replit reports improved precision and dramatic advancements for complex changes across multiple files. Block calls it the first model to boost code quality during editing and debugging in its agent, codename goose, while maintaining full performance and reliability. Rakuten validated its capabilities with a demanding open-source refactor running independently for 7 hours with sustained performance. Cognition notes Opus 4 excels at solving complex challenges that other models can’t, successfully handling critical actions that previous models have missed.

Claude Sonnet 4 significantly improves on Sonnet 3.7’s industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations. While not matching Opus 4 in most domains, it delivers an optimal mix of capability and practicality.

GitHub says Claude Sonnet 4 soars in agentic scenarios and will introduce it as the model powering the new coding agent in GitHub Copilot. Manus highlights its improvements in following complex instructions, clear reasoning, and aesthetic outputs. iGent reports Sonnet 4 excels at autonomous multi-feature app development, as well as substantially improved problem-solving and codebase navigation—reducing navigation errors from 20% to near zero. Sourcegraph says the model shows promise as a substantial leap in software development—staying on track longer, understanding problems more deeply, and providing more elegant code quality. Augment Code reports higher success rates, more surgical code edits, and more careful work through complex tasks, making it the top choice for their primary model.

These models advance our customers’ AI strategies across the board: Opus 4 pushes boundaries in coding, research, writing, and scientific discovery, while Sonnet 4 brings frontier performance to everyday use cases as an instant upgrade from Sonnet 3.7.

 

 


Key Strengths of Claude 4

 1. Superior Reasoning and Intelligence

Claude 4 ranks at the top in benchmark evaluations such as:

  • MMLU (Massive Multitask Language Understanding)

  • GSM8k (math problem solving)

  • HumanEval (coding)
    It rivals or exceeds OpenAI’s GPT-4-turbo and Google Gemini 1.5 Pro in complex reasoning, long-context understanding, and task execution.

 2. Massive Context Window (Up to 200K Tokens)

Claude 4 can read and reason over hundreds of pages at once, making it perfect for:

  • Analyzing lengthy legal or scientific documents

  • Comparing large codebases

  • Summarizing long texts or reports

 3. Advanced Coding Support

Claude 4 excels in:

  • Writing and explaining code in multiple languages (Python, JS, Java, etc.)

  • Debugging and understanding large code repositories

  • Pair programming and iterative development tasks

 4. Natural and Helpful Communication

  • Responses are clear, polite, and structured

  • Especially strong in creative writing, professional emails, and educational explanations

  • Can follow complex instructions and maintain context over long conversations


Safe and Aligned by Design

Claude is built with safety and alignment in mind:

  • It avoids generating harmful or unethical content

  • It is more cautious and transparent than most models

 


 How to Access or Use Claude 4

Claude is a cloud-based AI model, so you don’t install it like software — instead, you access it via the web or API.

1. Use Claude via Web App

 Steps:

  1. Go to: https://claude.ai

  2. Sign up or log in (you need a US/UK/Canada/EU phone number).

  3. Choose from free or paid plan (Claude 3.5 Opus is available only in Claude Pro – $20/month).

 Claude Pro Includes:

  • Claude 3.5 Opus (latest, most powerful)

  • Larger context

  • Priority access during high demand

 Currently, Claude is only available in select countries. If you’re outside the US/UK/Canada/EU, you may need to use a VPN and a virtual phone number to sign up (unofficial workaround).


2.  Use Claude via API (For Developers)

 API Access:

  1. Go to: https://console.anthropic.com

  2. Sign up and get an API key

  3. Use the API with tools like Python, cURL, or Postman

 Example (Python):

import anthropic

client = anthropic.Anthropic(api_key="your_api_key")

response = client.messages.create(
model="claude-3.5-opus-20240620",
max_tokens=1024,
messages=[
{"role": "user", "content": "Explain quantum computing in simple terms"}
]
)

print(response.content)


Can I Install Claude Locally?

No. Like ChatGPT or Gemini, Claude is not open-source or downloadable. It’s only available via:

 

Feature Claude 4 (Claude 3.5 Opus)
Developer Anthropic
Model Type Large Language Model (LLM)
Reasoning & Math Top-tier performance
Context Length Up to 200,000 tokens
Code Assistance Strong support for multiple languages
Language Style Human-like, calm, professional
Best Use Cases Analysis, writing, coding, dialogue
Access claude.ai or API