מתי להשתמש
"AI Agent", "Autonomous AI", "Agentic", "LangChain", "CrewAI", "AutoGen".
הוראות עבודה
1. What is an Agent
AI that autonomously executes multi-step tasks using tools.
vs. Standard LLM
- LLM: input → output.
- Agent: input → think → use tool → think → use tool → ... → output.
2. Agent Building Blocks
א. Planning
- Break task into steps.
- "I need to: 1. Search, 2. Filter, 3. Email."
ב. Tool Use
- Search, APIs, calculators, code execution.
- See
tool-use-function-callingskill.
ג. Memory
- Short-term: conversation context.
- Long-term: knowledge base, user preferences.
ד. Reflection
- Review own work.
- "Did I complete this correctly?"
ה. Loop
- Continue until task done.
- Stop conditions important.
3. Frameworks 2026
| Framework | Best For | Maturity |
|---|---|---|
| Anthropic Agents (Claude Agents SDK) | Production, MCP-based | Mature |
| LangChain Agents | Most flexibility, complex | Mature, complex |
| LlamaIndex Agents | RAG-heavy | Good |
| CrewAI | Multi-agent role-play | Easy onboarding |
| AutoGen (Microsoft) | Multi-agent conversations | Good |
| OpenAI Assistants API | Simple, OpenAI-locked | Easy |
4. When to Use Agents
✅ Good Use Cases
- Multi-step research.
- Data gathering across sources.
- Complex customer support.
- Automated report generation.
- Coding (Claude Code is agent).
❌ Bad Use Cases
- Simple Q&A (no tools needed).
- Real-time critical (latency).
- Deterministic logic (use code).
- Risky automated decisions (financial, medical).
5. Sample Agent (Pseudo-code)
from anthropic import Anthropic
client = Anthropic()
tools = [
{"name": "search_web", "description": "..."},
{"name": "send_email", "description": "..."},
{"name": "create_doc", "description": "..."},
]
messages = [{"role": "user", "content": "Research top 5 Israeli SaaS companies and email me a summary"}]
while True:
response = client.messages.create(
model="claude-sonnet-4-6",
tools=tools,
messages=messages
)
if response.stop_reason == "end_turn":
break
if response.stop_reason == "tool_use":
tool_use = next(b for b in response.content if b.type == "tool_use")
result = execute_tool(tool_use.name, tool_use.input)
messages.append({"role": "assistant", "content": response.content})
messages.append({"role": "user", "content": [{"type": "tool_result", "tool_use_id": tool_use.id, "content": result}]})
6. Production Considerations
Cost Control
- Max iterations — prevent runaway loops.
- Token budgets per task.
- Cache common operations.
Safety
- Approval before destructive actions (delete, send money).
- Sandbox for code execution.
- Rate limit API calls.
Reliability
- Idempotent tools — safe to retry.
- Fallback when stuck.
- Human-in-loop option.
7. Multi-Agent Systems
See multi-agent-systems skill.
8. Tool Use vs Agents
| Tool Use (Single Step) | Agent (Multi-Step Loop) | |
|---|---|---|
| Latency | Low (1 LLM call) | Higher (multiple) |
| Cost | Low | Higher |
| Complexity | Simple | Complex |
| Best for | "Get weather" | "Book flight + hotel" |
9. Israel Specifics
- Hebrew agents — Claude best.
- Local API integrations: WhatsApp Business, Israeli banks.
- Privacy: PII to agents — careful.
10. Common Pitfalls
❌ Infinite loops — set max iterations. ❌ Cost runaway — monitor. ❌ No human approval for destructive actions. ❌ Hallucinated tool calls — agent invents tools. ❌ Unclear task termination — when is "done"?
11. אסיים בהמלצה.
פרומפט לדוגמה
Build research agent that gathers data from 5 sources.
CrewAI vs LangChain — when each?
Production-ready agent for sales outreach. Architecture.
© 2026 AI Expert Pro | גרסה 1.0.0