Comgent — Your Personal Communication Agent

Inspiration

We are surrounded by messages, but staying informed has increasingly become a problem of attention rather than access. Important emails can arrive while we are working, traveling, or away from our computers, and critical information can easily get buried among newsletters, promotions, notifications, and routine conversations.

This inspired us to build Comgent, a personal communication agent that watches over a user's communications and brings important information to their attention instead of requiring them to constantly check their inbox.

We wanted to move beyond the traditional "AI email summarizer." Comgent is designed to observe, reason, decide, and act. It monitors connected Gmail accounts, determines which messages actually deserve attention, explains why they matter, and reaches the user through channels they already use, starting with WhatsApp and SMS.

The idea is simple: people shouldn't have to constantly monitor their communications to find what matters. Their agent should do it for them.

What it does

Comgent acts as an intelligent attention layer between users and their communications.

Users can connect multiple Gmail accounts and define what types of information matter to them. When new messages arrive, Comgent detects mailbox changes, retrieves the actual email, and stores the relevant communication state in Firestore.

The agent then analyzes messages to determine factors such as:

  • Importance
  • Urgency
  • Relevance to the user
  • Potential deadlines
  • Required actions
  • Whether the user actually needs to be interrupted

Instead of notifying users about every incoming message, Comgent uses an Attention Decision Engine to determine whether a notification is warranted.

For important messages, Comgent can send a concise summary through WhatsApp or SMS. The notification can also prompt the user to take an action, such as reviewing the email, drafting a response, or continuing the interaction through the web application.

The web application provides a persistent workspace where users can see their synchronized communications, review AI-generated insights, manage connected Gmail accounts, configure attention rules, and continue tasks that are too complex for a messaging channel.

Our goal is for WhatsApp and SMS to act as the user's attention and interaction layer, while the web application acts as the deeper workspace.

How we built it

We designed Comgent as an event-driven, agentic system rather than a simple chatbot.

The core architecture is:

Gmail
  ↓
Gmail Watch / Pub/Sub
  ↓
Firebase Backend
  ↓
Gmail API
  ↓
Firestore
  ↓
Genkit Agent
  ↓
Attention Decision Engine
  ↓
Notification Service
  ↓
WhatsApp / SMS
  ↓
User

We use Next.js for the web application and Expo/React Native for the mobile experience. Firebase provides authentication, Firestore persistence, backend infrastructure, and event-driven processing.

Gmail is integrated through OAuth and the Gmail API. Instead of repeatedly downloading the user's entire inbox, the system is designed around Gmail mailbox change notifications and incremental synchronization. When a change is detected, the backend retrieves the affected messages and persists them in Firestore.

Firestore serves as the application's persistent communication store. This allows the client to load previously synchronized messages quickly without having to request the entire inbox directly from Gmail every time the application is opened.

The intelligence layer is built with Genkit. The agent receives normalized communication data and produces structured reasoning about importance, urgency, summaries, deadlines, and potential actions.

We deliberately separated the AI reasoning layer from external actions. The agent does not directly control Gmail or messaging APIs. Instead, it produces structured decisions that are passed to dedicated services responsible for authentication, authorization, notification delivery, and user approval.

This separation makes the system safer and allows us to add additional communication channels without redesigning the agent.

Challenges we ran into

One of our biggest challenges was moving from a prototype using mocked communication data to a real event-driven system.

It is easy to demonstrate an AI agent with sample emails. It is much harder to reliably detect a real Gmail change, retrieve the correct message, preserve its original subject and body, associate it with the correct account, persist it, analyze it, and trigger a notification without duplicates.

We also encountered the challenge of state synchronization. A user can connect multiple Gmail accounts, and every account has its own synchronization state. The system therefore needs to track Gmail message IDs, thread IDs, history IDs, synchronization status, and processing state while maintaining strict user and account boundaries.

Another challenge was preventing mock data from leaking into the real execution path. During development, we discovered how easily a prototype can appear to work while still relying on fixtures or sample messages. We redesigned the pipeline so that failures in real Gmail retrieval are treated as actual failures rather than silently falling back to mock content.

Agentic actions introduced another challenge. We don't want an AI model to autonomously send an email or perform a consequential action simply because it interpreted a message that way. We therefore introduced an explicit separation between reasoning and execution, with appropriate user approval before sensitive actions.

Finally, building a reliable notification experience required thinking about more than message delivery. The system must consider attention thresholds, duplicate notifications, user preferences, quiet periods, and whether a message is genuinely worth interrupting the user for.

Accomplishments that we're proud of

We are proud that Comgent has evolved from an idea for an AI email summarizer into a broader agentic communication architecture.

One of our biggest accomplishments is the decision to make attention management, rather than summarization, the central problem we solve.

We are also proud of our multi-account architecture. A user can connect multiple Gmail accounts while maintaining clear separation between their accounts and messages.

Another accomplishment is the persistent communication model. Instead of treating every email as a temporary AI prompt, Comgent maintains communication state in Firestore. This creates a foundation for history, context, synchronization, analytics, and future agentic workflows.

We are particularly proud of the separation between:

Observation
    ↓
Reasoning
    ↓
Decision
    ↓
Action
    ↓
User approval

This makes the agent more controllable and provides a foundation for responsible automation.

We also designed WhatsApp and SMS as external attention channels rather than building another notification system that users have to constantly open. This lets Comgent meet users where they already communicate.

What we learned

Our biggest lesson is that building an agentic product is much more than integrating an LLM.

The model may be the most visible component, but reliable agentic behavior depends on everything surrounding it: event processing, state management, authentication, authorization, data synchronization, tool boundaries, error handling, idempotency, and human approval.

We learned that deterministic systems and AI reasoning should complement each other.

For example, Gmail's filtering and synchronization capabilities are useful for reducing the amount of information entering the AI pipeline. The agent can then focus its reasoning on messages that are actually relevant candidates.

We also learned that persistent state is critical for agentic applications. Without knowing what the agent has already seen, analyzed, notified the user about, or acted upon, an agent can easily become repetitive or unreliable.

Another important lesson was that agent autonomy must have boundaries. We want Comgent to be proactive, but we also want users to remain in control of consequential actions.

Finally, we learned that a good agent should not simply answer questions. It should understand when to act, when not to act, and when to ask the user for permission.

What's next for Comgent

Our immediate goal is to complete the transition from the development environment to a fully operational real-data pipeline.

We plan to expand Comgent in several directions.

First, we want to support additional communication sources beyond Gmail, including social messaging platforms and other inboxes. The long-term vision is for Comgent to become a unified attention layer across a user's digital communications.

Second, we want to make the agent more personalized. Instead of relying only on predefined rules, Comgent should learn from user interactions and feedback to understand what each person considers important.

Third, we plan to expand the agent's ability to act on behalf of users. With appropriate confirmation and authorization, Comgent could draft replies, schedule follow-ups, extract tasks and deadlines, and help users complete communication-related workflows.

We also plan to improve the proactive nature of the system. Rather than simply asking "Is this email important?", the agent should be able to reason across multiple messages and conversations, recognize emerging tasks or deadlines, and determine the appropriate time and channel to reach the user.

Ultimately, our vision is for Comgent to become a personal communication agent that protects the user's attention — continuously monitoring information, understanding what matters, bringing important things forward, and helping users act without requiring them to constantly monitor every communication channel.

Built With

Share this project:

Updates