ข้ามไปยังเนื้อหาบทเรียน
เมนู
เข้าสู่ระบบ — เร็ว ๆ นี้
สารบัญบทที่ 187/8

พื้นฐานการใช้ AIการเขียน Prompt

ติดตามทีม Agent ด้วย Trace, Cost และ Outcome

ออกแบบ “ติดตามทีม Agent ด้วย Trace, Cost และ Outcome” ให้ตรวจสอบ ควบคุมต้นทุน และกู้คืนได้ในงานจริง

เป้าหมาย: เลือกและควบคุมสถาปัตยกรรมหลาย Agent จาก dependency และความเสี่ยง · ใช้เวลาประมาณ 16 นาที

Decompose → Contract → Coordinate → Recover

แยกงานเฉพาะเมื่อการแยกทำให้ตรวจและกู้คืนง่ายขึ้น

Decompose

แยกตาม dependency, data boundary และ owner

Contract

กำหนด schema, tool, permission, budget และ stop

Coordinate

เลือก parallel/sequential และรวมผลด้วย rubric

Recover

เก็บ checkpoint, trace, retry, resume และ escalation

สิ่งที่ต้องออกแบบ

trace

ระบุ trace พร้อมหลักฐานและเงื่อนไขล้มเหลว

ความซับซ้อนต้องซื้อความเร็วหรือคุณภาพที่วัดได้

cost

ระบุ cost พร้อมหลักฐานและเงื่อนไขล้มเหลว

ผูก parent task กับ child trace, tool call, artifact, retry, cost, approval และ outcome เพื่อเห็น critical path และ failure propagation

critical path

ระบุ critical path พร้อมหลักฐานและเงื่อนไขล้มเหลว

ผูก parent task กับ child trace, tool call, artifact, retry, cost, approval และ outcome เพื่อเห็น critical path และ failure propagation

audit

ระบุ audit พร้อมหลักฐานและเงื่อนไขล้มเหลว

ผูก parent task กับ child trace, tool call, artifact, retry, cost, approval และ outcome เพื่อเห็น critical path และ failure propagation

ความซับซ้อนที่ไม่สร้างคุณค่า

แบ่งบทบาทจากชื่อตำแหน่ง

งานซ้ำและขอบเขตไม่ชัด

แบ่งจาก input/output/dependency

ให้ Agent แชร์การเขียน

race และข้อมูลทับกัน

single writer หรือ transaction

resume จากข้อความสุดท้าย

ทำ action ซ้ำ

durable checkpoint และ idempotency

ออกแบบงานหลายขั้น

งานล่าช้าแต่ dashboard แสดงเพียงว่า multi-agent กำลังทำงาน

กำหนด decomposition, contracts, schedule, checkpoint, budget, approval และ trace

ดูคำตอบตัวอย่าง

เริ่มจาก DAG ของหน่วยงานอิสระ ใช้ parallel เฉพาะ read-only กำหนด JSON contract และ single writer บันทึก checkpoint ต่อหน่วยพร้อม source version ใช้ idempotency key กำหนด deadline/cost budget รวมผลด้วย rubric และให้ human approval ก่อนผลกระทบภายนอก

  • DAG/dependency
  • contract
  • parallel/sequential
  • checkpoint/resume
  • budget/stop
  • trace/approval
บันทึกช่วยจำ
  • หลาย Agent เพิ่ม latency, cost และ failure surfaces ต้องพิสูจน์ประโยชน์ด้วย evaluation
  • จำกัด credential และข้อมูลต่อบทบาท

สรุปบทเรียนนี้

  • แยกงานตาม dependency
  • ทำ contract และ single writer
  • checkpoint trace และ recover