Add WhatsApp and Perplexity MCP Integrations#443
Conversation
- 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.
|
Caution Review failedThe pull request is closed. WalkthroughThis 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
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
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
Poem
π Recent review detailsConfiguration used: CodeRabbit UI β Files ignored due to path filters (1)
π Files selected for processing (12)
β¨ Finishing Touches
πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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.mdxandxai.mdxto use the correct package format (praisonaiagents[llm]). - Version Increment: Incremented the version number in
pyproject.tomlanduv.lockfrom 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]".
- Updated installation instructions to specify the correct package format:
- 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]".
- Updated installation instructions to specify the correct package format:
- docs/mint.json
- Added
mcp/whatsappandmcp/perplexityto the list of MCP tools.
- Added
- 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
-
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. β©
There was a problem hiding this comment.
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.mdxandwhatsapp.mdxlack 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.mdxand 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.mdxincludemcp gradioin addition topraisonaiagents[llm], whileperplexity.mdxonly includespraisonaiagents[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.mdxhas a syntax error (missing closing parenthesis) in theairbnb_agentdefinition. 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") |
There was a problem hiding this comment.
| tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | ||
| ) |
There was a problem hiding this comment.
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("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | |
| ) | |
| tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py") |
| tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | ||
| ) |
There was a problem hiding this comment.
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("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | |
| ) | |
| tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py") |
| tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | ||
| ) |
There was a problem hiding this comment.
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("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | |
| ) | |
| tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py") |
| tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | ||
| ) |
There was a problem hiding this comment.
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("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | |
| ) | |
| tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py") |
| tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | ||
| ) |
There was a problem hiding this comment.
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("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py") | |
| ) | |
| tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py") |
| # 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) | ||
| ``` |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
β Deploy Preview for praisonai ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Add WhatsApp and Perplexity MCP Integrations
mint.jsonfor enhanced functionality.openrouter.mdxandxai.mdxto specify the correct package format.pyproject.tomlanduv.lockto reflect recent changes.Summary by CodeRabbit
Documentation
New Features
Chores