We built an AI agent within n8n designed to provide investment advice, showcasing the platform’s capabilities for agentic AI. This process involved configuring the agent to perform technical and fundamental stock analysis by integrating 5 distinct tools and pulling financial data from various APIs.
See our agent in action in the video below:
Please note that the video has been sped up 4x.
You can read more about the architecture.
Introduction to n8n and AI automation
n8n is an open-source workflow automation tool that enables users to visually connect APIs and services, simplifying complex integrations. In 2025, n8n stands out for its AI capabilities, allowing the creation of intelligent agents for tasks like financial analysis. Its user-friendly interface, 400+ integrations, and active community make it accessible for both beginners and experts.
The n8n community contributes templates and workflows, including those tailored for finance, which users can adapt to quickly start their projects. Resources like tutorials, documentation, and forums provide valuable support for learning and troubleshooting.
Creating your n8n instance
To start using n8n, you first need an active instance. You have the flexibility to choose between setting it up yourself (self-hosting) or using the managed n8n Cloud service. For those opting for self-hosting, detailed setup instructions are available in the official installation guide found within n8n’s documentation. If you’re new or prefer a managed solution, n8n Cloud offers a convenient way to begin, often including a free trial period for evaluation.
You can read more about self-hosting LLMs that can be used with a local instance of n8n.
Managing credentials securely in n8n
When your workflows need to connect to external services like APIs or databases for RAG, etc., handling sensitive information like API keys or passwords securely is paramount. n8n provides a built-in credentials management system specifically for this purpose. Instead of embedding secrets directly in your workflows, you should securely store these credentials within this system, ensuring your sensitive data remains protected and isn’t accidentally exposed.
Financial Agent Architecture
- Trigger (When chat message received): The process kicks off when a user sends a message. This is the entry point for any interaction.

- The Core (AIMultiple Agent – Tools Agent): This is the central processing unit. It’s configured as a “Tools Agent,” meaning its primary function is to understand the user’s request and intelligently select and use the appropriate tools to fulfill it. It takes several key inputs:

- Chat Model (OpenRouter Chat Model): This is the Large Language Model (LLM) that provides the agent’s conversational abilities and reasoning power. OpenRouter likely offers flexibility in choosing specific underlying models known for strong analytical or conversational skills.

You can read more about AI gateways like OpenRouter and LLM pricing to choose the best model for your case.
- Memory (Window Buffer Memory): Essential for conversation! This component allows the agent to remember recent parts of the discussion, maintaining context and enabling follow-up questions. A “Window Buffer” typically keeps the last ‘N’ interactions.

- Tools (Tools Box): This is the agent’s analytical arsenal. The prompt explicitly defines the tools and their purpose, and the diagram shows them feeding into the agent:

- GetChart: Generates technical analysis stock charts and provides a URL. Essential for visualizing price action, trends, support, and resistance.
- SerpAPI: Accesses search engine results to gather recent news, sentiment, and fundamental context surrounding a stock.
- GetFinancialStatementGrowth: Analyzes trends in key financial metrics (revenue, income, cash flow growth) from income statements, balance sheets, and cash flow statements.
- GetRevenueProductSegmentation: Breaks down a company’s revenue by its different product lines or business segments. Vital for understanding where the money comes from.
- GetRevenueGeographicSegment: Shows revenue distribution across different geographic regions, highlighting market strengths and dependencies.
You can see more real-world applications and use cases for agentic AI.
Disclaimer
The AI agent we built and demonstrated in the accompanying video was created solely as a technical proof-of-concept to showcase the capabilities of the n8n framework for building agentic AI workflows. Its purpose is educational and illustrative, demonstrating how various tools and APIs can be integrated within n8n to simulate complex tasks like financial analysis. This agent is NOT intended to provide actual investment advice.
Conclusion
We show n8n’s suitability for building multi-component AI agents by configuring a workflow with a trigger, a core Tools Agent, an LLM (OpenRouter), memory, and specialized tools (GetChart, SerpAPI, financial data retrieval). This created an agent simulating investment analysis tasks.
Our goal was met: showing how n8n’s visual system integrates diverse APIs and AI models for agentic processes. While applied to finance, the purpose was exploring n8n’s capability for these automated workflows, indicating its potential beyond basic tasks towards reasoning, tool-using systems. As emphasized, this remains a technical demonstration, not a functional financial tool.
FAQ about n8n
What is n8n, and what are its main capabilities and benefits?
n8n is a powerful, open-source workflow automation tool designed to visually connect diverse APIs and services, simplifying integration tasks. Its user-friendly interface allows you to build a wide range of automations, from basic data processing to complex AI-powered chat agents and automated decision systems. Key benefits include its visual workflow builder, flexibility due to its open-source nature (enabling customization and scalability), and strong support from an active community.
How do I typically build a workflow in n8n?
Building a workflow starts by clicking “Create a new workflow” in your n8n instance. Workflows are constructed using functional blocks called “nodes” on a visual canvas. You begin with a “trigger node” (which starts the workflow based on an event, schedule, or manual execution) and then connect subsequent nodes to perform actions, process data, or interact with various services. n8n provides numerous pre-built connector nodes for popular services, simplifying integration, and you can always add more nodes to increase complexity as needed.
What techniques and features does n8n offer for creating more advanced or robust workflows?
For more complex scenarios, n8n allows you to link multiple workflows together, enabling sophisticated task orchestration. You can enhance robustness using built-in error handling mechanisms and debugging tools to manage potential failures gracefully. n8n’s logging features are essential for monitoring executions and diagnosing issues. Mastering conditional logic (like IF nodes) and understanding data flow between nodes are key to building advanced, efficient automations. The official documentation and community forums are excellent resources for learning these techniques.
Does n8n support custom coding or integration with external systems for expert users?
Yes, for advanced customization, n8n allows users to write custom JavaScript within specific nodes (like Function and Function Item) to implement bespoke logic. Furthermore, n8n provides its own API, enabling programmatic interaction. This means external applications, services, or custom scripts can trigger workflows, retrieve data, or manage n8n instances, facilitating deep integration into larger systems and custom application development.
How does n8n facilitate building workflows that incorporate AI, specifically using different LLMs or AI agents?
n8n is well-suited for building workflows (workflow) involving AI capabilities. You can integrate various AI agents and different LLMs (Large Language Models) using specific nodes. Often, this involves using generic HTTP Request nodes to connect to the API of an AI service, or using dedicated community or core nodes designed for specific platforms (like OpenAI, Hugging Face, etc.). You configure the node with your credentials and the necessary parameters (like the prompt and chosen model). This allows you to incorporate AI for tasks like content generation, data analysis, or decision-making directly within your automation process, creating sophisticated agents that can solve problems.
When connecting nodes to external services, how should I handle credentials and configuration securely?
Securely managing credentials is crucial when you connect a node to an external service (like an API or database). n8n has a built-in credentials management system. Instead of pasting sensitive information directly into a node’s parameters, you typically add or configure credentials once within your n8n instance. You select the type of service, provide the required details (API keys, tokens, username/password), and save it. Then, within the specific node in your workflow, you simply select the stored credential from a dropdown list. This process ensures your sensitive data isn’t exposed directly in the workflow structure and only needs to be set up once per service for that n8n instance.
Comments
Your email address will not be published. All fields are required.