מה שלמדנו מבניית סוכן שבונה סוכנים What we learned building an agent that builds agents

תובנות אמיתיות מהקוד שלנו, לא תיאוריה. כל כרטיס הוא לקח שעלה לנו במקרים אמיתיים — עם הקוד, הלוגים, וההחלטה. Real lessons from our codebase, not theory. Every card is a mistake or pattern that hit us in production — with the code, the logs, and the call.

אנטי-פטרןAnti-pattern

Schema Overload: הרבה כלים = פחות דיוק Schema Overload: more tools, less precision

חמש שעות bisect הראו שכשעוברים את 30 הכלים, Opus מתחיל לכתוב JSON-as-text במקום להפעיל tool_use אמיתי. Five hours of bisecting showed that past ~30 tools, Opus starts emitting JSON-as-text instead of real tool_use blocks.
פטרןPattern

Mandatory Tools: למה סוכנים "משקרים" שביצעו Mandatory Tools: why agents "lie" about execution

סוכן ידווח "deploy successful" גם כשלא יצא הרבה מעבר ל-think. הפתרון: enforcement layer שדוחה done בלי כל הכלים. An agent will report "deploy successful" while never going past think. The fix: an enforcement layer that rejects done without the full toolset.
ארכיטקטורהArchitecture

זיכרון בשלוש שכבות: HOT / WARM / COLD Memory in three tiers: HOT / WARM / COLD

זיכרון-הכל-בכל-שיחה שובר את חלון ההקשר. שלוש שכבות — נטען-תמיד, נטען-לפי-תאריך, אינדקס-בלבד — פותרות את זה. Everything-in-every-prompt blows the context window. Three tiers — always-loaded, date-loaded, indexed-only — solve it.
ארכיטקטורהArchitecture

Session-as-State, לא Heuristics Session-as-State, not heuristics

Cursor, Lovable ו-Replit נועלים project_id ב-session. רק tool מפורש פותח חדש. אצלנו זה היה משפט בצ'אט. Cursor, Lovable, and Replit lock project_id in the session. Only an explicit tool opens a new one. Ours used to be a sentence in chat.
פטרןPattern

Parallel-turn: לא להרוג turn כי המשתמש כתב Parallel-turn: don't kill a turn just because the user typed

"abort on new message" נשמע אינטואיטיבי וגורם build לחתוך באמצע. Claude Code ו-Cursor פשוט ממתינים. "Abort on new message" feels intuitive and chops mid-build. Claude Code and Cursor simply wait.
תפעולOps

Critic loop: ground truth זה ה-URL החי, לא ה-DB Critic loop: ground truth is the live URL, not the DB

הסוכן יכול להגיד "deployed" וה-DB יסכים. רק fetch ל-URL החי באמת מספר את האמת. The agent can say "deployed", the DB will agree. Only a real fetch to the live URL tells the truth.
תפעולOps

Model routing: Haiku / Sonnet / Opus לפי משימה Model routing: Haiku / Sonnet / Opus per task

הרצת הכל על Opus = $300-800/חודש לכל 100 לקוחות. ניתוב חכם + prompt caching = $40-60. Everything on Opus = $300-800/month per 100 customers. Smart routing + prompt caching = $40-60.
יסודותFundamentals

מה הופך מודל לסוכן: לולאת sense → think → act What turns a model into an agent: the sense → think → act loop

צ'אטבוט עונה. סוכן מבצע. ההבדל היחיד הוא לולאה אחת — וכלים שמשנים את העולם. A chatbot replies. An agent acts. The only difference is one loop — and tools that change the world.
יסודותFundamentals

פרוטוקול Tool Use: ההבדל בין "קוד" לסוכן אמיתי The Tool Use protocol: the line between "code" and a real agent

Tool use זה לא JSON בטקסט. זה בלוק נפרד ב-API שהמודל מסמן בו "הפעל את X עם הפרמטרים האלה". כשזה נשבר, הסוכן נשבר. Tool use isn't JSON in text. It's a dedicated API block where the model signals "invoke X with these params". When it breaks, the agent breaks.
יסודותFundamentals

חלון ההקשר הוא זיכרון העבודה — לא מאגר הידע The context window is working memory — not a knowledge store

200K טוקנים זה הרבה. זה גם לא הרבה. אם דחפת לשם הכל, אתה משלם פעמיים: בעלות, ובדיוק. 200K tokens is a lot. It's also not a lot. If you stuff it with everything, you pay twice: in cost, and in accuracy.
PlaybookPlaybook

Prompt Caching: ההנחה של 90% שרוב הצוותים מפספסים Prompt Caching: the 90% discount most teams miss

אותו prompt בראש — אותו hash. Anthropic מחזיר אותו tokens מ-cache ב-10% ממחיר. הסוד הוא לא לזוז. Same prompt prefix — same hash. Anthropic serves cached tokens at 10% of input price. The trick is to stop moving it.
PlaybookPlaybook

Eval Gates: לפני שאומרים "סיימתי" Eval Gates: before you say "done"

"זה עובד אצלי" זה לא סטטוס. Definition of Done עם שלושה gates אוטומטיים זה כן. "Works on my machine" isn't a status. A Definition of Done with three automated gates is.
PlaybookPlaybook

