Skip to content

Add WhatsApp and Perplexity MCP Integrations#443

Merged
MervinPraison merged 1 commit intomainfrom
develop
Apr 2, 2025
Merged

Add WhatsApp and Perplexity MCP Integrations#443
MervinPraison merged 1 commit intomainfrom
develop

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

@MervinPraison MervinPraison commented Apr 2, 2025

  • Included new MCP tools for WhatsApp and Perplexity in mint.json for enhanced functionality.
  • Updated installation instructions in openrouter.mdx and xai.mdx to specify the correct package format.
  • Added detailed documentation for WhatsApp and Perplexity integrations, including setup steps and example scripts.
  • Incremented version number to 0.0.72 in pyproject.toml and uv.lock to reflect recent changes.

Summary by CodeRabbit

  • Documentation

    • Updated installation instructions to require additional dependencies for enhanced language model functionality.
    • Added comprehensive guides for integrating a search tool and WhatsApp messaging with AI agents, including multi-agent coordination and UI setup.
    • Expanded the MCP documentation listings.
  • New Features

    • Introduced several examples demonstrating integrations for web search, WhatsApp messaging, coordinated agent workflows, and interactive user interfaces.
  • Chores

    • Updated the package version and dependency requirements.

- Included new MCP tools for WhatsApp and Perplexity in `mint.json` for enhanced functionality.
- Updated installation instructions in `openrouter.mdx` and `xai.mdx` to specify the correct package format.
- Added detailed documentation for WhatsApp and Perplexity integrations, including setup steps and example scripts.
- Incremented version number to 0.0.72 in `pyproject.toml` and `uv.lock` to reflect recent changes.
@MervinPraison MervinPraison merged commit df35172 into main Apr 2, 2025
3 of 6 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request updates the package installation command in two documentation files to include additional dependencies, and introduces new documentation for Perplexity and WhatsApp integrations via the MCP. It adds new entries to a documentation navigation file and introduces several example Python scripts demonstrating integrations using various language models and multi-agent setups, including Gradio UI integration. The package configuration is updated with a new version and refined dependency specifications.

Changes

File(s) Change Summary
docs/mcp/openrouter.mdx, docs/mcp/xai.mdx Updated installation command from pip install praisonaiagents to pip install "praisonaiagents[llm]".
docs/mcp/perplexity.mdx, docs/mcp/whatsapp.mdx New documentation added for Perplexity MCP Integration and WhatsApp MCP Integration, including flowcharts, setup guides, and requirement details.
docs/mint.json Added new MCP entries "mcp/whatsapp" and "mcp/perplexity" to the MCP group.
examples/mcp/perplexity-mcp.py, examples/mcp/whatapp-groq-mcp.py, examples/mcp/whatapp-mcp.py, examples/mcp/whatapp-multi-agents-mcp.py, examples/mcp/whatapp-ollama-mcp.py, examples/mcp/whatsapp-mcp-ui.py New Python scripts demonstrating various integrations: Perplexity search querying, WhatsApp messaging with different LLMs, multi-agent support, and a Gradio UI-based interface.
src/praisonai-agents/pyproject.toml Updated version from "0.0.71" to "0.0.72", changed MCP dependency from mcp==1.6.0 to mcp>=1.6.0, and added an optional dependency section for MCP with updated combined features.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GradioUI
    participant AirbnbAgent
    participant WhatsAppAgent

    User->>GradioUI: Enter Airbnb search query
    GradioUI->>AirbnbAgent: Forward search request
    AirbnbAgent-->>GradioUI: Return search results
    GradioUI->>WhatsAppAgent: Send results message request
    WhatsAppAgent-->>GradioUI: Confirm message delivery
Loading
sequenceDiagram
    participant User
    participant Agent
    participant MCP
    participant PerplexityAPI

    User->>Agent: Request AI news
    Agent->>MCP: Forward query to Perplexity tool
    MCP->>PerplexityAPI: Execute web search
    PerplexityAPI-->>MCP: Deliver search results
    MCP-->>Agent: Return results to the agent
    Agent-->>User: Present search results
Loading

Poem

I hopped into new docs with delight,
Watching integration features take flight.
Agents and examples spring to life,
Code and commands dancing without strife.
With every tweak and joyful leap,
I celebrate these changesβ€”hop, skip, and reap! πŸ‡βœ¨


πŸ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 54fdf5a and 083411b.

