Better AI Agent
Advanced AI Agent with improved memory management and modern AI SDK (OpenAI Message Format)
Overview
The Better AI Agent node is an advanced AI agent designed for use within n8n workflows. It integrates with connected AI language models, memory, tools, and utility models to generate intelligent responses based on user prompts. The node supports dynamic prompt input from connected chat trigger nodes or manual definition, manages conversation history with memory, and can call external tools to assist in generating responses. It also supports intermediate webhook callbacks for partial results and detailed verbose logging for debugging. This node is beneficial for scenarios requiring complex AI interactions with memory and tool usage, such as chatbots, virtual assistants, or automated task agents.
Use Case Examples
- A chatbot that remembers previous conversation context and uses external APIs/tools to provide enriched answers.
- An AI assistant that processes user queries, calls specialized tools for data retrieval, and returns comprehensive responses.
- An automated workflow step that uses AI to analyze input data, consults memory for context, and generates actionable insights.
Properties
| Name | Meaning |
|---|---|
| Tip: This node uses modern AI SDK with proper tool call memory management | Informational notice about the node's use of modern AI SDK and memory management. |
| Source for Prompt (User Message) | Determines the source of the user prompt, either from a connected chat trigger node or manually defined text. |
| Prompt (User Message) | The user message or prompt to send to the AI model. Its source depends on the 'Source for Prompt' setting. |
| Options | Collection of optional settings to customize the agent's behavior. |
Output
JSON
output- The final text output generated by the AI agent.steps- Array of steps representing tool calls and intermediate actions taken by the agent.totalSteps- Total number of steps executed during the agent's run.
Dependencies
- Requires connection to at least one AI language model node.
- Optionally connects to AI memory nodes for conversation history management.
- Optionally connects to AI tool nodes to enable tool usage during response generation.
- Optionally connects to a utility AI model for final response refinement.
Troubleshooting
- Error 'No language model connected' occurs if no AI language model node is connected; ensure a supported model node is linked.
- Failures in loading or saving conversation memory may cause loss of context; check memory node configuration and connectivity.
- Intermediate webhook POST failures are logged as warnings and do not stop execution; verify the webhook URL and network connectivity.
- AI model generation failures throw errors with messages; check API keys, model availability, and input prompt validity.
- Verbose logging can be enabled to diagnose issues with tool calls and model responses.