Build an AI Agent for Automated Financial Market Summaries

What is an AI agent?

An AI agent is a software program that can achieve a specific goal without constant human instructions. How are agents capable of acting on their own? They are programmed in a way to observe their environment, make decisions, and take action based on what they perceive.

Think of an AI agent as a smart helper that can understand what it needs to do, plan how to do it, gather information, and then carry out tasks step-by-step until the goal is reached.

Example: AI Agent For Booking a Restaurant Reservation

Here’s a clear, step-by-step example of what an AI agent does when asked to book a restaurant reservation:

  1. Goal Initialization: The agent receives the goal: "Book a table for two at an Italian restaurant tonight."
  2. Create a Task List: It breaks down the goal into smaller tasks. Find Italian restaurants nearby, check availability for tonight, select a restaurant with an open table, and make the reservation.
  3. Gather Information: The agent searches online for Italian restaurants, checks their booking systems, or calls them via APIs to find available slots.
  4. Implement Tasks: It picks a restaurant with availability and completes the booking by submitting the reservation.
  5. Feedback and Iteration: The agent confirms the reservation and informs the user. If the booking fails, it tries another restaurant or time slot until successful.
  6. Learning: Over time, it remembers user preferences (like favorite restaurants or times) to improve future bookings.

Summary of How AI Agents Work

  • Sense: Collect data from the environment (e.g., restaurant availability).
  • Plan: Decide what steps to take to reach the goal.
  • Act: Perform tasks autonomously (e.g., make the reservation).
  • Learn: Adapt based on feedback to improve future performance

What is n8n

n8n is an open-source, low-code workflow automation platform that enables users to connect various applications, services, and data sources to build complex automated workflows with minimal coding. Its core functionality revolves around creating workflows by linking nodes, where each node represents a specific action or trigger—such as reading data, sending notifications, or calling APIs. These workflows can be triggered by events, run on schedules, or executed manually, allowing for flexible automation scenarios.

Use Cases and Applications

n8n is versatile and applicable across many industries and functions, including: Business Process Automation: Customer onboarding, document management, and multi-step workflows. Data Processing: ETL operations, real-time analytics, and intelligent data extraction. Marketing Automation: Multi-channel campaigns with automated follow-ups and notifications. IT and DevOps: System monitoring, incident management, and deployment automation. AI-Powered Tasks: Chatbot creation and intelligent automation leveraging AI services.

Before continuing, make sure you have an instance on the n8n cloud or self-host your n8n instance.

Hands-on Practice: AI Agent to Analyze financial news

Let's build an AI agent that analyzes key news and market data to deliver accurate insights and summaries, helping investors and financial professionals make informed decisions. This agent senses the financial environment, plans on summarizing and finding highly important market data, and acts by sending its summarization to the user and including a feedback link in the email where users can provide feedback so we can improve the agent in the future.

ComponentDescription
SenseGather and interpret financial news and market data
PlanIdentify important news and assess their market impact to decide what to summarize/send.
ActGenerate summaries and send them via email.
LearnImprove by incorporating user feedback link in the email, monitoring outcomes, and updating models/rules.

Step 1: Setting Up the Workflow Start 

Let's add a Scheduled trigger that runs every 15 minutes, which calls an API to get the current time using the timezone, and processes the hour and minutes if it's between 6:00, 7:00, 8:00, should run every hour, and if it's between 9:00 to 17:00 It runs every 15 minutes.

Schedule Trigger

HTTP Call

GET request to https://cubite.io/api/what-time-is-it?timezone=America/New_York

Process Time

Add a new Code node and add the following code to it to run once for all input

IF Condition

Let's add a new if condition that if the code success in the response is true It continues, and if it's false, it doesn't do anything

Step 2: Integrate with Perplexity

We are going to use Perplexity to get the latest news that can impact the market. Let's add a Perplexity node using the Sonar model and the following prompt

Next, let's add a code node with the following code to sanitize the model output

Step 3: Overall Summary and Scoring 

The next step is to use the GPT model to score each news article on a scale -10 to 10 depending on its positive or negative impact. We also summarize all of the news and provide actionable items and a score. Add an OpenAI message model using gpt-4o-mini with the following prompt

Now let's sanitize the data by adding two code nodes

First one with the following content

The second one with the following content

Step 4: Save Data in a Google Sheets

Create a new Google Sheet with two pages, one called Details, with headers Title,Summary,Impact,Weight,Impacted Assets, Reason and the next is summary page with a header as Action,Reason,Assets,Total Score

Connect each Code to Sheets element

The first one is as follows

Next integration to fill the Summary sheet

Step 5: Chat Trigger 

Let's add a new starter node using Chat Trigger which receives the user's message and passes it to the AI Agent. The user's message will be the AI agent's goal. Let's change the initial message to

Step 5: AI Agent

Let's connect a new AI agent node to the Chat trigger by connecting Gmail and Google Sheets as tools to it

 

Let's use OpenAI GPT-4o-mini as the Chat model. The Chat model takes care of understanding the user's input message and picking the right tool for taking action.

We provide the Google Sheet tool as the data source when users ask for something, and using the Gmail Tool to send the summary to the user if they asked for it.

What We Built So Far

Conclusion

In summary, AI agents represent a significant leap forward in automation technology, capable of independently perceiving their environment, planning actions, executing tasks, and learning from feedback to continuously improve. Platforms like n8n empower users to build intelligent workflows with minimal coding, bridging the gap between raw AI capabilities and practical business applications. By integrating AI agents into processes such as financial news analysis and market insight generation, organizations can unlock faster, more accurate decision-making while freeing human resources for strategic work. As AI agents evolve, their ability to autonomously manage increasingly complex tasks will continue to transform industries, driving efficiency, innovation, and smarter automation across the board.

This conclusion ties together the key points of your article and highlights the importance and future impact of AI agents and workflow automation tools.

Related Blogs

Looking to learn more about n8n, ai agent and Build your first AI agent with n8n? These related blog articles explore complementary topics, techniques, and strategies that can help you master How to Build an AI Agent for Automated Financial Market Summaries Using n8n.

Build an AI Agent for Airbnb Hosting with n8n

Learn how to create a powerful AI agent for Airbnb hosts using Telegram and n8n. Automate guest messaging, manage bookings, and streamline operations with AI-driven workflows—no coding required. Boost efficiency and guest satisfaction today!