Skip to main content

Improve AI agent system prompts with GPT-4o feedback analysis and email delivery

Workflow preview

Workflow preview
100%
Improve AI agent system prompts with GPT-4o feedback analysis and email delivery preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

AI Agent System Prompt 'Auto Tuner' This workflow configures an AI agent which provides an edited system prompt for an autonomous AI agent Based on the following pieces of information provided by t...

Best for

  • Engineering automation workflows
  • Multimodal AI automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.formtrigger, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.gmail

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Daniel Rosehill.

Original n8n.io source

1.1 Workflow description

Title
Improve AI agent system prompts with GPT-4o feedback analysis and email delivery
Workflow name
Improve AI agent system prompts with GPT-4o feedback analysis and email delivery

AI Agent System Prompt 'Auto-Tuner'

This workflow configures an AI agent which provides an edited system prompt for an autonomous AI agent Based on the following pieces of information provided by the user in an input form:

  • Agent name
  • Agent purpose
  • What's working
  • What's not working
  • Current system prompt

There are two additional form elements that I've marked as non-required but if you want to force more detail from the user you can mark these as required:

  • Example prompt
  • Example output

This information gets sent to the AI agent which is configured with a system prompt of its own and the form elements are concatenated into a user prompt prompting the agent to evaluate the system prompt, deliver an improved version, and provide some notes for logging. The output structure is constrained with JSON. OpenAI 4o is recommended for its overall strong adherence to structured outputs.

Once the agent delivers its improved system prompt, this gets passed to the user via email notification. The final delivery stage can be alternated according to user preference

When This Is Useful

Anyone working on AI agent configurations will likely be familiar with the pivotal importance of the system prompt in directing the desired behavior of the agent.

Frequently this requires long hours of iteration before a consistent desired behaviour is achieved.

Sometimes we can figure out what's working and not based on our own intuition and experience, but at other times soliciting the outside perspective of another AI tool can be a helpful way to consider alternative explanations or improve our own prompt engineering.

This configuration is intended to speed up this iterative process and reduce the amount of time we spend working on system prompts to configure effective agent workflows

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - User inputs

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.2

Block 2 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 4 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 5 - Gmail

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

3. Summary Table

Workflow Improve AI agent system prompts with GPT-4o feedback analysis and email delivery
Complexity intermediate
Nodes 5
Categories Engineering, Multimodal AI
Author Daniel Rosehill
Published 18 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4197/4197.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Improve AI agent system prompts with GPT-4o feedback analysis and email delivery do?

AI Agent System Prompt 'Auto Tuner' This workflow configures an AI agent which provides an edited system prompt for an autonomous AI agent Based on the following pieces of information provided by t...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, Multimodal AI use case.