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.