Tool of AI Agent returns an Output, but Agent keeps responding that it's empty

Describe the problem/error/question

I have an AI Agent, that is connected with a subworkflow. The subworkflow is basically there to read a page via firecrawl and give the markdown back. When I take a look at the log, the subworkflow correctly gives back the output. But no matter what I do, the Agent always states, in the log that it cannot open the webpage as the return is empty. I tried several different formattings for the last node in the subworkflow - from json to now a simple “repsonse” field. All the time it’s the same. Any ideas what I am doing wrong?

I really appreciate any help, as I spend ours googling and interacting with chatgpt and could not find a solution.

What is the error message (if any)?

there are no error messages

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“operation”: “scrape”,
“url”: “={{ $json.url }}”,
“scrapeOptions”: {
“options”: {
“formats”: {
“format”: [
{}
]
},
“onlyMainContent”: false,
“headers”: {}
}
},
“requestOptions”: {}
},
“type”: “@mendable/n8n-nodes-firecrawl.firecrawl”,
“typeVersion”: 1,
“position”: [
3824,
1024
],
“id”: “e32a33f2-d45e-4ec7-9f64-46920f10d713”,
“name”: “Scrape a url and get its content”,
“credentials”: {
“firecrawlApi”: {
“id”: “Yr36VsMFsF2PSBlW”,
“name”: “Firecrawl account”
}
}
},
{
“parameters”: {
“workflowInputs”: {
“values”: [
{
“name”: “url”
}
]
}
},
“id”: “d0b2aba6-bc89-4870-a444-000b7c76b350”,
“typeVersion”: 1.1,
“name”: “Start”,
“type”: “n8n-nodes-base.executeWorkflowTrigger”,
“position”: [
3616,
1024
]
},
{
“parameters”: {
“jsCode”: “const items = $input.all();\nconst jsonData = JSON.stringify(items.map((item) => item.json));\nreturn [{ json: { response: jsonData } }];\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
4032,
1024
],
“id”: “ccadd13d-85b4-4d65-88c7-9128ae9215ba”,
“name”: “Code in JavaScript”
}
],
“connections”: {
“Scrape a url and get its content”: {
“main”: [
[
{
“node”: “Code in JavaScript”,
“type”: “main”,
“index”: 0
}
]
]
},
“Start”: {
“main”: [
[
{
“node”: “Scrape a url and get its content”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “62947b45ec9e9a4b821cfdfd63fab4d2fcf72aad424e67e589a43e62136dbaac”
}
}

Share the output returned by the last node

I attempted to load the page Immobilien in Brandenburg im Überblick - IMMOBRA GmbH. However, the content returned blank, meaning that I am unable to follow the actual HTML structure and thus the detailed links to the two objects recognised in the crawler excerpt.

Information on your n8n setup

  • n8n version: Running version [email protected]
  • Database (default: SQLite): none
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system:

somehow the subworkflow above shows only as blockcode. Sorry for that.

Here is a screenshot:

Does the Tool attached the AI Agent also show no data as the output?

Hi KhemOptimal,
thanks for digging deeper.

The tool itself shows the data: When I click on the Tool “Call ‘scrape URL and get Content’” (see workflow above), yes, it shows that it returns output.

Here you can see it on the right hand side:

But still, the Agent mode insists to say “I attempted to load the page Immobilien in Brandenburg im Überblick - IMMOBRA GmbH . However, the content returned blank, meaning that I am unable to follow the actual HTML structure and thus the detailed links to the two objects recognised in the crawler excerpt.”

I have also tried other response format for “Call ‘Scrape URL and get content’”, see below another version with response in JSON, but it doesn’t change. Is there any specific format the AI Agent expects? I have seen in some older templates, that there is an option for “response ai”, but it seems in the new version of the AI Agent node, this option does not exist anymore.

This is how it looks like in the log of the Agent:

That is frustrating indeed. I have worked on something similar and have not had any troubles. I looked at your JS code node and everything. I even tried your exact JS code– it’s fine, should work.

You may need to kick the agent around a bit. You should try to add some guardrails. In the system prompt, can you add these to the end. Try this and see if it changes anything. You’re using gpt-5.1 model right now, you should also try the gpt-4o-mini model. The hope is to see a different behavior— good or bad.

###YOUR TOOLS

You have access to a Web Scraper Tool that fetches and returns HTML content from any URL you provide. When you call this tool with a URL, it will return the scraped HTML content as text in the response. You should then analyze this returned content to extract the property information.

### EXECUTION PLAN

Start with a brief checklist (3-7 items) of the necessary sub-steps before beginning the actual execution.

Proceed as follows:

1. **Initial Analysis:** First, analyze the HTML content already provided in the user prompt (from the initial crawler).

2. **Navigate if Needed:** If you are NOT on a specific property listing page:

- Identify which URL to visit next to reach the specific listing page

- Call the Web Scraper Tool with this new URL

- The tool will return the HTML content in its response

- Analyze the returned HTML content to extract property details

- Continue this process until you find the correct listing page (limit: 5 iterations)

3. **Data Extraction:**

IMPORTANT: When you call the Web Scraper Tool, it returns the scraped HTML content in the response. Look for this content in the tool’s output and analyze it. The tool does NOT return empty results - if you see empty output, check the tool response carefully.

After each action, verify in 1-2 sentences whether the desired information was successfully found.

My result: works just fine (gpt-40-mini) & using your JS code node.