Visão Geral

Permita que seus agentes gerenciem e-mails, contatos e rascunhos através do Gmail. Envie e-mails, pesquise mensagens, gerencie contatos, crie rascunhos e otimize suas comunicações por e-mail com automação impulsionada por IA.

Pré-requisitos

Antes de usar a integração com o Gmail, certifique-se de que você possui:

Configurando a Integração com o Gmail

1. Conecte sua Conta do Gmail

  1. Navegue até Integrações CrewAI Enterprise
  2. Encontre Gmail na seção de Integrações de Autenticação
  3. Clique em Conectar e conclua o fluxo OAuth
  4. Conceda as permissões necessárias para o gerenciamento de e-mail e contato
  5. Copie seu Token Empresarial em Configurações de Conta

2. Instale o Pacote Necessário

uv add crewai-tools

Ações Disponíveis

Exemplos de Uso

Configuração Básica de Agente Gmail

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

# Get enterprise tools (Gmail tools will be included)
enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

# Create an agent with Gmail capabilities
gmail_agent = Agent(
    role="Email Manager",
    goal="Manage email communications and contacts efficiently",
    backstory="An AI assistant specialized in email management and communication.",
    tools=[enterprise_tools]
)

# Task to send a follow-up email
send_email_task = Task(
    description="Send a follow-up email to john@example.com about the project update meeting",
    agent=gmail_agent,
    expected_output="Email sent successfully with confirmation"
)

# Run the task
crew = Crew(
    agents=[gmail_agent],
    tasks=[send_email_task]
)

crew.kickoff()

Filtrando Ferramentas Específicas do Gmail

from crewai_tools import CrewaiEnterpriseTools

# Get only specific Gmail tools
enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token",
    actions_list=["gmail_send_email", "gmail_search_for_email", "gmail_create_draft"]
)

email_coordinator = Agent(
    role="Email Coordinator",
    goal="Coordinate email communications and manage drafts",
    backstory="An AI assistant that focuses on email coordination and draft management.",
    tools=enterprise_tools
)

# Task to prepare and send emails
email_coordination = Task(
    description="Search for emails from the marketing team, create a summary draft, and send it to stakeholders",
    agent=email_coordinator,
    expected_output="Summary email sent to stakeholders"
)

crew = Crew(
    agents=[email_coordinator],
    tasks=[email_coordination]
)

crew.kickoff()

Gerenciamento de Contatos

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

contact_manager = Agent(
    role="Contact Manager",
    goal="Manage and organize email contacts efficiently",
    backstory="An experienced contact manager who maintains organized contact databases.",
    tools=[enterprise_tools]
)

# Task to manage contacts
contact_task = Task(
    description="""
    1. Search for contacts from the 'example.com' domain
    2. Create new contacts for recent email senders not in the contact list
    3. Update contact information with recent interaction data
    """,
    agent=contact_manager,
    expected_output="Contact database updated with new contacts and recent interactions"
)

crew = Crew(
    agents=[contact_manager],
    tasks=[contact_task]
)

crew.kickoff()

Pesquisa e Análise de E-mails

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

email_analyst = Agent(
    role="Email Analyst",
    goal="Analyze email patterns and provide insights",
    backstory="An AI assistant that analyzes email data to provide actionable insights.",
    tools=[enterprise_tools]
)

# Task to analyze email patterns
analysis_task = Task(
    description="""
    Search for all unread emails from the last 7 days,
    categorize them by sender domain,
    and create a summary report of communication patterns
    """,
    agent=email_analyst,
    expected_output="Email analysis report with communication patterns and recommendations"
)

crew = Crew(
    agents=[email_analyst],
    tasks=[analysis_task]
)

crew.kickoff()

Fluxos de Trabalho Automatizados de E-mail

from crewai import Agent, Task, Crew
from crewai_tools import CrewaiEnterpriseTools

enterprise_tools = CrewaiEnterpriseTools(
    enterprise_token="your_enterprise_token"
)

workflow_manager = Agent(
    role="Email Workflow Manager",
    goal="Automate email workflows and responses",
    backstory="An AI assistant that manages automated email workflows and responses.",
    tools=[enterprise_tools]
)

# Complex task involving multiple Gmail operations
workflow_task = Task(
    description="""
    1. Search for emails with 'urgent' in the subject from the last 24 hours
    2. Create draft responses for each urgent email
    3. Send automated acknowledgment emails to senders
    4. Create a summary report of urgent items requiring attention
    """,
    agent=workflow_manager,
    expected_output="Urgent emails processed with automated responses and summary report"
)

crew = Crew(
    agents=[workflow_manager],
    tasks=[workflow_task]
)

crew.kickoff()

Precisa de Ajuda?

Precisa de Ajuda?

Entre em contato com nosso time de suporte para obter assistência na configuração ou solução de problemas da integração Gmail.