β›” Files ignored due to path filters (1)
  • src/praisonai-agents/uv.lock is excluded by !**/*.lock
πŸ“’ Files selected for processing (12)
  • docs/mcp/openrouter.mdx (1 hunks)
  • docs/mcp/perplexity.mdx (1 hunks)
  • docs/mcp/whatsapp.mdx (1 hunks)
  • docs/mcp/xai.mdx (1 hunks)
  • docs/mint.json (1 hunks)
  • examples/mcp/perplexity-mcp.py (1 hunks)
  • examples/mcp/whatapp-groq-mcp.py (1 hunks)
  • examples/mcp/whatapp-mcp.py (1 hunks)
  • examples/mcp/whatapp-multi-agents-mcp.py (1 hunks)
  • examples/mcp/whatapp-ollama-mcp.py (1 hunks)
  • examples/mcp/whatsapp-mcp-ui.py (1 hunks)
  • src/praisonai-agents/pyproject.toml (3 hunks)
✨ Finishing Touches
  • πŸ“ Generate Docstrings

πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces new MCP (Model Context Protocol) integrations for WhatsApp and Perplexity, enhancing the capabilities of PraisonAI agents. It includes documentation, example scripts, and updates to dependencies and versioning. The changes also refine installation instructions and incorporate new features for multi-agent integrations and UI enhancements.

Highlights

  • New MCP Integrations: Added WhatsApp and Perplexity MCP tools to mint.json, providing agents with the ability to interact with WhatsApp and perform web searches via Perplexity.
  • Documentation and Examples: Included detailed documentation for WhatsApp and Perplexity integrations, complete with setup steps, example scripts, and use cases such as multi-agent systems and Gradio UI integration.
  • Dependency Updates: Updated installation instructions in openrouter.mdx and xai.mdx to use the correct package format (praisonaiagents[llm]).
  • Version Increment: Incremented the version number in pyproject.toml and uv.lock from 0.0.71 to 0.0.72 to reflect the new changes.

Changelog

Click here to see the changelog
  • docs/mcp/openrouter.mdx
    • Updated installation instructions to specify the correct package format: pip install "praisonaiagents[llm]".
  • docs/mcp/perplexity.mdx
    • Added new documentation for Perplexity MCP integration, including setup, example scripts, and features.
  • docs/mcp/whatsapp.mdx
    • Added new documentation for WhatsApp MCP integration, including setup, example scripts, multi-agent integration, and Gradio UI integration.
  • docs/mcp/xai.mdx
    • Updated installation instructions to specify the correct package format: pip install "praisonaiagents[llm]".
  • docs/mint.json
    • Added mcp/whatsapp and mcp/perplexity to the list of MCP tools.
  • examples/mcp/perplexity-mcp.py
    • Added example script for using Perplexity MCP integration.
  • examples/mcp/whatapp-groq-mcp.py
    • Added example script for using WhatsApp MCP integration with Groq LLM.
  • examples/mcp/whatapp-mcp.py
    • Added example script for basic WhatsApp MCP integration.
  • examples/mcp/whatapp-multi-agents-mcp.py
    • Added example script for multi-agent integration using WhatsApp and Airbnb MCP tools.
  • examples/mcp/whatapp-ollama-mcp.py
    • Added example script for using WhatsApp MCP integration with Ollama LLM.
  • examples/mcp/whatsapp-mcp-ui.py
    • Added example script for creating a Gradio UI for WhatsApp and Airbnb integration.
  • src/praisonai-agents/pyproject.toml
    • Incremented version to 0.0.72.
    • Changed mcp dependency to 'mcp>=1.6.0'
    • Added 'mcp' extra dependency
    • Added 'praisonaiagents[mcp]' to the 'all' extra dependencies
  • src/praisonai-agents/uv.lock
    • Incremented version to 0.0.72.
    • Added 'mcp' extra dependency
    • Added 'praisonaiagents[mcp]' to the 'all' extra dependencies
    • Changed mcp dependency to 'mcp>=1.6.0'
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with πŸ‘ and πŸ‘Ž on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A search query flies,
To Perplexity's sonar,
Answers swift return.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new MCP tools for WhatsApp and Perplexity, enhancing the functionality of PraisonAI agents. The changes include adding new tools to mint.json, updating installation instructions, and providing detailed documentation. Overall, the changes seem well-structured and contribute positively to the project.

Summary of Findings

  • Missing Error Handling in Example Scripts: The example scripts in perplexity.mdx and whatsapp.mdx lack proper error handling for API key retrieval and potential exceptions during agent execution. This could lead to unexpected crashes or incorrect behavior if the API key is not set or if the external service is unavailable. Consider adding try-except blocks to handle these scenarios gracefully.
  • Hardcoded Paths in WhatsApp Examples: The WhatsApp examples in whatsapp.mdx and example scripts use hardcoded paths to the WhatsApp MCP server. This makes the examples less portable and requires users to manually modify the paths to match their local setup. Consider using environment variables or relative paths to make the examples more flexible.
  • Inconsistent Dependency Installation: The installation instructions in whatsapp.mdx include mcp gradio in addition to praisonaiagents[llm], while perplexity.mdx only includes praisonaiagents[llm]. Ensure that all necessary dependencies are consistently specified across all relevant documentation files.
  • Multi-Agent Example in WhatsApp Documentation: The multi-agent example in whatsapp.mdx has a syntax error (missing closing parenthesis) in the airbnb_agent definition. This will prevent the example from running correctly. Ensure that all code examples are syntactically correct and executable.

Merge Readiness

While the pull request introduces valuable new features, there are several issues that need to be addressed before merging. Specifically, the missing error handling, hardcoded paths, inconsistent dependency installation, and syntax errors in the examples should be fixed to ensure a smooth user experience. I am unable to directly approve this pull request, and recommend that these issues be addressed and the changes be reviewed by another team member before merging.

whatsapp_agent = Agent(
instructions="Whatsapp Agent",
llm="gpt-4o-mini",
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This path is hardcoded. It would be better to use an environment variable or a relative path to make the example more portable. Consider using os.path.join for cross-platform compatibility.

tools=MCP(f"python {os.path.join(os.getcwd(), 'whatsapp-mcp/whatsapp-mcp-server/main.py')}")

Comment on lines +6 to +7
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This path is hardcoded. It would be better to use an environment variable or a relative path to make the example more portable. Consider using os.path.join for cross-platform compatibility.

Suggested change
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")

Comment on lines +6 to +7
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This path is hardcoded. It would be better to use an environment variable or a relative path to make the example more portable. Consider using os.path.join for cross-platform compatibility.

Suggested change
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")

Comment on lines +12 to +13
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This path is hardcoded. It would be better to use an environment variable or a relative path to make the example more portable. Consider using os.path.join for cross-platform compatibility.

Suggested change
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")

Comment on lines +6 to +7
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This path is hardcoded. It would be better to use an environment variable or a relative path to make the example more portable. Consider using os.path.join for cross-platform compatibility.

Suggested change
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")

Comment on lines +14 to +15
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This path is hardcoded. It would be better to use an environment variable or a relative path to make the example more portable. Consider using os.path.join for cross-platform compatibility.

Suggested change
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
)
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")

Comment on lines +39 to +52
# Get API key from environment variable
api_key = os.getenv("PERPLEXITY_API_KEY")

agent = Agent(
instructions="You are a helpful assistant that can search the web for information. Use the available tools when relevant to answer user questions.",
llm="gpt-4o-mini",
tools=MCP("uvx perplexity-mcp",
env={"PERPLEXITY_API_KEY": api_key, "PERPLEXITY_MODEL": "sonar" })
)

result = agent.start("What is the latest news on AI?, Pass only the query parameter to the tool")

print(result)
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This example lacks error handling. Add a try-except block to catch potential exceptions, such as os.getenv returning None or the Perplexity API being unavailable. This will make the example more robust and user-friendly.

try:
    # Get API key from environment variable
    api_key = os.getenv("PERPLEXITY_API_KEY")
    if not api_key:
        raise ValueError("PERPLEXITY_API_KEY not set")

    agent = Agent(
        instructions="You are a helpful assistant that can search the web for information. Use the available tools when relevant to answer user questions.",
        llm="gpt-4o-mini",
        tools=MCP("uvx perplexity-mcp", 
            env={"PERPLEXITY_API_KEY": api_key, "PERPLEXITY_MODEL": "sonar" })
    )
    
    result = agent.start("What is the latest news on AI?, Pass only the query parameter to the tool")

    print(result)
except Exception as e:
    print(f"An error occurred: {e}")

<Step title="Install Dependencies">
Make sure you have the required packages installed:
```bash
pip install "praisonaiagents[llm]" mcp gradio
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Why is mcp and gradio included here, but not in the Perplexity installation instructions? Ensure that all necessary dependencies are consistently specified across all relevant documentation files.

pip install "praisonaiagents[llm]" # Installs the core package with dependencies for LLM support

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 2, 2025

βœ… Deploy Preview for praisonai ready!

Name Link
πŸ”¨ Latest commit 083411b
πŸ” Latest deploy log https://app.netlify.com/sites/praisonai/deploys/67ecfb34f76ad20008052f4b
😎 Deploy Preview https://deploy-preview-443--praisonai.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

shaneholloman pushed a commit to shaneholloman/praisonai that referenced this pull request Feb 4, 2026
Add WhatsApp and Perplexity MCP Integrations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant