Cortex is a persistent multi-agent productivity assistant that remembers your work across sessions, proactively prepares your context, and coordinates specialized sub-agents to execute multi-step tasks end-to-end.
"Your AI that actually knows you between conversations."
| Requirement | Implementation |
|---|---|
| Primary root agent + sub-agents | Cortex Coordinator → Memory/Task/Scheduler/Email sub-agents |
| Store/retrieve structured data | PostgreSQL (Cloud SQL) — user_model, tasks, projects, sessions, action_log |
| MCP tools (calendar, task, notes) | Gmail API + Google Calendar API (via google-api-python-client) |
| Multi-step workflows | SequentialAgent pattern with human-in-the-loop checkpoints |
| API-based system | ADK on Cloud Run as REST API |
✅ Fits all requirements.
User → Cortex Coordinator (LlmAgent)
↓ coordinates
┌────────┼────────┐
↓ ↓ ↓
Memory Scheduler Email
Agent Agent Agent
↓ ↓ ↓
PostgreSQL Gmail API Calendar API
(Cloud SQL)
5 Agents:
- Cortex Coordinator — root agent, orchestration, user interaction
- Memory Agent — persistent user model in PostgreSQL
- Task Agent — task CRUD in PostgreSQL
- Scheduler Agent — Google Calendar reads via API
- Email Agent — Gmail reads/drafts via API
-- User's persistent memory model
CREATE TABLE user_model (
id SERIAL PRIMARY KEY,
key VARCHAR(255) UNIQUE NOT NULL,
value JSONB NOT NULL,
confidence FLOAT DEFAULT 1.0,
source VARCHAR(50) DEFAULT 'chat',
updated_at TIMESTAMP DEFAULT NOW()
);
-- Tasks
CREATE TABLE tasks (
id SERIAL PRIMARY KEY,
title VARCHAR(500) NOT NULL,
description TEXT,
status VARCHAR(20) DEFAULT 'pending',
priority VARCHAR(10) DEFAULT 'medium',
deadline TIMESTAMP,
project_id INT,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
-- Projects
CREATE TABLE projects (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
status VARCHAR(20) DEFAULT 'active',
deadline TIMESTAMP,
created_at TIMESTAMP DEFAULT NOW()
);
-- Sessions
CREATE TABLE sessions (
id SERIAL PRIMARY KEY,
session_id VARCHAR(100) UNIQUE NOT NULL,
context JSONB,
last_interaction TIMESTAMP DEFAULT NOW()
);
-- Action log
CREATE TABLE action_log (
id SERIAL PRIMARY KEY,
session_id VARCHAR(100),
agent VARCHAR(50),
action VARCHAR(100),
payload JSONB,
result JSONB,
created_at TIMESTAMP DEFAULT NOW()
);Since official Gmail/Calendar MCP servers require complex OAuth Desktop flows, we use the REST APIs directly — more reliable for hackathon timeline:
Gmail API (via google-api-python-client):
search_emails(query, max_results=5)— search inboxread_email(thread_id)— get full emaildraft_email(to, subject, body)— create draft
Google Calendar API:
list_events(day, max_results=10)— get day's eventsget_event(event_id)— event detailscreate_event(title, start_time, end_time, attendees)— add to calendar
PostgreSQL (via psycopg2):
memory_get(key)— retrieve from user_modelmemory_put(key, value, confidence, source)— store facttasks_crud(operation, ...)— create/read/update/list tasks
apac-hackathon/
├── SPEC.md
├── README.md
├── requirements.txt
├── .env.example
├── root_agent.yaml ← ADK root agent config
├── agents/
│ ├── __init__.py
│ ├── cortex.py ← Root coordinator agent
│ ├── memory.py ← Memory (PostgreSQL) agent
│ ├── task.py ← Task CRUD agent
│ ├── scheduler.py ← Calendar agent
│ └── email.py ← Email agent
├── tools/
│ ├── __init__.py
│ ├── gmail_tools.py ← Gmail API tools
│ ├── calendar_tools.py ← Calendar API tools
│ └── db_tools.py ← PostgreSQL tools
├── db/
│ ├── schema.sql ← Database schema
│ └── seed.sql ← Sample data for demo
├── app/
│ ├── app.py ← Flask web app (web UI + API)
│ └── requirements.txt
├── deploy.sh / deploy.ps1 ← Cloud Run deployment
└── demo/
└── demo_script.md ← Demo walkthrough script
- ✅ Cortex Coordinator with all 4 sub-agents wired
- ✅ Memory Agent → PostgreSQL (user_model table working)
- ✅ Task Agent → PostgreSQL (tasks table CRUD)
- ✅ Scheduler Agent → Google Calendar API (list events, create event)
- ✅ Email Agent → Gmail API (search, draft)
- ✅ Multi-step workflow with checkpoint (draft email → user approve → confirm)
- ✅ Flask web app as UI
- ✅ Cloud Run deployment
- ✅ GitHub repo
- ✅ PDF slides (2-3 slides)
- ✅ Demo video (YouTube/unlisted)
"Good morning briefing" → "Follow up with Rahul" workflow
-
User: "What's on my plate today?" → Cortex checks Calendar + Memory + Emails → assembles briefing
-
User: "Send a follow-up to Rahul about our last discussion" → Cortex: Memory Agent (get Rahul context) → Email Agent (draft) → show draft → user approves → sent → memory updated
- Cloud SQL PostgreSQL (or AlloyDB) — free tier: 30 days
- Cloud Run — ADK web server
- Service Account — with Cloud SQL Client + Vertex AI roles
- APIs enabled: gmail.googleapis.com, calendar-json.googleapis.com, run.googleapis.com, sqladmin.googleapis.com
- Cloud Run URL submitted
- GitHub repo URL submitted
- PDF presentation (2-3 slides) submitted
- Demo video link submitted
| Day | Focus |
|---|---|
| Day 1 | Scaffold + DB + Memory Agent + Task Agent |
| Day 2 | Scheduler + Email Agent + Coordinator wiring |
| Day 3 | Deploy + Demo video + PDF slides + Submit |
Last updated: 2026-04-05