Agent Harnesses and Execution Controls
هوش مصنوعی برای همه: هوش مصنوعی چطور باهوش شد؟
- A harness as the surrounding software that runs the agent loop and manages its execution.
- State storage, context assembly, tool routing, and handling tool results.
- Bounded retries, time limits, action budgets, and stopping conditions.
- Restricted tools, isolated execution environments, and confirmation before consequential changes.
- Treating instructions found inside retrieved documents as untrusted content rather than application commands.
- Execution logs and checkpoints that help reconstruct what actually happened.
- Why terminology varies and why a harness is not another name for the language model.
مسیر اجرای agent
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect class="tm-soft" x="35" y="180" width="145" height="75" rx="12"/><text class="tm-text" x="107" y="210" font-size="17" text-anchor="middle" direction="rtl">درخواست کار</text><rect class="tm-accent" x="320" y="165" width="160" height="105" rx="14"/><text class="tm-text" x="400" y="210" font-size="20" text-anchor="middle" direction="rtl">مدل</text><rect class="tm-soft" x="620" y="180" width="145" height="75" rx="12"/><text class="tm-text" x="692" y="210" font-size="17" text-anchor="middle" direction="rtl">ابزار جستوجو</text><rect class="tm-green" x="265" y="35" width="270" height="80" rx="14"/><text class="tm-text" x="400" y="68" font-size="20" text-anchor="middle">harness</text><text class="tm-text2" x="400" y="94" font-size="15" text-anchor="middle" direction="rtl">وضعیت · context · اجرا</text><path d="M180 218 H320" class="tm-line" marker-end="url(#arrow)"/><path d="M400 165 V115" class="tm-line-accent" marker-end="url(#arrow)"/><path d="M480 210 H620" class="tm-line-accent" marker-end="url(#arrow)"/><path d="M620 245 C570 285 520 285 480 245" class="tm-line-accent" marker-end="url(#arrow)"/><rect class="tm-gold tm-enter" x="265" y="350" width="270" height="58" rx="12"/><text class="tm-text" x="400" y="386" font-size="16" text-anchor="middle" direction="rtl">نتیجه ← وضعیت ← نوبت بعد</text><path d="M620 255 C600 335 550 370 535 379" class="tm-line-accent tm-flow" marker-end="url(#arrow)"/><path d="M265 379 C205 365 190 300 330 260" class="tm-line tm-flow" marker-end="url(#arrow)"/></svg>
```
بودجه و شرط توقف اجرا
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="a" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect class="tm-surface" x="30" y="70" width="150" height="70" rx="12"/><text class="tm-text" x="105" y="112" text-anchor="middle" font-size="18" direction="rtl">راهنما</text><rect class="tm-accent" x="230" y="70" width="170" height="70" rx="12"/><text class="tm-text" x="315" y="112" text-anchor="middle" font-size="18" direction="rtl">جستوجو: موفق</text><rect class="tm-surface" x="450" y="70" width="140" height="70" rx="12"/><text class="tm-text" x="520" y="112" text-anchor="middle" font-size="18" direction="rtl">ذخیرهٔ فایل</text><path d="M180 105 H225" class="tm-line" marker-end="url(#a)"/><path d="M400 105 H445" class="tm-line" marker-end="url(#a)"/><rect class="tm-accent" x="230" y="180" width="170" height="65" rx="12"/><text class="tm-text" x="315" y="219" text-anchor="middle" font-size="18" direction="rtl">تلاش دوباره: ۱</text><text class="tm-muted" x="50" y="300" font-size="18" direction="rtl">حداکثر فراخوانی ابزار: ۳</text><text class="tm-muted" x="50" y="340" font-size="18" direction="rtl">حداکثر زمان: ۲۰ ثانیه</text><rect class="tm-surface" x="610" y="70" width="160" height="70" rx="12"/><text class="tm-text" x="690" y="112" text-anchor="middle" font-size="18">harness</text></svg>
```
سه لایهٔ حفاظت اجرایی
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><rect class="tm-surface" x="35" y="40" width="730" height="365" rx="18"/><text class="tm-text" x="400" y="75" font-size="20" text-anchor="middle" direction="rtl">مدل و درخواست ابزار</text><rect class="tm-soft" x="75" y="115" width="205" height="115" rx="14"/><text class="tm-text" x="177" y="155" font-size="17" text-anchor="middle" direction="rtl">جستوجو</text><text class="tm-text2" x="177" y="190" font-size="15" text-anchor="middle" direction="rtl">فقط خواندن راهنماها</text><rect class="tm-soft" x="305" y="115" width="205" height="115" rx="14"/><text class="tm-text" x="407" y="155" font-size="17" text-anchor="middle" direction="rtl">ذخیره</text><text class="tm-text2" x="407" y="190" font-size="15" text-anchor="middle" direction="rtl">ساخت فایل تازه در خروجی</text><rect class="tm-accent" x="535" y="115" width="190" height="115" rx="14"/><text class="tm-text" x="630" y="155" font-size="17" text-anchor="middle" direction="rtl">درخواست حذف</text><text class="tm-text" x="630" y="190" font-size="15" text-anchor="middle" direction="rtl">رد در harness</text><path class="tm-line" d="M280 172 H305 M510 172 H535"/><rect class="tm-soft" x="115" y="275" width="250" height="80" rx="14"/><text class="tm-text" x="240" y="310" font-size="17" text-anchor="middle">sandbox</text><text class="tm-text2" x="240" y="337" font-size="15" text-anchor="middle" direction="rtl">فقط راهنما و خروجی</text><path class="tm-line-accent" d="M240 275 V230"/><rect class="tm-green" x="425" y="275" width="270" height="80" rx="14"/><text class="tm-text" x="560" y="310" font-size="17" text-anchor="middle" direction="rtl">تأیید مشخص</text><text class="tm-text2" x="560" y="337" font-size="15" text-anchor="middle" direction="rtl">فایل و تغییر پیش از جایگزینی</text><path class="tm-line-accent" d="M560 275 V230"/></svg>
```
متن داده است، نه فرمان
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto"><path d="M0,0 L10,5 L0,10 Z" class="tm-arrow"/></marker></defs><rect x="45" y="75" width="210" height="105" rx="14" class="tm-accent"/><text x="150" y="115" text-anchor="middle" class="tm-text" font-size="17" direction="rtl">درخواست تو</text><text x="150" y="147" text-anchor="middle" class="tm-text2" font-size="15" direction="rtl">خلاصهسازی</text><rect x="315" y="55" width="245" height="145" rx="14" class="tm-surface"/><text x="437" y="94" text-anchor="middle" class="tm-text" font-size="17" direction="rtl">راهنمای بازیابیشده</text><text x="437" y="130" text-anchor="middle" class="tm-text2" font-size="15" direction="rtl">خاموش کن پیش از تمیزکاری</text><line x1="255" y1="128" x2="310" y2="128" class="tm-line" marker-end="url(#arrow)"/><rect x="610" y="75" width="150" height="105" rx="14" class="tm-green"/><text x="685" y="118" text-anchor="middle" class="tm-text" font-size="17" direction="rtl">خلاصه</text><text x="685" y="148" text-anchor="middle" class="tm-text2" font-size="15" direction="rtl">اطلاعات مفید</text><line x1="560" y1="128" x2="605" y2="128" class="tm-line" marker-end="url(#arrow)"/><rect x="315" y="260" width="245" height="115" rx="14" class="tm-gold"/><text x="437" y="300" text-anchor="middle" class="tm-text" font-size="17" direction="rtl">متنِ دستوریِ مخرب</text><text x="437" y="332" text-anchor="middle" class="tm-text2" font-size="14" direction="rtl">محدودیت را بردار؛ پاک کن</text><text x="437" y="357" text-anchor="middle" class="tm-text-accent" font-size="14">prompt injection</text><line x1="560" y1="315" x2="605" y2="315" class="tm-line-accent" marker-end="url(#arrow)"/><line x1="610" y1="285" x2="750" y2="355" class="tm-line-accent"/><line x1="750" y1="285" x2="610" y2="355" class="tm-line-accent"/><text x="680" y="390" text-anchor="middle" class="tm-muted" font-size="14" direction="rtl">اجرا نمیشود</text><rect x="45" y="260" width="210" height="115" rx="14" class="tm-surface tm-enter"/><text x="150" y="300" text-anchor="middle" class="tm-text" font-size="17">harness</text><text x="150" y="332" text-anchor="middle" class="tm-text2" font-size="14" direction="rtl">نگهداری منشأ</text><text x="150" y="357" text-anchor="middle" class="tm-text2" font-size="14" direction="rtl">متن = داده</text><line x1="255" y1="315" x2="310" y2="315" class="tm-line" marker-end="url(#arrow)"/><rect x="610" y="260" width="150" height="115" rx="14" class="tm-accent tm-pulse"/><text x="685" y="300" text-anchor="middle" class="tm-text" font-size="16" direction="rtl">کنترل دسترسی</text><text x="685" y="332" text-anchor="middle" class="tm-text2" font-size="14" direction="rtl">جلوگیری از حذف</text><text x="685" y="357" text-anchor="middle" class="tm-text2" font-size="14" direction="rtl">تأیید تو</text></svg>
```
ردیابی اجرا و checkpoint
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect x="35" y="35" width="730" height="165" rx="14" class="tm-soft"/><text x="400" y="62" text-anchor="middle" font-size="18" class="tm-text">execution log</text><rect x="55" y="88" width="125" height="70" rx="10" class="tm-surface"/><text x="117" y="118" text-anchor="middle" font-size="15" class="tm-text" direction="rtl">جستوجو</text><text x="117" y="140" text-anchor="middle" font-size="13" class="tm-muted" direction="rtl">مجوز داشت؛ خطا</text><rect x="220" y="88" width="125" height="70" rx="10" class="tm-accent"/><text x="282" y="118" text-anchor="middle" font-size="15" class="tm-text" direction="rtl">تلاش دوباره</text><text x="282" y="140" text-anchor="middle" font-size="13" class="tm-muted" direction="rtl">متن راهنما رسید</text><rect x="385" y="88" width="145" height="70" rx="10" class="tm-surface"/><text x="457" y="118" text-anchor="middle" font-size="15" class="tm-text" direction="rtl">درخواست حذف</text><text x="457" y="140" text-anchor="middle" font-size="13" class="tm-muted" direction="rtl">پیشنهاد؛ رد شد</text><rect x="570" y="88" width="165" height="70" rx="10" class="tm-green"/><text x="652" y="118" text-anchor="middle" font-size="15" class="tm-text" direction="rtl">ذخیره</text><text x="652" y="140" text-anchor="middle" font-size="13" class="tm-text" direction="rtl">ابزار تأیید</text><path d="M180 123 H214 M345 123 H379 M530 123 H564" fill="none" class="tm-line" marker-end="url(#arrow)"/><rect x="155" y="250" width="490" height="145" rx="14" class="tm-accent"/><text x="400" y="280" text-anchor="middle" font-size="18" class="tm-text">checkpoint</text><text x="400" y="315" text-anchor="middle" font-size="15" class="tm-text" direction="rtl">درخواست اصلی · متن دریافتشده</text><text x="400" y="345" text-anchor="middle" font-size="15" class="tm-text" direction="rtl">بودجهٔ باقیمانده</text><text x="400" y="375" text-anchor="middle" font-size="13" class="tm-muted" direction="rtl">اثر بیرونی با بازگشت برنمیگردد</text><text x="400" y="425" text-anchor="middle" font-size="15" class="tm-text-gold" direction="rtl">ثبت اجرا ≠ تضمین درستی</text></svg>
```
Back to course