Skip to main content

Create AI agents using n8n

In this article, we'll separate truth from fiction to show you where and how AI agents will fit into the future of trading
n8n AI agent workflow
n8n AI agent workflow

Introduction

In this article, we’ll go over how to build an AI agent using n8n and Bright Data. n8n offers us a powerful platform to build no-code workflows and integrate them with AI systems. There’s a large variety of tools for n8n workflows

By the time you’re finished with this tutorial, you’ll be able to do the following tasks.

  • Install a local instance of n8n.
  • Create basic workflow nodes using n8n.
  • Integrate n8n with an AI agent based on a model of your choosing.
  • Add simple memory to your AI agent.
  • Plug Bright Data’s tools into your AI model.
  • Pipe model output using an output parser.
  • Save your AI agent’s report to a JSON file.

Getting started with n8n

Install n8n with npm

npm install n8n -g

Start n8n

n8n

Open the n8n webapp in your browser by pressing “o” when prompted. After the basic setup prompts, go to your settings and select “Community nodes.” We’ll need a community node for the Bright Data tool.

Select "Community nodes" from the settings tab
Select “Community nodes” from the settings tab

Then, enter n8n-nodes-brightdata.

Adding the Bright Data package
Adding the Bright Data package

Building the workflow

Like all projects, we begin with an empty slate. Click on “Add first step” to begin adding nodes.

Empty n8n workflow
Empty n8n workflow

1. Starting our workflow

We want a workflow that begins when a user prompts the AI agent. Select the “On chat message” node to begin.

Begin the workflow using the "On chat message" node
Begin the workflow using the “On chat message” node

2. Adding the AI agent

Now, add an AI agent node to the workflow. The AI agent node is often located near the top of the options but you might need to type it into the search bar.

n8n AI agent node
n8n AI agent node

3. Configure the model

Next, we’ll configure the agent to work with OpenAI. Under “Chat Model”, select “OpenAI Chat Model.” This sets up connectors for an OpenAI model to operate as our agent. You can use any of their other model options, just make sure you’ve got access to the model you choose.

You’ll need to open up the model settings and add your OpenAI API key. If you chose another platform, you’d enter your API key for their services. The process here is largely the same.

If everything’s connected properly, you’ll see a popup that says the connection was tested successfully.

OpenAI connection tested successfuly
OpenAI connection tested successfuly

You can choose any model you like. That said, model performance does vary. We chose to use GPT-5 but this isn’t a requirement. It’s easy to begin with a high tier model and slowly scale down as you get a better picture of your requirements.

Selecting a model
Selecting a model

You can test the model and it should produce output. If you enter “hello” as a chat message, you should receive a response.

The model responds to our message!
The model responds to our message!

4. Adding memory

We need a memory system for our AI agent. Without memory, it’s easy for models to get lost or max out during operation. Click the button to add memory and choose “Simple memory.”

Adding simple memory to our AI agent
Adding simple memory to our AI agent

5. Adding tools

Now, we’ll add the Bright Data tool. Click “Tool” and search for Bright Data. Using this tool, you gain access to any and all of the tools you have with Bright Data. In this case, we’re using the Unlocker API which allows us to solve CAPTCHAs and view most web pages.

Adding the Bright Data tool
Adding the Bright Data tool

Add your Bright Data credentials to the node. There’s not much to add, just your Bright Data API key. When you’re finished, click “Save.”

Bright Data credentials tab
Bright Data credentials tab

In the tool parameters, set the URL to be defined by the model. Unless you give the model explicit permission, all URLs need to be predefined.

Let the AI agent define the URL
Let the AI agent define the URL

Now, we’ll add another tool called a “Structured Output Parser.” Type it into the search bar and here’s how we’ll set it up.

Structured output schema.
Structured output schema.

You can copy and paste the snippet below into the schema. It’s a simple JSON schema that allows for a list of stories. With this simple schema, our AI agent now knows that we want a list of headlines and that each one should also contain a link to the story.

 {
    "stories": [
	{"headline": "https://www.npr.org/2025/10/14/nx-s1-5574469/cdc-shutdown-federal-layoffs",
	"link": "https://www.npr.org/2025/10/14/nx-s1-5574469/cdc-shutdown-federal-layoffs"}]
  }

6. Saving our output to a file

Finally, enter “Convert to File” into the search bar. This is our final node. The agent will output a JSON file for us to review. You can view the parameters below.

Output file parameters
Output file parameters

When you look at your output, you can either view or download the file. If you choose to view the file from n8n, you can inspect the individual stories without ever leaving your development environment.

Output data from the JSON file
Output data from the JSON file

Conclusion

You just built a fully functional AI agent without a single line of code. Tell it which news site you want to scrape. Then, it scrapes that site using the Bright Data tool. The model then parses the page into structured JSON output. Finally, our results get saved to a JSON file.

With n8n, you get an end to end development platform. You’ve got the foundation. You can take it to the next level by using one of their cloud storage nodes to integrate n8n workflows straight into your data pipeline.

Whether you’re a seasoned developer, a hobbyist or just a project manager who needs help, n8n workflows can help you turn your idea into something tangible — quickly.