Demo: Email Handling
What you'll see
An email arrives in your inbox. AI Partner:
- Reads the email and classifies its intent (needs reply, FYI, action required, spam)
- Drafts a reply in your writing style (informed by
USER.mdand past email tone) - Sends you the draft via Telegram with a preview and one-tap approval buttons
- Sends the approved reply — or edits it based on your correction
- Logs the entire interaction to the counterparty's record for future context
Prerequisites
Required:
- Gmail configured (see Integrations guide → Gmail)
- Telegram bot configured (see Human Proxy guide)
AUTHORITY.mdwithreply_emailrules
For best results:
USER.mdfilled in with your name and communication styleSOUL.mdwith your tone preferences
Setup
1. Connect Gmail
Add to .env:
GMAIL_USER=your@gmail.com
GMAIL_APP_PASSWORD=xxxx-xxxx-xxxx-xxxx # Gmail App Password (not your login password)
Or go to Settings → Integrations → Gmail and enter the credentials there.
Gmail App Passwords are 16-character codes generated in your Google Account under Security → 2-Step Verification → App passwords. They're separate from your login password and can be revoked independently.
2. Connect Telegram
Go to Settings → Messaging → Telegram:
- Create a bot via @BotFather —
/newbot→ get your bot token - Get your chat ID: send
/startto your bot, then checkhttps://api.telegram.org/bot<token>/getUpdates - Enter both in the Telegram settings
3. Set your authority policy
In AUTHORITY.md, add rules for email:
## Draft + ask
- action: reply_email + counterparty: colleague
- action: reply_email + counterparty: client
- action: reply_email + counterparty: vendor
## Block
- action: reply_email + counterparty: unknown
The demo
Trigger it manually
If you want to test without waiting for a real email, ask AI Partner directly:
Check my Gmail inbox and reply to the most recent unread email that needs a response.
Draft a reply in my voice and send it to me via Telegram for approval before sending.
Or let it run automatically
With the email trigger configured, AI Partner monitors your inbox automatically. When a new email arrives:
EmailTriggerServicedetects the message via Gmail push notifications- Classifies the intent: "client asking for project status update"
- Checks
AUTHORITY.md:reply_email + counterparty: client→ verdict:draft_and_ask - Drafts a reply using your past emails as style reference
- Sends to Telegram
What you see in Telegram
📧 New email — needs your review
From: sarah@acme.com (Sarah Johnson, Acme Inc. — Client)
Subject: Q2 Project Status Update Request
Received: 2026-05-13 09:47 AM
Their message:
> Hi Alex,
> Hope you're doing well. Could you give us a quick update on where
> things stand with the Q2 deliverables? We have a board meeting on
> Friday and I'd like to include something.
> Thanks, Sarah
My draft reply:
---
Hi Sarah,
Great to hear from you. Here's where we stand heading into the board meeting:
• Phase 1 (API integration) — ✅ Complete
• Phase 2 (Dashboard) — 🔄 85% complete, on track for May 20
• Phase 3 (Reporting) — Starts May 21, on track for June 15
We're on schedule for the full Q2 deliverable. Happy to jump on a call
if you'd like to walk through any of it before Friday.
Best,
Alex
---
[✅ Approve & Send] [✏️ Edit first] [⏭ Skip for now]
Approving
Tap ✅ Approve & Send — the email sends immediately. You get a confirmation:
✅ Sent to sarah@acme.com — 09:52 AM
Editing
Tap ✏️ Edit first — then reply to the Telegram message with your corrected text. AI Partner sends the corrected version:
You → Telegram: "Change 'Phase 3 (Reporting) — Starts May 21' to 'Phase 3 (Reporting) —
Already started, on track for June 15'"
AI Partner: ✅ Updated and sent.
Skipping
Tap ⏭ Skip for now — the email stays in your inbox unread, marked as deferred. The agent moves on.
Reply style
The reply draft is personalized using:
| Input | How it's used |
|---|---|
USER.md | Your name, role, company, communication style |
SOUL.md | Tone rules (formal vs. casual, frameworks preference) |
| Counterparty record | Sarah's relationship class, tone notes, past interactions |
| Past emails | Your previous emails to this person, analyzed for style matching |
The agent doesn't use a canned template. It reads your actual sent emails and matches your phrasing patterns.
What's logged
Every email interaction is logged to:
email_threadsandemail_messagestables (full persistence)counterpartyrecord for Sarah: last contact date updated, reply sentiment notedauthority_decisionstable: the verdict and your response (approved / edited / skipped)
This means the next time Sarah emails you, the agent knows the last conversation, your previous reply tone, and any open commitments from prior threads.
Variations to try
Summarize my last 20 unread emails.
Group by: needs-reply, FYI, action-required.
Send the summary to my Telegram.
Send an email to mike@vendor.com following up on
the proposal they sent last week. Be polite but clear
that we need a decision by Friday.
(Gated by AUTHORITY.md — you'll see a Telegram approval request first)
Search my Gmail for emails from investors in the last 30 days.
Extract: sender, subject, key ask, and my reply status.
Create an Excel file with this data.
Draft a reply to Sarah's last email about Q2 status.
Don't send it — just show me the draft.