Read your Gmail inbox, prioritise what needs a reply, and send professional follow-up emails automatically. OE Runtime connects to Gmail via the REST API using OAuth — no SMTP configuration, no app passwords, and no SDK required.
Create a file called agent.yaml inside an email/ directory:
name: Email Assistant description: Summarize inbox and send a follow-up email instructions: | You are an email assistant. Read the inbox and send emails via the Gmail REST API. Draft professional, concise messages. Never send without confirming recipient and subject. Complete all steps fully before writing your report. steps: - name: Read Inbox content: | Call the Gmail connector: GET /messages with params: { "labelIds": "UNREAD", "maxResults": "10" } Then for each message id returned, call: GET /messages/<id> with params: { "format": "metadata", "metadataHeaders": "From,Subject,Date" } Collect sender, subject, date, and snippet for each email. - name: Draft and Send Reply content: | From the unread emails, identify the one that most urgently needs a reply. Draft a professional acknowledgement reply. Then send it by calling: POST /messages/send with body: { "raw": "<base64url-encoded RFC 2822 message>" } Construct the raw field as: base64url("From: me\r\nTo: <sender>\r\nSubject: Re: <subject>\r\n\r\n<body>") - name: Report content: | Summarize what was done: - Number of unread emails found - Brief summary of each email (sender, subject, urgency level) - Which email was replied to and why - Confirm the reply was sent successfully connectors: - connection_name: My Email connection_type: gmail-rest
Create oe-config.json in the same directory:
{
"llm": {
"provider": "openai",
"model": "gpt-4o",
"apiKey": "YOUR_OPENAI_API_KEY"
},
"server": {
"enabled": false,
"port": 3333,
"apiKey": "your-secret-api-key"
},
"connectors": [
{
"connection_name": "My Email",
"connection_type": "gmail-rest",
"bearerToken": "YOUR_GOOGLE_ACCESS_TOKEN",
"baseUrl": "https://gmail.googleapis.com/gmail/v1/users/me"
}
]
}Get your bearerToken from the Google OAuth Playground: select the scope https://www.googleapis.com/auth/gmail.modify, authorize with your Google account, exchange the code for tokens, and copy the Access Token. Tokens expire after 1 hour — for long-running use, generate a refresh token and exchange it for a new access token as needed.
oe-runtime-win.exe email/agent.yaml --config email/oe-config.json
chmod +x oe-runtime-macos
oe-runtime-macos email/agent.yaml --config email/oe-config.json
chmod +x oe-runtime-linux
oe-runtime-linux email/agent.yaml --config email/oe-config.json
macOS Gatekeeper: On first run, macOS may block the binary. Go to System Settings → Privacy & Security → click "Allow Anyway" next to oe-runtime-macos.
Add --serve to start OE Runtime as an HTTP server on port 3333:
oe-runtime-win.exe --serve --config email/oe-config.json
Then send a request:
curl -X POST http://localhost:3333/run \
-H "Content-Type: application/json" \
-d '{"yaml": "email/agent.yaml", "params": {}}'Or import the Postman collection (download above) to test all endpoints visually.
Download OE Runtime and run any AI agent locally or as a server — no cloud required.
Get OE Runtime →