Agent tool (AI)
Runs a language model (LLM) with a configurable prompt. The agent receives the flow context (variables), reasons, and generates a text response. Can access your Knowledge Base or chain other tools.
When to use it
When you need the bot to understand natural language, generate intelligent responses, classify intent, or process complex text.
Steps
- 1Create a tool → choose type «Agent».
- 2Select the model (OpenAI GPT-4o, Claude, etc.) via the connector configured with your API key.
- 3Write the system prompt. Define the agent's role, tone, and restrictions.
- 4In the user prompt, use {{...}} to inject the user's message and other flow variables.
- 5Set max_tokens to control cost and avoid excessively long responses (recommended: ≤1024 for Telegram/WhatsApp).
- 6Optionally, enable Knowledge Base access so the agent can query your files.
- 7Save and test with a sample message.
Reference
- System prompt
- Permanent instructions for the model. Defines who the agent is, what language it replies in, and what it can and can't do.
- User prompt
- Message the agent receives as input. Typically: «The user said: {{user_message}}»
- max_tokens
- Token limit for the response. 1 token ≈ 0.75 words. For WhatsApp/Telegram we recommend ≤1024.
- Temperature
- Controls model creativity. 0 = deterministic. 1 = creative. For customer support: 0.3–0.5.
- Connector
- AI provider API key (OpenAI, Anthropic, etc.). Stored securely as a connector.
- Knowledge Base
- If enabled, the agent semantically searches your PDF/txt files before responding.
Common errors
- Response cut in the middle
- The model hit the max_tokens limit. Increase it or adjust the prompt for shorter responses.
- «Invalid API key»
- The connector's API key is wrong or was revoked. Update the connector with a valid key.
- Agent repeats the response 4 times
- The agent's memory Window Buffer saved a duplicate response and re-injects it. Disconnect the Window Buffer and use KV Store for session state.
- Response too long for Telegram
- Telegram rejects messages >4096 chars. Add to the system prompt: «Maximum 3500 characters. Maximum 5 items in lists.»
Next step
Learn Tool Code for fully custom logic.