Anthropic เปิด Multi-agent orchestration ใน Managed Agents API เป็น beta feature ที่ให้ agent หนึ่งตัวทำหน้าที่ coordinator delegate งานต่อให้ sub-agent หลายตัวภายใน session เดียว โดยรองรับ roster สูงสุด 20 unique agents ต่อ coordinator และ concurrent thread สูงสุด 25 thread ต่อ session การเข้าใช้งานต้องส่ง header managed-agents-2026-04-01 ในทุก request หรือใช้ SDK official ที่ตั้ง beta header ให้อัตโนมัติ

Anthropic ระบุว่า multi-agent coordination เหมาะกับงานซับซ้อนที่ต้องการการทำงานข้ามหลาย surface หรือมี sub-task หลายตัวที่ scope ชัดเจนซึ่งนำไปสู่เป้าหมายโดยรวม นั่นคือแนวทางการแก้ปัญหาที่ agent ตัวเดียวซึ่งโหลด tool และความรับผิดชอบทุกอย่างไว้ในตัวเอง คุณภาพ output มักลดลงเมื่อ context และ tool surface ใหญ่เกินไป

Architecture container ร่วม แต่ context แยก

ทุก agent ใน session เดียวกันใช้ container และ filesystem ร่วมกัน ส่วน context ของแต่ละตัวไม่ถูก share โดย agent แต่ละตัว run อยู่ใน session thread ของตัวเอง ซึ่งเป็น event stream ที่ context-isolated มี conversation history แยกจากกัน Agent แต่ละตัวใช้ config ของตัวเองตามที่กำหนดตอนสร้าง agent ทั้ง model, system prompt, tools, MCP servers และ skills ที่ tool และ context ของแต่ละ agent ไม่ถูก share ข้าม agent

Thread เป็นแบบ persistent ที่ coordinator ส่ง follow-up กลับไปยัง agent ที่เคยเรียกใช้ก่อนหน้าได้ และ agent ตัวนั้นจะคง history จาก turn ก่อนหน้าไว้ครบ ส่วน coordinator เอง report activity ผ่าน primary thread ที่เป็น session-level event stream ของ session โดย thread เพิ่มเติมจะ spawn ตอน coordinator ตัดสินใจ delegate งาน

Managed Agents · Multi-agent — coordinator agent_config.yaml example จาก Anthropic docs

3 pattern ที่ Anthropic แนะนำ

Anthropic แนะนำ pattern หลัก 3 รูปแบบสำหรับการออกแบบ multi-agent topology ที่ทำงานได้ดี

Parallelization คือการ fan out sub-task อิสระให้ทำงานพร้อมกัน ตัวอย่างเช่น search หลาย source หรือ analyze หลายไฟล์ในเวลาเดียวกัน แล้วให้ coordinator synthesize ผลลัพธ์รวม pattern นี้ลด time to completion ของงานที่แตกออกเป็น chunk ขนานได้

Specialization คือการ route งานไปยัง agent ที่มี domain-focused system prompt และ tools เฉพาะทาง เช่น security agent หรือ documentation agent แทนการยัด tool และ skill ทุกอย่างไว้ใน agent ตัวเดียวที่ context จะแน่นจนคุณภาพ output ตก

Escalation คือการ consult agent หรือ model ที่ capable กว่าสำหรับ sub-task ซับซ้อนเฉพาะส่วน โดยให้ coordinator เป็น model พื้นฐาน แล้วเรียก sub-agent ที่ใช้ model ใหญ่กว่าเฉพาะตอนที่จำเป็น

Config schema และตัวอย่างจาก docs

Coordinator ตั้งค่าผ่าน field multiagent ตอน define agent ใหม่ ตัวอย่าง config ภาษา YAML ที่ Anthropic ให้ใน docs

name: Engineering Lead
model: claude-opus-4-7
system: You coordinate engineering work. Delegate code review to the reviewer agent and test writing to the test agent.
tools:
  - type: agent_toolset_20260401
multiagent:
  type: coordinator
  agents:
    - type: agent
      id: $REVIEWER_AGENT_ID
    - type: agent
      id: $TEST_WRITER_AGENT_ID

Tool agent_toolset_20260401 คือ tool ที่ Anthropic ให้ coordinator ใช้สำหรับเรียก sub-agent ใน roster ส่วน CLI version ใช้คำสั่ง ant beta:agents create ที่รับ YAML config ผ่าน stdin

Field multiagent.agents รับ entry 3 รูปแบบ

  • {type: agent, id} reference agent ที่สร้างไว้แล้ว ค่า default คือ pin agent latest version
  • {type: agent, id, version} pin specific version ของ agent นั้น
  • {type: self} allow coordinator spawn copy ของตัวเอง

หลัง create coordinator แล้ว ขั้นต่อไปคือ create session ที่ reference coordinator นั้น Anthropic ระบุว่า coordinator จะ delegate ไปยัง agent ใน roster ตามที่ตัดสินใจ runtime

Limit hard-coded ที่ต้องรู้

