Multi-Agent System

AI-Powered Personal Assistant Agent

n8nTelegram BotGPT-4oGoogle Sheets

Executive Summary

Telegram-based AI assistant that manages email, calendar, and research via natural language. Multi-agent routing with persistent memory enables complex multi-step tasks from a single chat interface.

Workflow

n8n workflow: Telegram trigger to AI Agent with sub-agents

System Architecture

Components

  • Orchestrator: n8n AI Agent node with GPT-4o
  • Interface: Telegram Bot (input/output)
  • Data Layer: Google Sheets (contact database)
  • Sub-Agents: Email, Calendar, Research utilities
  • Memory: Simple Memory buffer for session context

Boundaries

  • Main agent handles intent classification and routing
  • Sub-agents are stateless; context passed per invocation
  • Contact lookup happens before any external action
  • All outputs return through Telegram (single channel)

Agent Design

Tool Calling

  • emailAgent — send/retrieve emails
  • calendarAgent — schedule/update/cancel
  • researchAgent — web search + summarize
  • Database — contact lookup from Sheets

Routing Logic

  • "Email John about..." → lookup John → emailAgent
  • "Schedule meeting with..." → lookup → calendarAgent
  • "Research X" → researchAgent (no lookup needed)
  • Ambiguous → ask clarifying question

Guardrails

  • Contact must exist before email/calendar actions
  • No sending without explicit user confirmation
  • Research results summarized, not raw dumps
  • Memory cleared after 30 min inactivity

Escalation

  • Contact not found → prompt user to add
  • Email send failure → log + notify user
  • Calendar conflict → present alternatives
  • Unknown intent → ask for clarification

Reliability & Ops

Implemented

  • Session memory persists across messages
  • Graceful error messages for failed actions
  • Contact verification before external calls
  • Telegram webhook with retry on failure

Next Iteration

  • Long-term memory (vector store)
  • Multi-user support with auth
  • Action queue for offline processing
  • Undo/rollback for sent emails

Observability & QA

Implemented

  • n8n execution history with full traces
  • Telegram message logs
  • Sub-agent input/output logging

Next Iteration

  • Intent classification accuracy tracking
  • User satisfaction feedback loop
  • Cost monitoring per conversation

QA Checklist

  • Correct intent classification
  • Contact lookup returns accurate data
  • Emails sent to correct recipients
  • Calendar events created with right details
  • Research returns relevant summaries
  • Memory persists across turns

Impact

Single

Interface for email + calendar + research

Zero

App switching required

Verified

Contact info before every action

Extensible

Easy to add new sub-agents

Downloadable Artifacts

Interested in a similar system?

I build AI assistants and multi-agent systems for productivity, communication, and task automation.