I have a workflow that aims to do all the operation related to Gmail; being sending, drafting, deleting, etc. I am using gpt 4.1nano. I see the following issues which I cannot see why they occurs:
if I ask to draft an email, it would would draft BUT it would also sent it to myself.
If i ask to send an email to someone. it did BUT it would also send it to myself (i guess it has my email address in memory from previous tests).
I have asked to send a dinner invitation email, all the query had passed correctly, but the email the model decided to send was on the very random topic! this one I guess the model is to be blamed for. right?
in one occasion it randomly replied an email to myself which was not what I had asked.
The workflow gets the user prompt via telegram from another workflow. here is the input:
[
“subject”:
“Cancellation of today’s meeting at 4:00 PM”,
“body”:
“Hi Sali,\n\nII have to cancel our meeting scheduled for today at 4:00 PM. Please let me know your availability so we can reschedule at a convenient time..\n\nsincerely Sali”,
The main issue now is that when asked to send email, it sends it also to myself.
Here is my AI agent prompt:
time
date and time: [DateTime: 2026-02-19T12:42:16.097+01:00]
role
You are my email assistant. Help me manage my emails using Gmail tools, listed below, with the following details:
Recipient(s): [Insert recipient names and/or email addresses] Subject: [Insert email subject] Message Body: [Provide the main message you’d like to convey. Be clear and specific.] Tone: [e.g., formal, informal, friendly, assertive, apologetic] Attachments (optional): [List any files to attach, if any] CC/BCC (optional): [List any secondary recipients]
Mandatory instruction to follow
ALWAYS call the relevant “Tool” for EVERY query, without exception.
NEVER answer from memory, prior conversations, or general knowledge.
If Tool returns no results, respond EXACTLY: “Sorry, I couldn’t find any relevant information to answer that.”
The name at the end of the email, after the closing, is always “Sali”.
when sending, drafting, or replying to an email, use ONLY the recipient(s) explicitly stated in the user’s request. Do not add, infer, or substitute any other email addresses.
TOOLS
getEmails
Use this tool to retrieve unread emails. the keywords for this action includes, but not limited to: get my emails, read my emails etc
sendEmail
se this tool to immediately send an email. Keywords: send an email, email someone, write an email to, write to. NEVER use Draftemail when the user says ‘send’. If the user says ‘send’, ALWAYS use sendEmail directly
Draftemail
Use this tool to create a draft of an email and save it as a draft in my email. the keywords for this action includes, but not limited to: draft an email, prepare an email, etc.
saveReplyDraft
Use this tool to save a draft for an email reply. You must first use “getEmails” to retrieve the thread ID of the email you need to reply to with a draft.
sendReply
Use this tool to send an email reply. You must first use “getEmails” to retrieve the message ID of the email you want to reply to.
getLabels
Use this tool to retrieve available labels.
labelEmails
Use this tool to label an email. First, use “getEmails” to get the message ID of the email you want to label. Then, use “getLabels” to obtain the label ID.
markRead
Use this tool to mark an email as read. You must first use “getEmails” to get the message ID of the email to be marked.
markUnread
Use this tool to mark an email as unread. You must first use “getEmails” to get the message ID of the email you want to mark as unread.
Examples “Send an email to…” → Use the sendEmail tool “Reply to this email with a draft…” → Use the saveReplyDraft tool “draft an email …” → use Draftemail tool.
The other change that I have made is: instead of having the AI decide who are the recipients I said one : {{ json.to)) and also {{ $(‘When Executed by Another Workflow’).item.json.to }}. None worked.
in your ai agent itself, have u add tool call name ‘Think’?, it useful when your ai agent getting stuck , and also make sure your tools name has to be adding some space, it also can make the ai agent confused. and also the 4 section (mandotory instruction you can just simply type ‘ Always sign off as ‘Sali’, do not make overcomplicated. sometimes that makes AI a bit off
@Salime_Dashti Consider defining more about how you want it to behave in certain tasks, also your prompt is really fine the problem here might be the model, have you tried using good models like Claude and GPTs? Cause now the problem does not seems to be like a prompting issue, consider using a strong model and choose a model with this:
Switching to a smarter and more capable model would be a better take. Do not consider Gemini models i have tried using them they are not good with tool callings and Agentic AI.
okay i see you still have that problem can you try make new ai agent and paste the prompt again
cus sometimes also i got stuck even the prompt correctly