Una suite di agenti AI intelligenti per l'organizzazione personale, costruita con AWS Bedrock AgentCore Runtime e Strands Agents. Sistema multi-agente con pay-per-use pricing model.
-
Orchestrator Agent π
- Coordina tutti gli altri agenti
- Analizza intent e delega richieste
- Interfaccia principale con l'utente
-
Task Manager Agent π
- Riceve obiettivi in linguaggio naturale
- Decompone in task SMART actionable
- Persiste su DynamoDB
-
Daily Briefing Agent π
- Riassunto giornaliero automatico
- Legge task dal database
- Integra email da Outlook (via MCP)
- Chat interattiva
- Comandi:
/briefing,/tasks,/add <obiettivo> - Notifiche push
- Supporto Markdown
- Dashboard completa con chat, obiettivi e progetti
- CRUD completo: Crea, modifica ed elimina obiettivi e progetti
- Editing modale: Popup per modifica rapida con validazione
- Formattazione avanzata:
- Supporto grassetto (
**testo**) nelle descrizioni - A capo automatici per testo formattato
- Supporto grassetto (
- Sottotask espandibili: Freccina toggle per mostrare/nascondere i sottotask
- Filtri intelligenti: Per ambito, status, prioritΓ e tag
- Architettura sicura: Backend Flask proxy, nessun endpoint pubblico REST
- AgentCore Gateway: Secure Lambda access with OAuth2 + MCP protocol
- DynamoDB: Persistence layer con 3 tabelle (Goals, Projects, Tasks)
- Lambda Functions: 10 funzioni per CRUD completo (POST/GET/UPDATE/DELETE)
- MCP Server: Model Context Protocol per Outlook
- Microsoft Graph: Email e calendar access
- EventBridge: Scheduled daily briefings (8:00 AM)
- Flask Backend: Proxy locale per invocazione Lambda con IAM auth
- No API Gateway pubblico: Rimosso per eliminare superfici d'attacco
- IAM-only Lambda access: Invocazione diretta tramite boto3 con credenziali AWS
- Backend Flask proxy: Porta 5000 locale, non esposta a internet
- Telegram webhook: Unico endpoint pubblico (necessario per il bot)
- Bedrock AgentCore Runtime: $0.00003/sec di esecuzione
- DynamoDB On-Demand: $1.25/milione write
- Lambda: Primo milione free
- Stima mensile: ~$7-12 per uso moderato
βββββββββββββββ
β Telegram β
β Bot β
ββββββββ¬βββββββ
β
v
ββββββββββββββββββββ βββββββββββββββββ ββββββββββββββββββββ
β API Gateway ββββββ>β Orchestrator β β Flask Frontend β
β (Webhook) β β Agent β β (localhost) β
ββββββββββββββββββββ βββββββββ¬ββββββββ ββββββββββ¬ββββββββββ
β β
βββββββββββββββ΄ββββββββββββββ β
β β β
v v v
ββββββββββββββββββββ ββββββββββββββββββββ β
β Task Manager β β Daily Briefing β β
β Agent β β Agent β β
ββββββββββ¬ββββββββββ ββββββββββ¬ββββββββββ β
β β β
β ββββββββββββββββββββ β β
ββ>β AgentCore β<βββ β
β Gateway β β
β (OAuth2 + MCP) β β
ββββββββββ¬ββββββββββ β
β β
ββββββββββββββββ΄βββββββββββββββ β
β β β
v v v
ββββββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ
β Lambda CRUD APIs β β MCP Server β β Lambda CRUD β
β - Goals (4) β β (Outlook) β β - Projects (4) β
β - Tasks (2) β β β β - IAM Auth Only β
β (DynamoDB) β ββββββββββββββββββ ββββββββββββββββββββ
ββββββββββββββββββββββ
Framework Stack:
- BedrockAgentCore: Runtime container-based su AWS
- AgentCore Gateway: Secure MCP endpoint with OAuth2
- Strands Agents: Python agent framework con tool orchestration
- AWS CDK: Infrastructure as Code (TypeScript)
- Docker: Containerizzazione agenti (ARM64)
asws-agentcore/
βββ agents/ # AI Agents (Bedrock AgentCore)
β βββ gateway_client.py # Shared Gateway client with OAuth2
β βββ orchestrator/
β β βββ agent.py # Main orchestrator logic
β β βββ requirements.txt # Dependencies
β β βββ Dockerfile # ARM64 container
β βββ task-manager/
β β βββ agent.py # Task decomposition logic
β β βββ requirements.txt
β β βββ Dockerfile
β βββ daily-briefing/
β βββ agent.py # Briefing generation logic
β βββ requirements.txt
β βββ Dockerfile
β
βββ lambdas/ # Support Lambda Functions
β βββ goal-api/
β β βββ post_goal.py # POST - Create goals
β β βββ get_goal.py # GET - Query goals
β β βββ update_goal.py # UPDATE - Modify goals
β β βββ delete_goal.py # DELETE - Remove goals
β β βββ requirements.txt
β βββ project-api/
β β βββ post_project.py # POST - Create projects
β β βββ get_project.py # GET - Query projects
β β βββ update_project.py # UPDATE - Modify projects
β β βββ delete_project.py # DELETE - Remove projects
β β βββ requirements.txt
β βββ task-api/
β β βββ post_task.py # POST /tasks - Create tasks
β β βββ get_task.py # GET /tasks - Query tasks
β β βββ requirements.txt
β βββ telegram-webhook/
β βββ bot.py # Telegram bot handler
β βββ requirements.txt
β
βββ chat-frontend/ # Web Frontend
β βββ backend.py # Flask proxy server
β βββ index.html # Main UI with modals
β βββ app.js # Frontend logic (CRUD, formatting)
β βββ style.css # Main styles
β βββ modal-styles.css # Modal & animation styles
β βββ requirements.txt
β
βββ mcp-server/ # Model Context Protocol Server
β βββ server.py # FastAPI MCP server
β βββ requirements.txt
β βββ Dockerfile
β
βββ infrastructure/ # AWS Infrastructure
β βββ cdk-app/
β βββ lib/
β β βββ personal-assistant-stack.ts
β βββ bin/
β β βββ cdk-app.ts
β βββ package.json
β βββ tsconfig.json
β
βββ shared/ # Shared utilities
β βββ models/
β β βββ data_models.py # Task, Email, Briefing models
β βββ utils/
β βββ helpers.py # Common utilities
β
βββ docs/ # Documentation
β βββ DEPLOYMENT.md # Step-by-step deploy guide
β βββ SETUP.md # Initial setup
β βββ troubleshooting.md # Common issues
β
βββ scripts/ # Automation scripts
β βββ deploy.ps1 # Automated deployment (PowerShell)
β βββ test.ps1 # End-to-end testing
β
βββ README.md # This file
βββ requirements.txt # Global Python dependencies
βββ .env.example # Environment variables template
- Python 3.11+
- Node.js 18+
- AWS CLI v2 configured with appropriate permissions
- AWS CDK (
npm install -g aws-cdk) - Bedrock AgentCore Toolkit (
pip install bedrock-agentcore-starter-toolkit) - Telegram Bot Token (da @BotFather)
- Azure App Registration (per Outlook MCP) (opzionale)
- Avviare la VM Qdrant (candidati) con:
aws ec2 start-instances --instance-ids i-0d0048fef11dff830
# Clone repository
git clone <repo-url>
cd asws-agentcore
# Installa dipendenze Python globali
pip install -r requirements.txt
pip install bedrock-agentcore-starter-toolkit strands-agents
# Copia e configura .env
copy .env.example .env
# Compila .env seguendo la sezione "Configurazione .env" piΓΉ sottocd infrastructure/cdk-app
# Installa dipendenze CDK
npm install
# Bootstrap CDK (solo prima volta)
cdk bootstrap
# Deploy stack
cdk deploy --require-approval never
# Salva gli output (ARN Lambda, API Gateway URL, etc)
cdk outputs --json > outputs.jsonGli output includeranno:
TaskPostLambdaArn- Lambda per creare taskTaskGetLambdaArn- Lambda per query taskTelegramWebhookUrl- URL webhook per Telegram
Orchestrator Agent:
cd agents/orchestrator
# Configura agent
agentcore configure -e agent.py --non-interactive
# Deploy
agentcore launch
# Salva ARN (mostrato nell'output)
# Esempio: arn:aws:bedrock-agentcore:us-east-1:123456789012:runtime/orchestrator-xyzTask Manager Agent:
cd ../task-manager
agentcore configure -e agent.py --non-interactive
agentcore launch
# Salva ARNDaily Briefing Agent:
cd ../daily-briefing
agentcore configure -e agent.py --non-interactive
agentcore launch
# Salva ARNπ Guida Completa: Vedi docs/GATEWAY_SETUP.md per dettagli completi.
Il Gateway fornisce accesso sicuro e autenticato alle Lambda Task API tramite OAuth2.
# Crea Gateway MCP
agentcore gateway create-mcp-gateway `
--name TaskAPIGateway `
--region us-east-1
# Output: gateway-id, gateway-url, cognito credentials
# Salva questi valori per lo step 5Aggiungi Lambda targets per POST e GET:
# Target per save-task (POST)
agentcore gateway create-mcp-gateway-target `
--gateway-arn <gateway-arn> `
--gateway-url <gateway-url> `
--role-arn <iam-role-arn> `
--name save-task `
--target-type lambda `
--region us-east-1 `
--target-payload '{
"lambdaArn": "<TaskPostLambdaArn>",
"toolSchema": {
"inlinePayload": [{
"name": "save-task",
"description": "Save tasks to database",
"inputSchema": {
"type": "object",
"properties": {
"tasks": {"type": "array"}
}
}
}]
}
}'
# Target per get-tasks (GET)
agentcore gateway create-mcp-gateway-target `
--gateway-arn <gateway-arn> `
--gateway-url <gateway-url> `
--role-arn <iam-role-arn> `
--name get-tasks `
--target-type lambda `
--region us-east-1 `
--target-payload '{
"lambdaArn": "<TaskGetLambdaArn>",
"toolSchema": {
"inlinePayload": [{
"name": "get-tasks",
"description": "Retrieve tasks from database",
"inputSchema": {
"type": "object",
"properties": {
"due_date": {"type": "string"},
"status": {"type": "string"}
}
}
}]
}
}'Aggiorna .env con gli ARN degli agenti deployati e le credenziali Gateway.
π Guida completa compilazione .env:
# ============================================
# 1. AWS Base (compila subito)
# ============================================
AWS_REGION=us-east-1
AWS_ACCOUNT_ID=<il_tuo_account_id> # es: 879338784410
# ============================================
# 2. Telegram (compila subito)
# ============================================
TELEGRAM_BOT_TOKEN=<token_da_botfather> # Ottieni da @BotFather su Telegram
TELEGRAM_WEBHOOK_URL=<compila_dopo_cdk> # Output CDK: TelegramWebhookUrl
TELEGRAM_CHAT_ID=<tuo_chat_id> # Ottieni mandando /start al bot
# ============================================
# 3. Lambda ARNs (compila dopo CDK deploy)
# ============================================
LAMBDA_TASK_POST_ARN=<compila_dopo_cdk> # Output CDK: TaskPostLambdaArn
LAMBDA_TASK_GET_ARN=<compila_dopo_cdk> # Output CDK: TaskGetLambdaArn
LAMBDA_ORCHESTRATOR_ARN=<compila_dopo_cdk> # Output CDK: OrchestratorLambdaArn
# ============================================
# 4. MCP Server Esterno (opzionale - per Outlook)
# ============================================
MCP_SERVER_URL=https://your-mcp-server.com
MCP_API_KEY=your-api-key
MCP_SECRET_NAME=personal-assistant/mcp-api-key
# ============================================
# 5. Bedrock AgentCore ARNs (compila dopo deploy agenti)
# ============================================
# Ottieni con: agentcore list-agents-runtimes --region us-east-1
ORCHESTRATOR_AGENT_ARN=<output_agentcore_launch> # es: arn:aws:bedrock-agentcore:...:runtime/orchestrator_agent-xxx
TASK_MANAGER_AGENT_ARN=<output_agentcore_launch> # es: arn:aws:bedrock-agentcore:...:runtime/taskmanager_agent-xxx
DAILY_BRIEFING_AGENT_ARN=<output_agentcore_launch> # es: arn:aws:bedrock-agentcore:...:runtime/dailybriefing_agent-xxx
# ============================================
# 6. AgentCore Gateway (compila dopo step 4)
# ============================================
# Ottieni con: agentcore gateway get-mcp-gateway --name TaskAPIGateway --region us-east-1
GATEWAY_MCP_URL=<gateway_url> # es: https://taskapigateway-xxx.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp
GATEWAY_CLIENT_ID=<client_id_da_gateway> # es: 40ipvfb7kr5hnjqm06555e5hlp
GATEWAY_CLIENT_SECRET=<client_secret_da_gateway> # es: 6rtmm58udin800qd6eiufv8top19q615m57...
GATEWAY_TOKEN_ENDPOINT=https://<gateway-id>.auth.us-east-1.amazoncognito.com/oauth2/token
GATEWAY_SCOPE=invokeπ Come ottenere ogni valore:
- AWS_ACCOUNT_ID:
aws sts get-caller-identity --query Account --output text - TELEGRAM_BOT_TOKEN: Crea bot con @BotFather, copia token
- TELEGRAM_CHAT_ID: Manda
/startal bot, poicurl https://api.telegram.org/bot<TOKEN>/getUpdates - Lambda ARNs:
cdk outputs --jsondopo deploy stack - Agent ARNs: Mostrati dopo
agentcore launchoagentcore list-agents-runtimes - Gateway config:
agentcore gateway get-mcp-gateway --name TaskAPIGateway --region us-east-1GATEWAY_TOKEN_ENDPOINTsi ricava da gateway-id:https://<gateway-id>.auth.<region>.amazoncognito.com/oauth2/token
L'orchestrator ha bisogno degli ARN degli altri agenti:
cd agents/orchestrator
# Modifica .bedrock_agentcore.yaml e aggiungi:
# environmentVariables:
# TASK_MANAGER_AGENT_ARN: "arn:..."
# DAILY_BRIEFING_AGENT_ARN: "arn:..."
# MCP_SECRET_NAME: "personal-assistant/mcp-api-key" # opzionale, per MCP esterno
# Re-deploy con nuove variabili
agentcore launch --auto-update-on-conflictTask Manager e Daily Briefing necessitano delle credenziali Gateway:
cd ../task-manager
# Modifica .bedrock_agentcore.yaml e aggiungi:
# environmentVariables:
# GATEWAY_MCP_URL: "https://taskapigateway-xxx.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"
# GATEWAY_CLIENT_ID: "40ipvfb7kr5hnjqm06555e5hlp"
# GATEWAY_CLIENT_SECRET: "6rtmm58udin800qd6eiufv8top19q615m57..."
# GATEWAY_TOKEN_ENDPOINT: "https://taskapigateway-xxx.auth.us-east-1.amazoncognito.com/oauth2/token"
# GATEWAY_SCOPE: "invoke"
agentcore launch --auto-update-on-conflict
cd ../daily-briefing
# Ripeti lo stesso per daily-briefing con le stesse credenziali Gateway
agentcore launch --auto-update-on-conflict# Imposta webhook
$botToken = "<TUO_TELEGRAM_BOT_TOKEN>"
$webhookUrl = "<TELEGRAM_WEBHOOK_URL_DA_CDK_OUTPUT>"
curl -X POST "https://api.telegram.org/bot$botToken/setWebhook" `
-d "url=$webhookUrl"
# Verifica
curl "https://api.telegram.org/bot$botToken/getWebhookInfo"# Test orchestrator
agentcore invoke '{"prompt": "Ciao, cosa puoi fare?"}' -a orchestrator
# Test task manager
agentcore invoke '{"prompt": "Voglio imparare Python"}' -a task-manager
# Test daily briefing
agentcore invoke '{"prompt": "Dammi il briefing"}' -a daily-briefing
# Test su Telegram
# Invia un messaggio al tuo botIl frontend web fornisce un'interfaccia completa per gestire obiettivi e progetti.
cd chat-frontend
# Crea virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Installa dipendenze
pip install -r requirements.txt
# Configura Lambda ARNs in backend.py
# Aggiorna le costanti con gli ARN ottenuti da CDK deploy:
# - GOAL_POST_LAMBDA_ARN
# - GOAL_GET_LAMBDA_ARN
# - GOAL_UPDATE_LAMBDA_ARN
# - GOAL_DELETE_LAMBDA_ARN
# - PROJECT_POST_LAMBDA_ARN
# - PROJECT_GET_LAMBDA_ARN
# - PROJECT_UPDATE_LAMBDA_ARN
# - PROJECT_DELETE_LAMBDA_ARN
# - ORCHESTRATOR_LAMBDA_ARN
# Avvia il backend Flask
python backend.pyApri il browser su http://localhost:5000 e utilizza l'interfaccia web per:
- Chat: Interagisci con l'orchestrator
- Obiettivi: CRUD completo con filtri per ambito, status, prioritΓ
- Progetti: CRUD completo con GitHub URL e tech stack
Features del Frontend:
- βοΈ Editing modale: Click su "Modifica" per aprire popup di editing
- Formattazione: Usa
**testo**per grassetto nelle descrizioni βΆοΈ Sottotask espandibili: Click sulla freccina per mostrare/nascondere- π Refresh automatico: Dopo ogni operazione CRUD
- π¨ UI moderna: Design gradient con animazioni fluide
/start - Messaggio di benvenuto
/briefing - Riassunto giornaliero
/tasks - Lista tutti i task
/add - Aggiungi nuovo obiettivo
<testo> - Messaggio libero (analizzato dall'orchestrator)
Creare task da obiettivo:
Utente: "Voglio imparare AWS entro 3 mesi"
Agente:
β
Ho creato 5 task per il tuo obiettivo!
1. π Completare AWS Cloud Practitioner (entro 2 settimane)
2. π§ Hands-on con EC2 e S3 (entro 1 mese)
3. ποΈ Progetto pratico: Deploy app su AWS (entro 2 mesi)
4. π Studiare architetture serverless (entro 2.5 mesi)
5. π Prepararsi per certificazione (entro 3 mesi)
Buon lavoro! πͺ
Briefing giornaliero:
Utente: /briefing
Agente:
π
**Briefing - Lunedì 20 Gennaio 2025**
π **Task in Programma:** (4 task)
π΄ **Urgente/Alta PrioritΓ :**
β’ Completare AWS Cloud Practitioner - β° Scadenza: 2025-02-03
π Studiare moduli 4-6 e fare quiz pratica
π’ **Normale:**
β’ Setup ambiente AWS con EC2
β’ Review progetto Python
β’ Pianificare sprint settimanale
π§ **Email Importanti:** (3 non lette)
β’ Meeting update - π€ Marco Rossi
β’ Q4 Report - π€ HR Team
π‘ **Suggerimenti:**
β’ β οΈ Scadenza importante tra 14 giorni: certificazione AWS
β’ πͺ Ottimo lavoro! Hai completato 7 task questa settimana
---
_Comandi utili:_
β’ /tasks - Vedi tutti i task
β’ /add <obiettivo> - Aggiungi nuovi task
Ogni agente puΓ² essere testato localmente:
cd agents/orchestrator
python agent.py
# In altro terminale
curl -X POST http://localhost:8080/invoke \
-H "Content-Type: application/json" \
-d '{"prompt": "Ciao, cosa puoi fare?", "user_id": "test"}'cd agents/task-manager
# Configure
agentcore configure -e agent.py --runtime-arch ARM64
# Deploy/Update
agentcore launch --update
# Test
agentcore invoke --agent-runtime-arn <arn> --prompt "Test message"# CloudWatch Logs
aws logs tail /aws/bedrock-agentcore/orchestrator --follow
aws logs tail /aws/lambda/TaskPost --follow
# Agent Runtime Status
aws bedrock-agentcore describe-agent-runtime --agent-runtime-arn <arn>
# DynamoDB Table Scan
aws dynamodb scan --table-name PersonalTasks --limit 10- GATEWAY_SETUP.md: Configurazione AgentCore Gateway (OAuth2 + MCP)
- DEPLOYMENT.md: Guida completa al deployment
- SETUP.md: Setup iniziale e configurazione
- troubleshooting.md: Risoluzione problemi comuni
| Componente | Tecnologia | Scopo |
|---|---|---|
| Agent Framework | Strands Agents | Orchestrazione tool e LLM |
| Agent Runtime | AWS Bedrock AgentCore | Container runtime pay-per-use |
| LLM Model | Claude Sonnet 4 | Reasoning e natural language |
| Database | DynamoDB | Task persistence |
| API | AWS Lambda + API Gateway | Task CRUD operations |
| Bot Interface | Telegram Bot API | User interaction |
| External Tools | MCP (Model Context Protocol) | Outlook integration |
| IaC | AWS CDK (TypeScript) | Infrastructure deployment |
| Containerization | Docker (ARM64) | Agent packaging |
| Scheduling | EventBridge | Daily briefing trigger |
Ogni agente puΓ² essere testato localmente prima del deploy:
cd agents/orchestrator
python agent.py
# In altro terminale
curl -X POST http://localhost:8080/invocations \
-H "Content-Type: application/json" \
-d '{"prompt": "Ciao, cosa puoi fare?", "user_id": "test"}'# Test orchestrator deployato
agentcore invoke '{"prompt": "Ciao"}' -a orchestrator
# Test con session ID per memory
agentcore invoke '{"prompt": "Ricordi cosa ho detto prima?"}' -a orchestrator -s session-123# Test POST task
aws lambda invoke --function-name <TaskPostLambdaArn> \
--payload '{"body": "{\"tasks\": [{\"title\": \"Test task\"}]}"}' \
response.json
# Test GET task
aws lambda invoke --function-name <TaskGetLambdaArn> \
--payload '{"queryStringParameters": {"limit": "10"}}' \
response.json- IAM Roles: Least privilege per ogni Lambda/Agent
- VPC: Opzionale per MCP server
- Secrets Manager: Credenziali Telegram e Azure
- API Keys: MCP server authenticato
- Encryption: DynamoDB encryption at rest
- CRUD completo per Goals e Projects con frontend web
- Formattazione avanzata con grassetto e a capo
- Sottotask espandibili con UI toggle
- Architettura sicura senza API Gateway pubblico
- Multi-utente con autenticazione
- Dashboard analytics con grafici
- Integrazione Google Calendar via MCP
- Agente per meeting notes
- Voice interface con Whisper
- Mobile app (React Native)
Pull requests benvenute! Per modifiche importanti, apri prima una issue.
MIT License - Vedi LICENSE per dettagli
Riccardo Laface - AWS Bedrock AgentCore Specialist
π Buon organizing con i tuoi AI agents! π