ما هي AI Agents وكيف تستخدم الأدوات؟ | What Are AI Agents and How Do They Use Tools?
تعلّم ببساطة، خطوة بخطوة
Learn simply, step by step
معلومة واضحة، ثم خطوة جديدة.
Clear knowledge, one step at a time.
ما هي AI Agents وكيف تستخدم الأدوات؟ What Are AI Agents and How Do They Use Tools?
ما هي AI Agents؟
تُعد AI Agents خطوة متقدمة في بناء أنظمة الذكاء الاصطناعي، لأنها لا تكتفي بتوليد إجابة نصية فقط، بل يمكن تصميمها لاختيار الأدوات المناسبة وتنفيذ خطوات تساعد على تحقيق هدف محدد.
بشكل مبسط، يمكن أن يستخدم AI Agent نموذج لغة كبير LLM لفهم طلب المستخدم، ثم يحدد الخطوة التالية ويستخدم أداة متاحة مثل API أو البحث أو قاعدة بيانات، وبعد ذلك يستفيد من النتيجة لإكمال المهمة.

كيف تعمل AI Agents؟
يمكن تبسيط طريقة عمل الوكيل بالشكل التالي:
Goal → AI Agent → Choose Tool → Execute Tool → Result → Next Step → Final Response
يبدأ النظام بهدف أو طلب من المستخدم. يقوم الـAgent بتحليل المهمة وتحديد ما يحتاج إليه، ثم يختار من الأدوات المسموح له باستخدامها.
بعد تنفيذ الأداة والحصول على النتيجة، يمكن للـAgent استخدام هذه المعلومات لتحديد الخطوة التالية أو إنشاء الاستجابة النهائية.
ما الفرق بين AI Agent وChatbot عادي؟
الـChatbot البسيط قد يستقبل سؤالًا ويرسل السؤال إلى نموذج اللغة ثم يعرض الإجابة:
Question → LLM → Answer
أما AI Agents فيمكن تصميمها لتنفيذ خطوات إضافية واستخدام أدوات خارجية لتحقيق الهدف:
Goal → LLM → Tool → Result → Decision → Action
لكن كلمة Agent لا تعني أن النظام يستطيع فعل أي شيء تلقائيًا. قدراته تعتمد على الأدوات والصلاحيات والتعليمات التي يوفرها له التطبيق.
ما المقصود بـTool Use؟
Tool Use يعني السماح لنظام AI باستخدام وظائف أو أدوات محددة بدل الاعتماد فقط على النص الذي يولده نموذج اللغة.
يمكن أن تشمل هذه الأدوات:
- البحث على الويب.
- استدعاء APIs.
- قراءة معلومات من قاعدة بيانات.
- إجراء عمليات حسابية.
- قراءة أو معالجة ملفات.
- إرسال رسالة أو إشعار.
- تشغيل Workflow أو وظيفة داخل تطبيق.
ما هو Function Calling؟
Function Calling أو استدعاء الأدوات هو أسلوب يسمح للتطبيق بتعريف مجموعة من الوظائف أو الأدوات التي يمكن للنموذج الاختيار بينها عند الحاجة.
على سبيل المثال، يمكن أن نوفر للنظام أداة باسم:
get_crypto_price(symbol)
إذا طلب المستخدم معرفة سعر Bitcoin، يستطيع النموذج تحديد أن هذه الأداة مناسبة وإرجاع المعلومات اللازمة لاستدعائها.
يقوم التطبيق بتنفيذ الأداة فعليًا، ثم يعيد نتيجتها إلى النموذج أو يستخدمها في الخطوة التالية.
هل نموذج اللغة ينفذ الأداة بنفسه؟
ليس بالضرورة. من المهم التمييز بين اختيار الأداة وتنفيذها.
في كثير من الأنظمة، يحدد النموذج الأداة التي يريد استخدامها والمدخلات المطلوبة، بينما يقوم التطبيق أو نظام الأتمتة بتنفيذ الأداة الحقيقية ثم يعيد النتيجة.
يمكن تبسيط ذلك هكذا:
LLM Chooses Tool → Application Executes Tool → Tool Result → LLM
مثال عملي على AI Agent
لنفترض أن المستخدم يطلب:
اعرف سعر Bitcoin الحالي ثم حوّل قيمة 100 دولار إلى BTC.
يمكن للـAgent تنفيذ المهمة على عدة مراحل:
- فهم الهدف المطلوب.
- اختيار API للحصول على سعر Bitcoin.
- استقبال السعر الحالي.
- استخدام أداة حساب أو وظيفة لتحويل 100 دولار إلى BTC.
- تنظيم النتيجة.
- تقديم الإجابة النهائية للمستخدم.
هنا لم يعتمد النظام فقط على المعرفة الموجودة في نموذج اللغة، بل استخدم أداة للحصول على البيانات المطلوبة لتنفيذ المهمة.
المكونات الأساسية لـAI Agent
يمكن أن تختلف بنية الوكلاء من نظام إلى آخر، لكن العديد من أنظمة AI Agents تجمع بين مجموعة من المكونات مثل:
- Goal / Instructions: الهدف والقواعد التي تحدد المطلوب من النظام.
- LLM: يساعد على فهم المهمة واختيار الخطوات أو الأدوات المناسبة.
- Tools: الوظائف وAPIs والخدمات التي يمكن للنظام استخدامها.
- Context: المعلومات المتاحة للنظام أثناء تنفيذ المهمة.
- Memory: يمكن إضافتها في بعض الأنظمة للاحتفاظ بمعلومات مفيدة بين خطوات أو تفاعلات معينة.
AI Agent أم Workflow ثابت؟
الـWorkflow التقليدي يتبع عادةً خطوات محددة مسبقًا:
Step A → Step B → Step C
أما الـAgent فيمكن أن يحتوي على قدر من الاختيار، بحيث يحدد الأداة أو الخطوة التالية وفقًا للهدف والنتائج المتاحة.
لكن هذا لا يعني أن Agent أفضل دائمًا. إذا كانت العملية واضحة وثابتة، فقد يكون Workflow التقليدي أبسط وأكثر قابلية للتوقع وأقل تكلفة.
تكون AI Agents أكثر فائدة عندما تحتاج المهمة إلى التعامل مع مدخلات متنوعة أو اختيار أدوات وخطوات مختلفة حسب الحالة.
دمج RAG مع AI Agents
يمكن للـAgent استخدام RAG كإحدى الأدوات المتاحة له. فإذا احتاج إلى معلومات من قاعدة معرفة، يمكنه استرجاع المعلومات المناسبة ثم استخدامها لاتخاذ الخطوة التالية.
وهكذا يمكن دمج المفاهيم التي تعلمناها في هذا المسار:
Agent → RAG / API / Tool → Data → LLM → Structured Output → Action
وهذه البنية تسمح ببناء تطبيقات AI أكثر قدرة على التعامل مع البيانات والأدوات الخارجية.
أمان AI Agents والصلاحيات
كلما زادت الأدوات المتاحة للـAgent، زادت أهمية التحكم في الصلاحيات.
لا ينبغي منح Agent صلاحيات أكثر مما يحتاج إليه لتنفيذ المهمة. فهناك فرق كبير بين أداة تسمح بقراءة بيانات وأداة تستطيع تعديل البيانات أو إرسال رسائل أو تنفيذ معاملات.
ومن الممارسات المهمة:
- تحديد الأدوات التي يستطيع Agent استخدامها.
- استخدام أقل قدر ضروري من الصلاحيات.
- التحقق من المدخلات قبل تنفيذ الإجراءات الحساسة.
- طلب تأكيد بشري قبل الإجراءات المهمة عند الحاجة.
- تسجيل العمليات لمراقبة ما تم تنفيذه.
- حماية API Keys وCredentials وعدم كشفها للنموذج أو المستخدم دون حاجة.
يمكنك أيضًا زيارة
Security Center من TheCrypTechAI
للتعرف على المزيد من مفاهيم الحماية والأمان الرقمي.
لماذا تعتبر AI Agents مهمة؟
تكمن أهمية AI Agents في الانتقال من مجرد توليد النصوص إلى بناء أنظمة تستطيع استخدام الأدوات والبيانات لتنفيذ مهام متعددة الخطوات.
لكن نجاح Agent لا يعتمد على قوة نموذج اللغة فقط، بل يعتمد أيضًا على جودة الأدوات والتعليمات والبيانات والصلاحيات وآليات التحقق والأمان.
الخلاصة
تجمع AI Agents بين نماذج الذكاء الاصطناعي والأدوات والسياق لتنفيذ مهام تتجاوز الإجابة النصية البسيطة. يستطيع Agent فهم الهدف واختيار أداة مناسبة واستخدام نتيجتها لتحديد الخطوة التالية.
وبعد فهم LLMs وAPIs وStructured Outputs وRAG وAI Agents، أصبح لدينا معظم المكونات الأساسية اللازمة لبناء نظام AI متقدم ومتكامل.
What Are AI Agents?
AI Agents and Tools represent an advanced approach to building AI systems. Instead of only generating text, an AI Agent can be designed to select appropriate tools and perform steps that help achieve a specific goal.
In simple terms, an AI Agent can use a Large Language Model (LLM) to understand a user's request, determine the next step, select an available tool such as an API, search service, or database, and then use the result to continue the task.

