पाठ 15 / 25

AI Agent Node

Chat model, memory और tools से agent जोड़ें और सीमित करें कि वह कितना चल सकता है।

तीन plug-ins वाला node

AI Agent node आपके लिए tool-calling loop चलाता है। Chat model (आवश्यक), वैकल्पिक memory ताकि chat अपना इतिहास रखे, और एक या अधिक tools जोड़ें जिन्हें वह बुला सके। भूमिका, tools और नियम बताने वाला स्पष्ट system message लिखें। अधिकतम iterations तय करें ताकि भ्रमित agent हमेशा loop में न रहे।

Agent के लिए system message

बताएँ कि कब कौन-सा tool उपयोग करना है, क्या अस्वीकार करना है, और कैसे उत्तर देना है। छोटा और विशिष्ट, लंबे और अस्पष्ट से बेहतर है।

You are a support assistant for Acme.
- To check an order, call get_order with the order number.
- To answer policy questions, call search_policy first and quote it.
- Never issue refunds yourself; create a refund request with request_refund.
- If you cannot find the answer, say so and offer to contact a human.
- Reply in the customer's language, in under 120 words.

Iterations सीमित करें

सरल agents के लिए अधिकतम iterations कम रखें (जैसे 5 से 10)। हर iteration एक और model call है, इसलिए असीमित loops सीधे पैसा और समय ख़र्च कराते हैं।

त्वरित जाँच: AI Agent चलाने के लिए कौन-सा sub-node आवश्यक है?

  • Chat model
  • Vector store
  • Slack node
  • Wait node
Answer

Chat model — Model तर्क देता है; memory और tools वैकल्पिक अतिरिक्त हैं।