crewai - ✅(Solved) Fix [FEATURE]Add email intelligence tools: IgptEmailAskTool + IgptEmailSearchTool [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#4660Fetched 2026-04-08 00:40:50
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Author
Timeline (top)
commented ×2cross-referenced ×1labeled ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #4733: feat(crewai-tools): add iGPT email ask/search tools (#4660)

Description (problem / solution / changelog)

Summary

This PR implements issue #4660.

  • Scope: [FEATURE]Add email intelligence tools: IgptEmailAskTool + IgptEmailSearchTool
  • Source branch: yuweuii:codex/issue-4660
  • Commit: b4acad4b

Linked Issue

Closes #4660

<!-- CURSOR_SUMMARY -->

[!NOTE] Medium Risk Introduces new integrations that call an external email-memory API and rely on new credentials/env vars; impact is limited because the feature is opt-in via an extra dependency.

Overview Adds two new tools, IgptEmailAskTool and IgptEmailSearchTool, enabling natural-language Q&A and search over a user’s email history via the iGPT recall API (with optional schema-structured output and date filtering).

Wires the tools into public exports (crewai_tools and crewai_tools.tools), adds an igptai optional extra in pyproject.toml, and includes a README plus unit tests that mock the igptai client and validate credential/date-range handling.

<sup>Written by Cursor Bugbot for commit 8661e4d9e19c8504964d0b058598d9d816ec61d3. This will update automatically on new commits. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

  • lib/crewai-tools/pyproject.toml (modified, +3/-0)
  • lib/crewai-tools/src/crewai_tools/__init__.py (modified, +3/-0)
  • lib/crewai-tools/src/crewai_tools/tools/__init__.py (modified, +3/-0)
  • lib/crewai-tools/src/crewai_tools/tools/igpt_email_tool/README.md (added, +40/-0)
  • lib/crewai-tools/src/crewai_tools/tools/igpt_email_tool/__init__.py (added, +7/-0)
  • lib/crewai-tools/src/crewai_tools/tools/igpt_email_tool/igpt_email_ask_tool.py (added, +109/-0)
  • lib/crewai-tools/src/crewai_tools/tools/igpt_email_tool/igpt_email_search_tool.py (added, +106/-0)
  • lib/crewai-tools/tests/tools/test_igpt_email_tools.py (added, +156/-0)

Code Example

import os
from typing import Type
from crewai.tools import BaseTool
from pydantic import BaseModel, Field


class IgptEmailAskInput(BaseModel):
    question: str = Field(..., description="Natural language question about email history")
    output_format: str = Field(default="text", description="text | json | schema")


class IgptEmailAskTool(BaseTool):
    name: str = "iGPT Email Ask"
    description: str = (
        "Ask questions over a user's email history and get answers with citations "
        "(useful for decisions, commitments, action items, sentiment, and open loops)."
    )
    args_schema: Type[BaseModel] = IgptEmailAskInput

    def _run(self, question: str, output_format: str = "text") -> str:
        from igptai import IGPT
        igpt = IGPT(
            api_key=os.environ["IGPT_API_KEY"],
            user=os.environ["IGPT_API_USER"],
        )
        return str(igpt.recall.ask(
            input=question,
            quality="cef-1-normal",
            output_format=output_format
        ))
RAW_BUFFERClick to expand / collapse

Feature Area

Integration with external tools

Is your feature request related to a an existing bug? Please link it here.

NA

Describe the solution you'd like

Problem

CrewAI agents that operate on email (support triage, sales follow-ups, executive assistants) typically get raw message text via Gmail APIs or third-party connectors. That's enough to fetch emails, but not enough to reason about decisions, commitments, unresolved threads, tone changes, and repeated patterns across multiple threads.

Proposal

Add two optional tools implemented using CrewAI's BaseTool + args_schema pattern:

IgptEmailAskTool — Natural-language Q&A over a user's full email history

  • Use cases: "What are the open commitments with X?", "What did we decide about pricing?", "Summarize unresolved threads this week."
  • Output: text or JSON; includes citations back to source messages (thread/message identifiers, excerpt + timestamp for each citation).

IgptEmailSearchTool — Keyword + semantic search across threads with date filters

  • Use cases: gather context before drafting, find prior discussions, trace a topic over time.

Implementation sketch

import os
from typing import Type
from crewai.tools import BaseTool
from pydantic import BaseModel, Field


class IgptEmailAskInput(BaseModel):
    question: str = Field(..., description="Natural language question about email history")
    output_format: str = Field(default="text", description="text | json | schema")


class IgptEmailAskTool(BaseTool):
    name: str = "iGPT Email Ask"
    description: str = (
        "Ask questions over a user's email history and get answers with citations "
        "(useful for decisions, commitments, action items, sentiment, and open loops)."
    )
    args_schema: Type[BaseModel] = IgptEmailAskInput

    def _run(self, question: str, output_format: str = "text") -> str:
        from igptai import IGPT
        igpt = IGPT(
            api_key=os.environ["IGPT_API_KEY"],
            user=os.environ["IGPT_API_USER"],
        )
        return str(igpt.recall.ask(
            input=question,
            quality="cef-1-normal",
            output_format=output_format
        ))

Dependencies / configuration

Why this belongs as a first-class tool

It's a thin, opt-in wrapper that adds "email intelligence" (cross-thread context + grounded citations) without changing CrewAI core behavior unless a developer installs and uses it.

Resources

Happy to submit a PR with the full implementation if there's interest.

Describe alternatives you've considered

The current alternatives for email-aware CrewAI agents are: (1) building a custom Gmail API + RAG pipeline from scratch, which requires handling threading, deduplication, and participant tracking manually, or (2) using raw Gmail connectors that return message text without cross-thread context. Both give agents access to individual emails but not the structured understanding (decisions, commitments, open loops) needed for reliable reasoning.

Additional context

We've already shipped a LangChain integration (langchain-igpt v1.1.0 on PyPI) using the same BaseTool pattern, and a LlamaIndex integration was merged upstream (PR #20674). Happy to follow whatever conventions the CrewAI tools package uses.

Willingness to Contribute

Yes, I'd be happy to submit a pull request

extent analysis

Fix Plan

To implement the IgptEmailAskTool and IgptEmailSearchTool, follow these steps:

  • Install the igptai Python SDK using pip: pip install igptai
  • Set the IGPT_API_KEY and IGPT_API_USER environment variables
  • Create a new file for the IgptEmailAskTool class:
# igpt_email_ask_tool.py
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
from igptai import IGPT
import os

class IgptEmailAskInput(BaseModel):
    question: str = Field(..., description="Natural language question about email history")
    output_format: str = Field(default="text", description="text | json | schema")

class IgptEmailAskTool(BaseTool):
    name: str = "iGPT Email Ask"
    description: str = (
        "Ask questions over a user's email history and get answers with citations "
        "(useful for decisions, commitments, action items, sentiment, and open loops)."
    )
    args_schema: Type[BaseModel] = IgptEmailAskInput

    def _run(self, question: str, output_format: str = "text") -> str:
        igpt = IGPT(
            api_key=os.environ["IGPT_API_KEY"],
            user=os.environ["IGPT_API_USER"],
        )
        return str(igpt.recall.ask(
            input=question,
            quality="cef-1-normal",
            output_format=output_format
        ))
  • Create a new file for the IgptEmailSearchTool class:
# igpt_email_search_tool.py
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
from igptai import IGPT
import os

class IgptEmailSearchInput(BaseModel):
    query: str = Field(..., description="Keyword or semantic search query")
    date_filter: str = Field(default="", description="Date filter for search results")

class IgptEmailSearchTool(BaseTool):
    name: str = "iGPT Email Search"
    description: str = (
        "Search for keywords or semantic queries across email threads with date filters."
    )
    args_schema: Type[BaseModel] = IgptEmailSearchInput

    def _run(self, query: str, date_filter: str = "") -> str:
        igpt = IGPT(
            api_key=os.environ["IGPT_API_KEY"],
            user=os.environ["IGPT_API_USER"],
        )
        # Implement search logic using the igptai SDK
        pass

Verification

To verify the implementation, test the IgptEmailAskTool and IgptEmailSearchTool classes with sample inputs and check the output for correctness.

Extra Tips

  • Make

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

crewai - ✅(Solved) Fix [FEATURE]Add email intelligence tools: IgptEmailAskTool + IgptEmailSearchTool [1 pull requests, 2 comments, 3 participants]