Idempotency Keys: איך מונעים שלוש בניות-רפאים מאותה הודעה Idempotency Keys: how to stop three ghost builds from one message

שני clicks מהירים, רענון דף, retry של רשת — ובלי key אתה עם 3 builds מקבילים על אותו פרויקט. עם key, אחד. Two fast clicks, a page refresh, a network retry — without a key you have 3 parallel builds on the same project. With one, you have one.
מהספרייהFrom the library

Anatomy של כלי טוב: שם, תיאור, פרמטרים Anatomy of a good tool: name, description, parameters

המודל יבחר את הכלי הנכון אם הסכמה ברורה. אם צריך להסביר בפרומפט מתי לקרוא לכלי — הכלי שגוי או חסר. The model picks the right tool when the schema is clear. If you have to explain in the prompt when to call a tool, the tool is wrong or missing.
מהספרייהFrom the library

Anti-pattern: כלי שעושה הכל Anti-pattern: the do-anything tool

פיתוי קלאסי: כלי אחד עם action שמכיל את כל הפעולות. המודל מתבלבל מאיזה מצב לבחור — בכל פעם. Classic temptation: one tool with an action field that holds every operation. The model gets confused which branch to take — every time.
מהספרייהFrom the library

Sub-agents: מתי לפצל ואיך להחזיר תוצאות Sub-agents: when to split and how to return results

שלוש סיבות לפצל ל-sub-agent: ה-context יתעמיס, יש 3+ תתי-משימות עצמאיות שאפשר במקביל, או שצריך isolation מהיסטוריה רגישה. Three reasons to spawn a sub-agent: context will overload, there are 3+ independent subtasks that can run in parallel, or you need isolation from sensitive history.
מהספרייהFrom the library

Retry strategy: מטריצה לפי קוד שגיאה Retry strategy: a matrix by error code

לא כל שגיאה ראויה ל-retry. timeout כן, 400 לא, 429 עם backoff. רוב הקוד שראינו עושה אחד מ-3 דברים שגויים: לא חוזר בכלל, חוזר על הכל, או חוזר ללא backoff. Not every error deserves a retry. Timeouts yes, 400s no, 429s with backoff. Most code we've seen does one of three wrong things: never retries, retries everything, or retries without backoff.
מהספרייהFrom the library

Stop reasons: 4 הסיבות לעצירת turn Stop reasons: the 4 ways a turn ends

אם ה-loop שלך לא מבדיל בין end_turn, tool_use, max_tokens ו-stop_sequence — אתה ירא לולאות אינסופיות, או הרבה יותר גרוע: סיומים שתקועים באמצע tool call. If your loop doesn't distinguish end_turn, tool_use, max_tokens and stop_sequence — you're one bug away from infinite loops or, worse, terminations stuck mid-tool.
מהספרייהFrom the library

תכנון לפני קוד — עם ציון סיכון Plan before code — with a risk score

תכנון בלי ציון סיכון הוא checklist. עם ציון סיכון, הוא חוזה שאומר לסוכן מתי לעצור ולשאול — ומתי פשוט לבצע. A plan without risk scoring is a checklist. With risk scoring, it becomes a contract that tells the agent when to stop and ask — and when to just execute.
מהספרייהFrom the library

חוקי ברזל בלולאת הסוכן Iron rules for the agent loop

ארבעה כללים שאם הסוכן לא מקיים אותם — הוא לא סוכן, הוא פטפטן עם API access. הכל נאכף בקוד, לא בפרומפט. Four rules. If the agent breaks them, it isn't an agent — it's a chatbox with API access. All four are enforced in code, not in the prompt.
מהספרייהFrom the library

עברית כשפה ראשונה: tokenization, RTL, וזיהוי טכני Hebrew as a first-class language: tokenization, RTL, and technical mixing

עברית עולה יותר tokens, ניקוד שובר מודלים, ו-RTL במספר מילה אחת מקלקל פלט HTML שלם. אלו לא פרטים, אלו החלטות מוצר. Hebrew costs more tokens, niqqud breaks models, and a single mixed-direction word can wreck a whole HTML page. These aren't details — they're product decisions.

אין כרטיסים בקטגוריה הזאת עדיין. No articles in this category yet.

כל לקח כאן שולם ב-build אמיתי. רוצים לראות איך הסוכן שלכם נראה אחרי שהפנמנו אותם? התחילו עכשיו. Every lesson here was paid for in a real build. Want to see what your agent looks like after we internalized them? Start now.

מסלולי קריאהReading paths

לא יודע מאיפה להתחיל? בחר מטרה.Not sure where to start? Pick a goal.

למתחיליםFor beginners

להתחיל לבנות סוכניםStart building agents

היסודות שכל סוכן עומד עליהם — לולאה, כלים, חלון הקשר.The fundamentals every agent rests on — loop, tools, context window.

  1. מה הופך מודל לסוכןWhat turns a model into an agent
  2. פרוטוקול Tool UseThe Tool Use protocol
  3. חלון ההקשרThe context window
  4. Anatomy של כלי טובAnatomy of a good tool
  5. 4 סיבות לעצירת turnThe 4 stop reasons