Agentic AI: Bedrock Agents, AgentCore, Strands & MCP
ให้ FM วางแผน เรียกใช้ tool และทำงานหลายขั้นตอนได้เอง อย่างปลอดภัย
Agent = FM + เครื่องมือ (tools) + หน่วยความจำ + วงจร คิด → ทำ → สังเกต (ReAct) จนงานสำเร็จ
Bedrock agent วนคิด → เรียก tool → ดูผล จนงานเสร็จ
| ส่วนประกอบของ Bedrock Agents | หน้าที่ |
|---|---|
Instructions | บอกบทบาทและเป้าหมายของ agent |
Action groups | tool ที่ agent เรียกได้ นิยามด้วย OpenAPI schema หรือ function details แล้วให้ Lambda ทำงาน |
Return of control | ส่ง parameter กลับให้แอปของเรา execute เอง (ไม่ต้องมี Lambda) |
Knowledge bases | ให้ agent ค้นข้อมูล (RAG) ระหว่างทำงาน |
Memory | จำสรุป session ข้ามการสนทนา |
Multi-agent collaboration | supervisor agent แจกงานให้ collaborator agents เฉพาะทาง |
Trace | ดูขั้นตอนการคิดและการเรียก tool — ใช้ debug และแสดง transparency |
| Amazon Bedrock AgentCore | ใช้ทำอะไร |
|---|---|
Runtime | host agent จาก framework ใดก็ได้ (Strands, LangGraph, CrewAI) แบบ serverless + session isolation |
Memory | short-term / long-term memory แบบ managed |
Gateway | แปลง API/Lambda ที่มีอยู่ให้เป็น MCP tools ที่ agent เรียกได้ |
Identity | จัดการ auth ของ agent ไปยังระบบภายนอก (OAuth, API keys) |
Code Interpreter / Browser | sandbox สำหรับรันโค้ด / ใช้ web browser |
Observability | trace, metrics ของ agent ผ่าน CloudWatch |
Frameworks & Protocol
- Strands Agents — open-source SDK ของ AWS แบบ model-driven เขียน agent ด้วยโค้ดไม่กี่บรรทัด
- AWS Agent Squad — framework สำหรับ orchestrate หลาย agent (route คำถามไป agent ที่เหมาะ)
- Model Context Protocol (MCP) — มาตรฐานเปิดให้ agent ↔ tool คุยกันแบบเดียวกัน
- MCP server ที่ stateless / เบา → Lambda
- MCP server ที่ ซับซ้อน / long-running / stateful → ECS (Fargate)
Safeguards ที่ต้องมี
Step Functions กำหนด stopping conditions / max iterations, Lambda timeout, IAM จำกัดสิทธิ์ tool (least privilege), circuit breaker เมื่อ tool พังซ้ำๆ และ human-in-the-loop ด้วย Step Functions (waitForTaskToken) สำหรับ action เสี่ยง
Agent วนเรียก tool ซ้ำไม่จบและทำให้ค่าใช้จ่ายพุ่ง ควรเพิ่มอะไรเป็นอันดับแรก?
การดึงความรู้ออกมาใช้ทันทีหลังอ่าน (retrieval practice) ช่วยให้จำได้นานขึ้นมาก