Configuration des outils d'agent (Google Calendar et Gmail)

VérifiéSûr

Configure les intégrations facultatives de Google Calendar et Gmail pour l'agent launch-agentic-rag. Utile lorsque l'utilisateur doit planifier des réunions ou envoyer des e-mails via l'agent, mais nécessite un projet Google Cloud et un compte de service.

Spar Skills Guide Bot
DeveloppementIntermédiaire
7002/06/2026
Claude Code
#agent-tools#google-integration#tool-setup#service-account

Recommandé pour

Notre avis

Configure les outils Google Calendar et Gmail pour l'agent launch-agentic-rag, permettant la planification de réunions et l'envoi d'e-mails.

Points forts

  • Instructions claires et étape par étape.
  • Vérifie d'abord si l'utilisateur a besoin de ces outils.
  • Propose des méthodes alternatives (console et gcloud).
  • Met l'accent sur la sécurité des clés de service.

Limites

  • Spécifique à launch-agentic-rag, non applicable à d'autres projets.
  • Nécessite Google Workspace pour la délégation à l'échelle du domaine.
  • L'octroi d'accès utilisateur reste manuel.
Quand l'utiliser

Utilisez cette compétence lorsque vous souhaitez que votre agent launch-agentic-rag puisse gérer des calendriers et envoyer des e-mails.

Quand l'éviter

Ne l'utilisez pas si vous n'utilisez pas launch-agentic-rag ou si les intégrations optionnelles ne sont pas nécessaires.

Analyse de sécurité

Sûr
Score qualité95/100

The skill provides step-by-step instructions for setting up Google Cloud service account credentials and configuring .env for a RAG agent. No destructive, exfiltrating, or obfuscated commands are present; it only uses standard filesystem operations and local testing commands. Warnings emphasize credential security.

Aucun point d'attention détecté

Exemples

Set up Google Calendar and Gmail tools
Set up Google Calendar and Gmail tools for my launch-agentic-rag agent.
Configure agent tools for scheduling
I need to configure the optional agent tools for launch-agentic-rag so it can schedule meetings and send emails.

Directory: launch-agent-skills/skills/rag-tools/skill.md


name: Agent Tools Setup description: Configure Google Calendar and Gmail tools for launch-agentic-rag agent capabilities triggers:

  • agent tools
  • google calendar
  • gmail integration
  • tool setup
  • agentic tools
  • service account

Agent Tools Setup Skill

Purpose

Configure optional tool integrations for launch-agentic-rag to enable:

  • 📅 Google Calendar - Schedule and manage meetings
  • 📧 Gmail - Send emails on behalf of user
  • 🔧 Custom Tools - Framework for adding more tools

IMPORTANT:

  • This skill is ONLY for launch-agentic-rag (not needed for launch-rag)
  • These tools are optional - the agent works without them
  • Requires Google Cloud project and service account

Prerequisites

  • launch-agentic-rag cloned and set up (use rag-setup skill)
  • Google Cloud account
  • Basic understanding of service accounts and OAuth

Instructions

Step 0: Check If Needed

Ask the user:

Do you want to set up Google Calendar/Gmail tools?

These are optional for launch-agentic-rag. Without them:
✅ Agent still works for Q&A and reasoning
❌ Can't schedule meetings or send emails

Set up tools now? [y/n]

If "n" or "no": Skip this skill entirely.

Step 1: Create Google Cloud Project

Guide the user:

  1. Go to Google Cloud Console
  2. Click Select ProjectNew Project
  3. Name it: agentic-rag-tools (or user preference)
  4. Click Create
  5. Wait for project creation (~30 seconds)

Step 2: Enable APIs

In Google Cloud Console:

  1. Go to APIs & ServicesLibrary
  2. Search and enable:
    • Google Calendar API
    • Gmail API

Via gcloud CLI (alternative):

# Enable required APIs
gcloud services enable calendar-json.googleapis.com
gcloud services enable gmail.googleapis.com

echo "✅ APIs enabled"

Step 3: Create Service Account

In Google Cloud Console:

  1. Go to IAM & AdminService Accounts
  2. Click Create Service Account
  3. Fill in:
    • Name: agentic-rag-agent
    • Description: "Service account for RAG agent tool access"
  4. Click Create and Continue
  5. Skip role assignment (click Continue)
  6. Click Done

Step 4: Generate Service Account Key

In Google Cloud Console:

  1. Find your service account in the list
  2. Click the three dotsManage Keys
  3. Click Add KeyCreate New Key
  4. Choose JSON format
  5. Click Create
  6. Save the downloaded JSON file (e.g., service-account-key.json)

