Add customer support email agent using Commune#9
Open
yishangupenn wants to merge 3 commits intomainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this notebook covers
This notebook shows how to build a customer support email agent using the OpenAI Python SDK with GPT-4o function calling and Commune — a programmable email and SMS API built for AI agents.
The notebook lives in
examples/agents_sdk/because it demonstrates a complete, production-oriented agentic workflow: multiple tools, multi-turn reasoning, error handling, and a polling loop suitable for deployment.Use case
A SaaS company points a Commune inbox at their support address. The agent reads new tickets, classifies them (billing / technical / feature-request), drafts empathetic replies, sends them via the Commune API, and SMS-escalates P0 issues to an on-call phone number — all without human intervention.
What readers learn
{"type": "function", ...}formatfinish_reason == "tool_calls", executing eachtool_call, and returning{"role": "tool", ...}messagesWhy it's valuable
Support inbox automation is one of the highest-ROI use cases for function-calling agents but is underrepresented in the cookbook relative to its real-world prevalence. This recipe gives developers a complete, working starting point that handles the email infrastructure (via Commune) so the focus stays on the agent logic.
Technical details
openaiPython SDK directly — no LangChain, no frameworkcommune-mailPython package (pip install commune-mail)gpt-4o(also compatible withgpt-4o-minifor cost-sensitive deployments)commune_client.sms.send()