How Do AI Agents and Tools Work Together?
The process can be simplified as:
Goal → AI Agent → Choose Tool → Execute Tool → Result → Next Step → Final Response
The process begins with a goal or request from the user. The Agent analyzes the task, determines what is needed, and chooses from the tools it is allowed to use.
After a tool is executed and returns a result, the Agent can use that information to determine the next step or generate the final response.
What Is the Difference Between an AI Agent and a Chatbot?
A simple chatbot may receive a question, send it to a language model, and display the generated answer:
Question → LLM → Answer
An AI Agent can be designed to perform additional steps and use external tools:
Goal → LLM → Tool → Result → Decision → Action
However, calling a system an Agent does not mean it can automatically do anything. Its capabilities depend on the tools, permissions, instructions, and controls provided by the application.
What Is Tool Use?
Tool Use means allowing an AI system to use specific functions or external tools instead of relying only on text generated by the language model.
These tools may include:
- Web search.
- API calls.
- Database access.
- Calculations.
- File processing.
- Sending messages or notifications.
- Running a Workflow or application function.
What Is Function Calling?
Function Calling, or tool calling, is an approach where an application defines functions or tools that a model can select when they are needed.
For example, an application could provide a function such as:
get_crypto_price(symbol)
If a user asks for the price of Bitcoin, the model can determine that this function is appropriate and provide the information required to call it.
The application then executes the actual function and returns the result to the model or passes it to another step.
Does the Language Model Execute the Tool Itself?
Not necessarily. It is important to distinguish between selecting a tool and actually executing it.
In many systems, the model identifies the appropriate tool and its required inputs, while the application or automation system performs the real action and returns the result.
The process can be represented as:
LLM Chooses Tool → Application Executes Tool → Tool Result → LLM
A Practical AI Agent Example
Imagine that a user asks:
Find the current Bitcoin price and calculate how much BTC I can get for $100.
An Agent could perform the task in several steps:
- Understand the user's goal.
- Select an API that provides the current Bitcoin price.
- Receive the current price.
- Use a calculation tool or function to convert $100 into BTC.
- Organize the result.
- Present the final answer to the user.
The system is not relying only on information stored in the language model. It uses a tool to obtain the data required to complete the task.
Key Components of an AI Agent
Agent architectures can vary, but many AI Agents and Tools systems combine components such as:
- Goal / Instructions: Defines what the system should achieve and the rules it should follow.
- LLM: Helps understand the task and select appropriate steps or tools.
- Tools: Functions, APIs, and services available to the system.
- Context: Information available while the task is being performed.
- Memory: Some systems can include memory to retain useful information across certain steps or interactions.
AI Agent or Fixed Workflow?
A traditional Workflow normally follows predefined steps:
Step A → Step B → Step C
An Agent can include some degree of dynamic decision-making, allowing it to select the next tool or step according to the goal and available results.
However, an Agent is not always the better choice. If a process is predictable and follows fixed steps, a traditional Workflow may be simpler, more predictable, and less expensive.
AI Agents and Tools become particularly useful when a task needs to handle different inputs or choose different tools and steps depending on the situation.
Combining RAG with AI Agents
An Agent can use RAG as one of its available capabilities. If it needs information from a knowledge base, it can retrieve relevant information and use that information when deciding what to do next.
This allows several concepts from this learning path to work together:
Agent → RAG / API / Tool → Data → LLM → Structured Output → Action
This architecture can be used to build more advanced AI applications that interact with external data and tools.
AI Agent Security and Permissions
As the number and power of available tools increase, permission control becomes increasingly important.
An Agent should not receive more permissions than it needs. There is a major difference between a tool that can only read information and one that can modify data, send messages, or perform transactions.
Important practices include:
- Limit the tools available to the Agent.
- Use the minimum permissions required.
- Validate inputs before performing sensitive actions.
- Require human confirmation for important actions when appropriate.
- Log actions so they can be monitored and reviewed.
- Protect API Keys and Credentials from unnecessary exposure.
You can also visit the
TheCrypTechAI Security Center
to learn more about digital security and protection concepts.
Why Are AI Agents Important?
The importance of AI Agents and Tools comes from moving beyond simple text generation toward systems that can interact with tools and data to complete multi-step tasks.
A successful Agent does not depend only on the power of the language model. Its reliability also depends on the quality of its tools, instructions, data, permissions, validation mechanisms, and security controls.
Summary
AI Agents and Tools combine AI models, tools, and context to perform tasks beyond simple text responses. An Agent can understand a goal, choose an appropriate tool, use its result, and determine the next step.
After learning about LLMs, APIs, Structured Outputs, RAG, and AI Agents, we now have most of the core components needed to understand how advanced AI systems can be built.
اختبر فهمك
Check Your Understanding
سؤالان سريعان لتثبيت أهم ما تعلمته.
Two quick questions to reinforce the key ideas.