⚠️ IMPORTANT: Keep this file secure - it has access to your account!

Step 5: Move Credentials to Project

# Create credentials directory
mkdir -p credentials

# Move the downloaded key
mv ~/Downloads/service-account-key.json credentials/

# Secure the file
chmod 600 credentials/service-account-key.json

echo "✅ Service account credentials stored securely"

Step 6: Update .env File

Use Edit tool to add to .env:

# Google Cloud Configuration (for agent tools)
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_APPLICATION_CREDENTIALS=credentials/service-account-key.json

# Tool Configuration
ENABLE_CALENDAR_TOOL=true
ENABLE_EMAIL_TOOL=true

To get your project ID:

# From the JSON file
cat credentials/service-account-key.json | grep project_id

# Or from gcloud
gcloud config get-value project

Step 7: Grant Calendar/Gmail Access

IMPORTANT: Service accounts need delegated access to use Calendar/Gmail.

Option A: Domain-Wide Delegation (G Suite/Workspace)

If you have Google Workspace:

  1. Go to Admin Console
  2. Navigate to SecurityAPI ControlsDomain-wide Delegation
  3. Click Add new
  4. Enter service account Client ID (from JSON file)
  5. Add OAuth scopes:
    https://www.googleapis.com/auth/calendar
    https://www.googleapis.com/auth/gmail.send
    
  6. Click Authorize

Option B: User Impersonation (Personal Gmail)

For personal accounts, you'll need OAuth2:

  1. Create OAuth2 credentials in Google Cloud Console
  2. Configure consent screen
  3. Use user authentication flow instead of service account

⚠️ Note: Service accounts work best with Google Workspace. Personal Gmail requires OAuth2 setup.

Step 8: Test Tools Configuration

# Test if credentials are valid
python -c "
from google.oauth2 import service_account
import json

with open('credentials/service-account-key.json') as f:
    creds = service_account.Credentials.from_service_account_file(
        'credentials/service-account-key.json',
        scopes=[
            'https://www.googleapis.com/auth/calendar',
            'https://www.googleapis.com/auth/gmail.send'
        ]
    )
    print('✅ Credentials loaded successfully')
    print(f'Service account: {creds.service_account_email}')
"

Step 9: Verify in Application

Start the server and test tool endpoints:

# Start server
uvicorn main:app --reload --port 8000

# Test calendar tool
curl -X POST http://localhost:8000/agent/query \
  -H "Content-Type: application/json" \
  -d '{"query": "Schedule a meeting tomorrow at 2pm"}'

# Test email tool
curl -X POST http://localhost:8000/agent/query \
  -H "Content-Type: application/json" \
  -d '{"query": "Send an email to test@example.com saying hello"}'

Checklist

  • [ ] Google Cloud project created
  • [ ] Google Calendar API enabled
  • [ ] Gmail API enabled
  • [ ] Service account created
  • [ ] Service account key downloaded (JSON)
  • [ ] Credentials moved to credentials/ directory
  • [ ] File permissions set to 600
  • [ ] .env updated with GOOGLE_APPLICATION_CREDENTIALS
  • [ ] (If Workspace) Domain-wide delegation configured
  • [ ] (If personal) OAuth2 flow set up
  • [ ] Credentials test passed
  • [ ] Tools work in application

Troubleshooting

| Issue | Solution | |-------|----------| | "Permission denied" error | Check domain-wide delegation or OAuth setup | | "Credentials not found" | Verify GOOGLE_APPLICATION_CREDENTIALS path | | "API not enabled" | Enable Calendar/Gmail APIs in Cloud Console | | "Invalid grant" | Service account needs delegated access | | Personal Gmail not working | Use OAuth2 instead of service account |

Important Notes

  • 🔒 Keep credentials secure - Add credentials/ to .gitignore
  • 🏢 Best for Workspace - Service accounts work best with Google Workspace
  • 👤 Personal accounts - Require OAuth2, more setup required
  • 🔧 Optional feature - Agent works without tools for Q&A
  • 🆓 Free tier - Google Cloud free tier covers typical usage

Related Skills

  • rag-setup - Set up launch-agentic-rag first
  • rag-database - Configure database after this

What This Enables

With tools configured, your agent can:

  • Schedule meetings: "Schedule a meeting with John tomorrow at 3pm"
  • Send emails: "Email the team about the project update"
  • Reason about actions: Agent decides when to use tools vs just answer
  • Multi-step workflows: Retrieve info → Schedule meeting → Send confirmation

Without tools, agent only does Q&A with RAG retrieval.

Skills similaires