0Pricing
Prompt Engineering & LLM Optimization for Developers · درس

التأمل الذاتي للوكلاء وحلقات التصحيح الذاتي

اجعل الوكلاء أكثر ذكاءً عبر تمكينهم من نقد عملهم ومراجعته ذاتيًا. تعلّم نمط التأمل، ومتى تستخدمه، وكيف تضع له حدودًا في بيئة الإنتاج.

التأمل الذاتي للوكلاء وحلقات التصحيح الذاتي درس مجاني في Prompt Engineering & LLM Optimization for Developers على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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.

الأسئلة الشائعة

هل درس «التأمل الذاتي للوكلاء وحلقات التصحيح الذاتي» مجاني؟

نعم — نص درس «التأمل الذاتي للوكلاء وحلقات التصحيح الذاتي» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Prompt Engineering & LLM Optimization for Developers، انتقل إلى CoddyKit PRO. تتضمن دورة Prompt Engineering & LLM Optimization for Developers 4 دروس في المجموع.

ماذا ستتعلم في «التأمل الذاتي للوكلاء وحلقات التصحيح الذاتي»؟

اجعل الوكلاء أكثر ذكاءً عبر تمكينهم من نقد عملهم ومراجعته ذاتيًا. تعلّم نمط التأمل، ومتى تستخدمه، وكيف تضع له حدودًا في بيئة الإنتاج. تتمرن على Prompt Engineering & LLM Optimization for Developers مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 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 يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. تصميم الأنظمة متعددة الوكلاء
  2. إدارة الذاكرة والحالة للوكلاء
  3. أتمتة سير العمل المستقلة
  4. التأمل الذاتي للوكلاء وحلقات التصحيح الذاتي
← العودة إلى Prompt Engineering & LLM Optimization for Developers