How can I generate and invoke a function in the workflow?

I would like to know if I can create functions to invoke different processes, such as sending emails, creating documents, etc.

Information on your n8n setup

n8n version:** 1.81.0
Database (default: SQLite):** superbase (postgres)
n8n EXECUTIONS_PROCESS setting (default: own, main):** own
Running n8n via (Docker, npm, n8n cloud, desktop app):** n8n cloud
Operating system:**

In your case, I recommend handling action creation outside of the agent.

Keep in mind that agents use tools primarily to supplement information based on what you specify at the prompt, so they are not always ideal for executing actions directly.

A good strategy is to structure the agent’s response in a JSON format that you can interpret and process in n8n. For example:

{
  "enviar_correo": true,
  "subject": "Título del correo",
  "to": "[email protected]",
  "content": "Contenido del correo"
}

Then, in your workflow, you can evaluate whether “send_mail” is true and, if so, call the send_mail node using the data generated by the agent.

This way, the agent is just providing structured information, and n8n is in charge of executing the actual action. This gives you more control and flexibility over the process.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.