דיאגרמה · ארכיטקטורת אגנטים

AI Agent —
6 שכבות מלאות

רוב המתחילים בונים רק שכבות 2 ו-3 (LLM + לוגיקה) ושוכחים את ה-4 הנותרות. הדיאגרמה המלאה של סטאק אגנט שעובד בייצור — Input, Orchestration, LLM, Tools, Output, Infrastructure.

6שכבות
4שמכולם שוכחים
0תיאוריה

הסטאק המלא

המקרא של אגנט שעובד בפועל — כל שכבה, מה היא עושה, ומה הכלים הפופולריים בכל אחת.

AGENT

6 השכבות — דיאגרמה

איך לקרוא: הזרימה היא מלמעלה למטה. טריגר נכנס בשכבה 1, הלוגיקה (2) מחליטה מה לעשות, ה-LLM (3) חושב, הכלים (4) פועלים, התוצאה (5) זורמת החוצה, התשתית (6) מחזיקה הכל בייצור.
┌─────────────────────────────────────────────────────────────────┐
│                    AI AGENT — 6 LAYER STACK                      │
└─────────────────────────────────────────────────────────────────┘

1. INPUT LAYER  ──────────────────────────────────────────────────
   What triggers the agent
   • User prompt (chat interface)
   • Webhook event (form submit, API call)
   • Cron job (scheduled task)
   • File watcher (new email, new ticket)
   ↓
2. ORCHESTRATION LAYER ───────────────────────────────────────────
   The "brain" — decides what to do next
   • LangChain · LangGraph · CrewAI · Pydantic AI
   • Loop: Plan → Act → Observe → Repeat
   • Decides: call LLM? call tool? finish?
   ↓
3. LLM + MEMORY LAYER ────────────────────────────────────────────
   Reasoning + state
   • LLM: Claude / GPT / Gemini
   • Short-term: conversation history (context window)
   • Long-term: vector DB — Pinecone / Weaviate / pgvector
   • Prevents the "amnesia" problem between calls
   ↓
4. TOOLS LAYER ───────────────────────────────────────────────────
   What the agent can DO
   • Web search (Brave, Tavily, SerpAPI)
   • Code execution (E2B, Modal sandboxes)
   • Email send/read (Gmail API, SendGrid)
   • File operations, DB queries, custom APIs
   • Each tool = a function the LLM can call
   ↓
5. OUTPUT LAYER ──────────────────────────────────────────────────
   The result
   • Structured response (JSON, markdown, HTML)
   • Trigger to another system (webhook out)
   • Human-readable text
   • File generation (PDF, doc, image)
   ↓
6. INFRASTRUCTURE LAYER ──────────────────────────────────────────
   What keeps it running in production
   • Queue: Redis, BullMQ, Celery (for async tasks)
   • Logging: LangSmith, Helicone, Langfuse (observability)
   • Deployment: Docker, Modal, AWS Lambda, Cloud Run
   • Auth + rate limiting + cost tracking
צ'קליסט

צ'קליסט: לפני שאתה מעלה אגנט לפרודקשן

אם ענית "לא" על אחד מאלה — האגנט שלך לא מוכן לפרודקשן עדיין. כל ה-X הם הסיבות שאגנטים נופלים אחרי שבוע.
[ ] Input
    Is there an automated trigger (not just a button)?
    If a human has to click "run" — it's a script, not an agent.

[ ] Orchestration
    Is there clear logic for "when to stop"?
    Without termination criteria, agents loop forever and burn money.

[ ] Memory
    Is there a vector DB or just the context window?
    Context window alone = the agent forgets between sessions.

[ ] Tools
    At least 2 distinct tools the agent can call?
    One tool = a function call. Two+ = an agent.

[ ] Output
    Does the result flow to another system or just sit on screen?
    "Sits on screen" = it's a chatbot, not an agent.

[ ] Infra
    Queue + Logging + Error handling all in place?
    Without these three: the agent works on day 1, breaks on day 7.

──────────────────────────────────────────

Common mistakes I see in 8/10 agent projects:
- Skipping memory layer → agent has amnesia
- No tool integration → just a fancy chatbot
- No queue → blocking calls take down the app
- No logging → impossible to debug when it fails
- Cost runaway → no rate limit on LLM calls

איך משתמשים — צעד אחר צעד

פעם אחת מגדירים. אחרי זה זה רץ לבד.

1

התחל עם שכבה 1 — מה הטריגר

החליטו: מה גורם לאגנט לרוץ? webhook, cron, צפייה בקובץ. אם אין טריגר אוטומטי — בנו אותו ראשון.

2

בנה את הלוגיקה (שכבה 2) במסגרת

LangGraph (אם אתם רציניים) או CrewAI (אם רוצים לרוץ מהר). אל תכתבו לולאת agent ידנית.

3

חבר LLM + memory (שכבה 3)

Claude/GPT לחשיבה, Pinecone או pgvector לזיכרון ארוך טווח. בלי vector DB — האגנט שוכח כל שיחה.

4

הגדר כלים אמיתיים (שכבה 4)

לפחות 2 כלים שונים. בלי זה — זה chatbot, לא אגנט. דוגמאות: web search, code exec, gmail, custom API.

5

נתב את ה-output (שכבה 5)

התוצאה הולכת לאן? webhook החוצה, מייל ללקוח, רשומה ב-DB. אם זה רק על המסך — האגנט לא משולב במערכת.

6

עטוף בתשתית (שכבה 6)

Queue (Redis/BullMQ), Logging (LangSmith), Deployment (Docker/Modal). בלי השלישיה הזו — האגנט עובד שבוע ונופל.

רוצה להישאר מעודכן?

פעם בשבוע — פרק חדש בסדרה + פרומפט/תבנית כמו זאת. בלי ספאם, אפשר לצאת בכל זמן.

לא משתפים פרטים. לעולם.