ฝั่งโครงสร้าง coordinator delegate ได้แค่ 1 ระดับเท่านั้น depth > 1 ระบบจะ ignore ทั้งหมด นั่นคือ sub-agent ที่ coordinator delegate ไปแล้ว ไม่สามารถ delegate ต่อไปยัง sub-sub-agent ได้

ฝั่ง roster มีข้อจำกัดที่ 20 unique agents ใน multiagent.agents แต่ coordinator เรียก copy หลายตัวของ agent เดียวได้ ทำให้ thread ที่ associate กับ agent หนึ่งตัวมีได้หลาย thread พร้อมกัน

ฝั่ง concurrent thread รองรับสูงสุด 25 thread ต่อ session ที่หากต้องการเปิด thread เพิ่มหลังถึง limit ต้อง archive thread ที่ idle ออกก่อน

Thread management list, interrupt, archive

Thread ใน session คุยผ่าน endpoint ที่ list, interrupt และ archive ได้ การ list threads ใช้ GET /v1/sessions/:id/threads โดย thread ที่ parent_thread_id เป็น null คือ primary thread Session status เป็น aggregate ของทุก thread หาก thread ใด thread หนึ่งยัง running session จะอยู่ในสถานะ running ทั้งหมด

Interrupt thread ทำผ่าน event user.interrupt ที่ระบุ session_thread_id ของ thread เป้าหมาย ถ้าไม่ระบุ default เป็น primary thread Anthropic ระบุว่า interrupt ที่ child thread ซึ่ง blocked อยู่ที่ requires_action ระบบจะ mark pending tool call ทั้งหมดเป็น denied และ re-emit session.thread_status_idle พร้อม stop_reason: end_turn โดยตรง ระบบจะไม่ sample โมเดล ส่วน interrupt thread ที่ idle อยู่แล้วเป็น no-op

Archive thread ทำได้เฉพาะตอน thread อยู่ในสถานะ idle เท่านั้น ที่หาก thread ยัง running หรือ blocked อยู่ที่ requires_action ต้อง interrupt ก่อนถึง archive ได้ ที่ archive จะ free up slot จาก 25-thread limit

Event 6 ประเภทบน primary thread

Event ที่ surface บน primary thread เพื่อ track multi-agent activity มี 6 ประเภทหลัก

  • session.thread_created thread ใหม่ถูกสร้าง พร้อม session_thread_id และ agent_name
  • session.thread_status_running thread เริ่ม activity
  • session.thread_status_idle agent ของ thread นั้นรอ input พร้อม stop_reason ที่บอกเหตุผลที่ agent หยุด
  • session.thread_status_terminated thread ถูก archive หรือพบ terminal error
  • agent.thread_message_received agent ส่งผลกลับไปยัง coordinator พร้อม from_session_thread_id, from_agent_name, และ content
  • agent.thread_message_sent coordinator ส่ง follow-up ไปยัง agent พร้อม to_session_thread_id, to_agent_name, และ content

นอกเหนือจาก event เหล่านี้ ที่ต้องการ activity ระดับลึกของ agent ตัวเดียว สามารถ stream หรือ list event จาก thread นั้นโดยตรงได้ผ่าน GET /v1/sessions/:id/threads/:thread_id/stream หรือ endpoint /events ของ thread นั้น

Tool permission cross-post กลับ primary thread

กรณีพิเศษคือเวลา non-coordinator agent ต้องการ permission รัน tool ประเภท always_ask หรือ result ของ custom tool event เหล่านั้นจะ cross-post กลับมาที่ primary thread พร้อม session_thread_id ที่ระบุ thread ต้นทาง ทำให้ client ที่ subscribe primary thread เห็น tool confirmation request ของ sub-agent ได้

ผู้ใช้งานตอบกลับด้วย user.tool_confirmation (พร้อม tool_use_id) หรือ user.custom_tool_result (พร้อม custom_tool_use_id) ที่ระดับ session ส่วน server จะ route response ไปยัง thread ต้นทางอัตโนมัติ developer ไม่ต้องจัดการ routing เอง

SDK 9 ภาษา และ CLI

Anthropic ให้ตัวอย่าง code ใน docs 9 รูปแบบ ครอบคลุม bash ผ่าน curl, ant CLI, Python, TypeScript, C#, Go, Java, PHP และ Ruby ที่ทุก SDK ตั้งค่า beta header managed-agents-2026-04-01 ให้อัตโนมัติ ส่วน bash curl และตัวอย่างที่ raw HTTP ต้องระบุ header เองในทุก request

Outlook beta หมายความว่ายังเปลี่ยนได้

ฟีเจอร์ multi-agent ใน Managed Agents API ตอนนี้ยังเป็น beta ที่ต้องระบุ beta header managed-agents-2026-04-01 ในทุก request ส่วน SDK official handle header ให้แล้ว สำหรับ developer ที่ build agent product แบบ managed มันคือเครื่องมือที่ใช้ออกแบบ multi-agent topology ที่มี coordinator pattern + specialized roster ผ่าน infrastructure ของ Anthropic ได้โดยตรง โดยไม่ต้อง orchestrate context-isolated session กันเอง

ที่มา: Anthropic platform docs · Managed Agents Multi-agent