Chat with the Calendar & Gmail
The goal is to automate the management of events and tasks in Google Calendar and Gmail. It allows users to interact conversationally with these applications, simplifying scheduling and inquiry.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
ChatInput-eoj7g[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Input]
style ChatInput-eoj7g stroke:#a170ff
ChatOutput-vmzfb[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-vmzfb stroke:#a170ff
GmailMesageComponent-h9m4p[<div><img alt="logo" src="/_astro/gmail.CLxyIGOu.svg" style="height: 20px !important;width: 20px !important"/></div>Obtener Correos]
style GmailMesageComponent-h9m4p stroke:#a170ff
GoogleGenerativeAIModel-5k5zx[Gemini]
style GoogleGenerativeAIModel-5k5zx stroke:#a170ff
googlecalendarcomponent-b2avz[Obtener Eventos]
style googlecalendarcomponent-b2avz stroke:#a170ff
AdvancedAgent-r83dk[Agent]
style AdvancedAgent-r83dk stroke:#a170ff
ChatInput-eoj7g -.- AdvancedAgent-r83dk
linkStyle 0 stroke:#a170ff
AdvancedAgent-r83dk -.- ChatOutput-vmzfb
linkStyle 1 stroke:#a170ff
googlecalendarcomponent-b2avz -.- AdvancedAgent-r83dk
linkStyle 2 stroke:#a170ff
GmailMesageComponent-h9m4p -.- AdvancedAgent-r83dk
linkStyle 3 stroke:#a170ff
GoogleGenerativeAIModel-5k5zx -.- AdvancedAgent-r83dk
linkStyle 4 stroke:#a170ff
Chat with the Calendar & Gmail
đź§© Overview
This workflow delivers a conversational interface that lets users manage Google Calendar events and Gmail messages through natural language. A user enters a query, an AI agent interprets the request, selects the appropriate tool (Calendar or Gmail), executes the action, and returns the result—all without requiring manual API calls.
⚙️ Main Features
- Conversational entry point that captures user intent and optional attachments.
- Gemini language model that generates responses, plans, and tool‑call prompts.
- Advanced agent that orchestrates tool usage, maintains short‑term memory, and supports batch processing.
- Google Calendar integration for creating, retrieving, updating, and deleting events.
- Gmail integration for reading, replying, and managing emails.
- Structured system prompt enforcing ISO 8601 date format and clear calendar‑time semantics.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Collects the user’s natural‑language query, session context, and optional files. | User message, session ID, conversation ID, optional files. | Message object containing the user input. |
| Gemini | Generates text, reasoning, and tool‑call instructions based on the user query and system prompt. | Prompt text, system message, LLM parameters (temperature, model, etc.). | Text response that may include tool‑call directives. |
| Advanced Agent | Orchestrates the conversation, decides which tool to call, maintains memory, and produces the final response. | User message, Gemini output, available tools (Calendar, Gmail). | Final response to the user; may trigger tool calls. |
| Google Calendar | Performs calendar operations (Get, Create, Update, Delete) using specified date ranges and event details. | Operation type, start and end dates, event summary, description, attendees, etc. | Calendar event data or status information. |
| Gmail Message | Performs Gmail operations (Get, Send, Reply, Update Label, etc.) using mail IDs, queries, and email content. | Operation type, mail ID, query, email subject/body. | Email data or status information. |
| Chat Output | Presents the agent’s final response to the user in the Playground interface. | Response text from the agent. | Message displayed to the user. |
Note: The two Label Components are informational only and do not influence runtime execution.
đź§ Notes
- The agent’s system prompt explicitly requires ISO 8601 date formatting for all calendar-related data.
- Google API credentials must be configured for both Calendar and Gmail services; the workflow assumes appropriate scopes are granted.
- The agent supports batch processing through the
mapping_datainput, though this configuration is disabled by default. - Memory is enabled by default (
use_checkpointer: true), allowing the agent to maintain context across turns. - The workflow can fall back to alternative LLMs if the primary model fails, though only the Gemini Pro model is currently connected.
- Tool calls are performed via the
component_as_tooloutputs of the Calendar and Gmail components, automatically added to the agent’s toolkit. - The Chat Input node uses the conversation ID
"gmail-1"and session ID"gmail"to track user interactions in the Playground environment. - If no attachments are requested, the
fetch_attachmentsandprocess_attachmentsoptions in the Gmail component remain false, simplifying email retrieval. - Date and time inputs for the Calendar component are validated against ISO 8601; incorrect formats may result in API errors.
- The agent’s response can optionally include structured output if the
use_structured_outputflag is set, though it is disabled in this configuration.