0Pricing
Prompt Engineering & LLM Optimization for Developers · บทเรียน

การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์

ทำให้เอเจนต์ฉลาดขึ้นด้วยการเปิดให้วิจารณ์และปรับปรุงผลงานของตนเอง เรียนรู้รูปแบบการไตร่ตรอง เมื่อใดควรใช้ และวิธีกำหนดขอบเขตสำหรับระบบจริง

การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์ เป็นบทเรียน Prompt Engineering & LLM Optimization for Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Prompt Engineering & LLM Optimization for Developers และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Prompt Engineering & LLM Optimization for Developers มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

What is Reflection?

Reflection is an agent pattern where the model reviews its own output, identifies flaws, and produces an improved version — without a human in the loop.

It turns a one-shot answer into an iterative draft-then-revise process.

The Generator-Critic Pattern

Two roles drive reflection:

  • Generator: produces a candidate answer
  • Critic: evaluates it against criteria and suggests fixes

They can be the same model with different prompts.

A Basic Reflection Loop

Generate, critique, then regenerate using the critique. Repeat until the critic is satisfied or a limit is hit.

let draft = generate(task);
for (let i = 0; i < maxIters; i++) {
  const fb = critique(task, draft);
  if (fb.ok) break;
  draft = revise(task, draft, fb.notes);
}

Writing the Critic Prompt

A good critic is specific. Give it explicit checklist criteria so feedback is actionable rather than vague praise.

Review the answer for:
1. Correctness
2. Completeness
3. Following the format spec
List concrete problems, or reply DONE.

Reflexion with Memory

The Reflexion technique stores past mistakes as text memory. The agent reads its prior reflections before the next attempt, so it does not repeat errors.

Tool-Grounded Reflection

Reflection is far stronger when the critic can run tests, compile code, or query data — replacing opinion with evidence.

const result = runTests(draft);
if (!result.passed) {
  draft = revise(task, draft, result.failures);
}

Bounding the Loop

Unbounded reflection can loop forever or burn tokens. Always cap iterations and add an early exit when the critic approves.

const MAX_ITERS = 3;
let iters = 0;
while (!approved && iters++ < MAX_ITERS) { /* ... */ }

Diminishing Returns

Quality usually plateaus after 2-3 cycles. Track whether each revision actually improves a measurable score; stop reflecting once gains stall.

Cost vs Quality

Each reflection cycle is extra LLM calls. Reserve reflection for high-value or error-prone tasks (code, planning) and skip it for simple ones.

Avoiding Self-Reinforcing Errors

A model can confidently approve its own wrong answer. Use a different model or external tools as the critic when correctness is critical.

Combining with Planning

In a larger agent, reflection sits after each major step: act, observe, reflect, adjust the plan. This makes long autonomous workflows far more robust.

Quick Check

Test your understanding.

Recap

You learned the reflection pattern: a generator-critic loop where the agent critiques and revises its own work. Use specific critic criteria, ground critiques in tools, store reflections as memory, bound iterations, and use an independent critic for high-stakes correctness.

คำถามที่พบบ่อย

บทเรียน “การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Prompt Engineering & LLM Optimization for Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Prompt Engineering & LLM Optimization for Developers มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์”

ทำให้เอเจนต์ฉลาดขึ้นด้วยการเปิดให้วิจารณ์และปรับปรุงผลงานของตนเอง เรียนรู้รูปแบบการไตร่ตรอง เมื่อใดควรใช้ และวิธีกำหนดขอบเขตสำหรับระบบจริง คุณปฏิบัติ Prompt Engineering & LLM Optimization for Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Prompt Engineering & LLM Optimization for Developers หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Prompt Engineering & LLM Optimization for Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Prompt Engineering & LLM Optimization for Developers นี้ได้ไหม

ได้ บทเรียน Prompt Engineering & LLM Optimization for Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. การออกแบบระบบหลายเอเจนต์
  2. การจัดการหน่วยความจำและสถานะสำหรับเอเจนต์
  3. การทำงานอัตโนมัติของกระบวนการ
  4. การไตร่ตรองและวงจรแก้ไขตนเองของเอเจนต์
← กลับไปที่ Prompt Engineering & LLM Optimization for Developers