Loading ad...

Drafting Email Replies with LLM

Zack had built something life-changing: a daily digest of his inbox. Each morning, he scanned a few clear summaries instead of drowning in dozens of emails. But there was still a problem.

After reading his digest, Zack still had to reply.

  • “Thanks, received.”
  • “Yes, I’ll confirm by Thursday.”
  • “Sure, let’s reschedule.”

Different emails, same patterns. Zack realized he was spending almost as much time writing replies as he used to spend reading emails.

“What if my assistant could also draft the replies?” he thought.

That’s what this lesson is about: moving from summaries to suggested responses, giving Zack a head start every time he clicks “Reply.”

Step 1: LLMs to suggest reply drafts

Zack already had the pieces:

  • Gmail API gave him the subject and body.
  • GPT-4o gave him a summary.

Now he wanted GPT-4o to write the actual reply.

Here’s the trick: the LLM needs context. You don’t just say, “Write a reply.” You say, “Here’s the email I received. Suggest a professional reply.”

Example:

Incoming email:

“Hi Zack, can you send me the final project plan by Friday?”

Prompt:

“Write a polite and professional reply to this email. Confirm you will share the project plan by Friday.”

Model output:

“Hi Ali, thank you for your message. I will share the final project plan with you by Friday. Best regards, Zack.”

That’s already faster than typing from scratch.

Step 2: Email style (formal, casual, bullet points)

Zack quickly discovered that not all replies should sound the same.

  • A reply to a client should be formal.
  • A reply to a colleague could be casual.
  • A reply to a team update might just need bullet points.

So he started controlling the tone in his prompts.

Formal style

Prompt:

“Write a formal reply to this email: Hi Zack, can you confirm the delivery by Monday?”

Output:

“Dear Sara, thank you for reaching out. I confirm that the delivery will be completed by Monday. Please let me know if there are any additional requirements. Sincerely, Zack.”

Casual style

Prompt:

“Write a casual reply to this email: Hey Zack, are we still on for lunch tomorrow?”

Output:

“Hey! Yep, lunch tomorrow works. See you at 1 PM.”

Bullet points

Prompt:

“Reply to this email in bullet points: Hi Zack, can you update me on project status, open tasks, and next steps?”

Output:

  • Project is on track for delivery
  • Open task: finalize vendor contract
  • Next step: internal review on Thursday

By just adding a style instruction, Zack could match the tone to the situation.

Step 3: Human-in-the-loop approval

Of course, Zack knew better than to let AI send emails directly.

“If this thing ever writes something wrong and I hit Send, I’m in trouble.”

So he set a rule: the assistant only drafts. Zack would always review and edit before sending.

This is called human-in-the-loop. The AI suggests, the human approves.

In practice, Zack’s script generated three options for each reply:

  1. A short, direct reply.
  2. A formal, polite reply.
  3. A casual or bullet-point reply.

He chose the one that fit, edited a word or two, and pressed Send.

This way, the assistant saved time but Zack stayed in control.

Step 4: Coding the reply generator

Zack created a new file called draft_replies.py.

Here’s the code:

python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from openai import OpenAI

client = OpenAI()

def generate_replies(email_text):
    prompt = f"""
    You are an email assistant. Read the email below and generate three possible replies:

    1. A short and direct reply.
    2. A polite and formal reply.
    3. A casual or bullet-point style reply.

    Email:
    {email_text}
    """
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": prompt}]
    )
    return response.choices[0].message.content.strip()

def main():
    email = """Hi Zack, could you please share the updated project timeline by next week?"""
    replies = generate_replies(email)
    print("=== Draft Replies ===")
    print(replies)

if __name__ == "__main__":
    main()

Step 5: Running the script

When Zack ran:

1
python draft_replies.py

The assistant printed:

1
2
3
4
5
6
=== Draft Replies ===
1. Sure, I’ll share the updated project timeline by next week.  
2. Dear Ali, thank you for your message. I will share the updated project timeline with you by next week. Best regards, Zack.  
3. - Timeline update will be ready  
   - Sharing by next week  
   - Let me know if anything else is needed 

Zack leaned back, smiled, and thought: “That’s three times faster than typing from scratch.”

Step 6: Practice exercise for you

Your task:

  • Copy the script above.
  • Replace the test email with:
1
Hi, can we move our meeting from Wednesday to Thursday afternoon? Please confirm.
  • Run the script.
  • Check the three draft replies. Which one fits best? Edit it slightly to make it yours.

This is the human-in-the-loop part: AI drafts, you refine.

Zack’s feedback

After using reply drafts for a week, Zack noticed:

  • His replies were faster. Instead of spending five minutes writing, he spent 30 seconds editing.
  • His tone improved. He wasn’t accidentally too blunt with clients anymore.
  • He felt less drained. Typing repetitive phrases was boring, but now the assistant handled it.

“The summaries saved me reading time,” Zack thought, “but the drafts save me writing time. That’s even better.”

Conclusion

In this lesson, Zack’s assistant grew from a reader to a responder:

  • He learned how to design prompts that generate useful replies.
  • He experimented with style: formal, casual, bullet points.
  • He built a system where AI drafts and the human approves.
  • He coded a script that generates three reply options for any email.

Now Zack’s mornings looked completely different. Instead of spending hours reading and writing, he skimmed his digest, picked a draft reply, and moved on.

Frequently Asked Questions

AI models like GPT-4o can read an incoming email and generate multiple draft replies, giving you a head start and saving typing time.

Yes. By adjusting the prompt, you can ask the AI to write in a formal, casual, or bullet-point style depending on the situation.

No. It’s best to keep a human-in-the-loop approach, review and edit AI drafts before sending to ensure accuracy and the right tone.

The script in this lesson generates three drafts: one short and direct, one polite and formal, and one casual or bullet-point style.

They save time by eliminating repetitive typing and help you respond faster while still letting you control the final message.

Still have questions?Contact our support team