mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-11 03:31:27 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc393e1211 | ||
|
|
fdff17faf9 | ||
|
|
b3d893fae1 | ||
|
|
d92dede515 | ||
|
|
a1882233dc | ||
|
|
c540ba34fb | ||
|
|
0abb1b659a | ||
|
|
81adb28688 | ||
|
|
5fbe6e948c | ||
|
|
6128e4c885 | ||
|
|
0e563989ed | ||
|
|
510a853e05 | ||
|
|
d6084cb7ce | ||
|
|
8d4b1c411b | ||
|
|
3be05c855b | ||
|
|
3e5a2f76f4 | ||
|
|
8eee881d2e | ||
|
|
d75f4be41a | ||
|
|
9ea89448ef | ||
|
|
0a5e2df278 | ||
|
|
cc3b64f89b | ||
|
|
546dc5a441 | ||
|
|
bd7422c7ca | ||
|
|
0c2c6da8dd | ||
|
|
b43688086f | ||
|
|
820619e8d9 | ||
|
|
94202adddd | ||
|
|
c7911629b1 | ||
|
|
5a4e3ba707 | ||
|
|
641057b622 | ||
|
|
db1dbf142e | ||
|
|
d9a19ae277 | ||
|
|
3c9d889b4f | ||
|
|
2f324e74db | ||
|
|
c22fef3e6d | ||
|
|
53bee19948 | ||
|
|
798fe68908 | ||
|
|
95796cd4c7 | ||
|
|
b447b7e6eb | ||
|
|
29dfe4b192 | ||
|
|
aca95b1713 | ||
|
|
b4cc3d7a8e | ||
|
|
eaf337b301 | ||
|
|
2f73cf1882 | ||
|
|
680949742e | ||
|
|
560219dcd7 |
No files matched your search
@@ -20,7 +20,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
PraisonAI is a production-ready Multi-AI Agents framework with self-reflection, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. By integrating PraisonAI Agents, AutoGen, and CrewAI into a low-code solution, it streamlines the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration.
|
||||
PraisonAI is a production-ready Multi-AI Agents framework with self-reflection, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. By integrating PraisonAI Agents, AG2 (Formerly AutoGen), and CrewAI into a low-code solution, it streamlines the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration.
|
||||
|
||||
<div align="center">
|
||||
<a href="https://docs.praison.ai">
|
||||
@@ -548,7 +548,7 @@ uv pip install -r pyproject.toml --extra "crewai,autogen"
|
||||
|
||||
## Other Features
|
||||
|
||||
- 🔄 Use CrewAI or AutoGen Framework
|
||||
- 🔄 Use CrewAI or AG2 (Formerly AutoGen) Framework
|
||||
- 💻 Chat with ENTIRE Codebase
|
||||
- 🎨 Interactive UIs
|
||||
- 📄 YAML-based Configuration
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FROM python:3.11-slim
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN pip install flask praisonai==2.0.81 gunicorn markdown
|
||||
RUN pip install flask praisonai==2.1.1 gunicorn markdown
|
||||
EXPOSE 8080
|
||||
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]
|
||||
@@ -30,7 +30,7 @@ Features:
|
||||
- Built-in tools
|
||||
- Structured workflows
|
||||
|
||||
### AutoGen Integration
|
||||
### AG2 (Formerly AutoGen) Integration
|
||||
Requires installation with:
|
||||
```bash
|
||||
pip install "praisonai[autogen]"
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@ from praisonai.auto import AutoGenerator
|
||||
### praisonai.agents_generator
|
||||
Framework-specific agent generation and orchestration:
|
||||
- CrewAI support (requires `praisonai[crewai]`)
|
||||
- AutoGen support (requires `praisonai[autogen]`)
|
||||
- AG2 (Formerly AutoGen) support (requires `praisonai[autogen]`)
|
||||
|
||||
```python
|
||||
from praisonai.agents_generator import AgentsGenerator
|
||||
@@ -51,7 +51,7 @@ pip install praisonai
|
||||
|
||||
# Framework-specific installations
|
||||
pip install "praisonai[crewai]" # Install with CrewAI support
|
||||
pip install "praisonai[autogen]" # Install with AutoGen support
|
||||
pip install "praisonai[autogen]" # Install with AG2 support
|
||||
pip install "praisonai[crewai,autogen]" # Install both frameworks
|
||||
|
||||
# Additional features
|
||||
@@ -71,9 +71,9 @@ When installing with `pip install "praisonai[crewai]"`, you get:
|
||||
- Task delegation capabilities
|
||||
- Sequential and parallel task execution
|
||||
|
||||
### AutoGen
|
||||
### AG2 (Formerly AutoGen)
|
||||
When installing with `pip install "praisonai[autogen]"`, you get:
|
||||
- AutoGen framework support
|
||||
- AG2 framework support
|
||||
- PraisonAI tools integration
|
||||
- Multi-agent conversation capabilities
|
||||
- Code execution environment
|
||||
@@ -110,7 +110,7 @@ Loads environment variables from .env file or system and sets them.</p>
|
||||
file.write("FROM python:3.11-slim\n")
|
||||
file.write("WORKDIR /app\n")
|
||||
file.write("COPY . .\n")
|
||||
file.write("RUN pip install flask praisonai==2.0.81 gunicorn markdown\n")
|
||||
file.write("RUN pip install flask praisonai==2.1.1 gunicorn markdown\n")
|
||||
file.write("EXPOSE 8080\n")
|
||||
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
||||
|
||||
|
||||
@@ -65,14 +65,14 @@ def basic(): # Basic Mode
|
||||
def advanced(): # Advanced Mode with options
|
||||
praisonai = PraisonAI(
|
||||
agent_file="agents.yaml",
|
||||
framework="autogen",
|
||||
framework="autogen", # use AG2 framework (Formerly AutoGen)
|
||||
)
|
||||
praisonai.run()
|
||||
|
||||
def auto(): # Full Automatic Mode
|
||||
praisonai = PraisonAI(
|
||||
auto="Create a movie script about car in mars",
|
||||
framework="autogen"
|
||||
framework="autogen" # use AG2 framework
|
||||
)
|
||||
print(praisonai.framework)
|
||||
praisonai.run()
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: "AutoGen with PraisonAI"
|
||||
description: "Guide for using AutoGen framework with PraisonAI, including installation, setup, and multi-agent conversation capabilities"
|
||||
title: "AG2 with PraisonAI"
|
||||
description: "Guide for using AG2 framework with PraisonAI, including installation, setup, and multi-agent conversation capabilities"
|
||||
icon: "robot"
|
||||
---
|
||||
|
||||
# AutoGen with PraisonAI
|
||||
# AG2 with PraisonAI
|
||||
|
||||
Low-code solution to run AutoGen with integrated tools and features.
|
||||
Low-code solution to run AG2 with integrated tools and features.
|
||||
AutoGen is being evolved into AG2, check the new look [here](https://docs.ag2.ai/docs/Home/)
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -16,7 +17,7 @@ pip install "praisonai[autogen]"
|
||||
```
|
||||
|
||||
This installation includes:
|
||||
- AutoGen framework
|
||||
- AG2 framework
|
||||
- PraisonAI tools integration
|
||||
- Multi-agent conversation capabilities
|
||||
- Code execution environment
|
||||
@@ -27,7 +28,7 @@ This installation includes:
|
||||
# Set your OpenAI API key
|
||||
export OPENAI_API_KEY=xxxxxxxxxx
|
||||
|
||||
# Initialize with AutoGen
|
||||
# Initialize with AG2
|
||||
praisonai --framework autogen --init "Create a Movie Script About Cat in Mars"
|
||||
|
||||
# Run the agents
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: "Praison AI"
|
||||
sidebarTitle: "Home"
|
||||
description: "Comprehensive guide to PraisonAI - an AI Agents Framework with Self Reflection, combining PraisonAI Agents, AutoGen, and CrewAI for building multi-agent LLM systems"
|
||||
description: "Comprehensive guide to PraisonAI - an AI Agents Framework with Self Reflection, combining PraisonAI Agents, AG2 (Formerly AutoGen), and CrewAI for building multi-agent LLM systems"
|
||||
icon: "house"
|
||||
openGraph:
|
||||
url: "/"
|
||||
@@ -46,7 +46,7 @@ seo:
|
||||
</div>
|
||||
|
||||
<Tip>
|
||||
PraisonAI combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
|
||||
PraisonAI combines PraisonAI Agents, AG2 (Formerly AutoGen), and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
|
||||
</Tip>
|
||||
|
||||
## Key Features
|
||||
@@ -56,7 +56,7 @@ seo:
|
||||
Automated creation and management of AI agents with self-reflection capabilities
|
||||
</Card>
|
||||
<Card title="Framework Integration" icon="puzzle-piece">
|
||||
Seamless integration with CrewAI and AutoGen frameworks
|
||||
Seamless integration with CrewAI and AG2 frameworks
|
||||
</Card>
|
||||
<Card title="LLM Support" icon="brain">
|
||||
Support for 100+ Language Learning Models
|
||||
@@ -301,8 +301,8 @@ seo:
|
||||
<Card title="CrewAI Framework" icon="users-gear" href="/framework/crewai">
|
||||
Build collaborative AI teams with CrewAI integration
|
||||
</Card>
|
||||
<Card title="AutoGen Framework" icon="robot" href="/framework/autogen">
|
||||
Create autonomous agent networks using AutoGen
|
||||
<Card title="AG2 Framework" icon="robot" href="/framework/autogen">
|
||||
Create autonomous agent networks using AG2 (Formerly AutoGen)
|
||||
</Card>
|
||||
<Card title="Multimodal Agents" icon="icons" href="/framework/multimodalagents">
|
||||
Work with agents that can process text, images, and other data types
|
||||
@@ -316,7 +316,7 @@ seo:
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Multi Agents UI" icon="users" href="/ui/ui">
|
||||
Work with CrewAI or AutoGen multi-agent systems
|
||||
Work with CrewAI or AG2 multi-agent systems
|
||||
</Card>
|
||||
<Card title="Chat Interface" icon="comments" href="/ui/chat">
|
||||
Chat with 100+ LLMs using a single AI Agent
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: "Praison AI"
|
||||
sidebarTitle: "Home"
|
||||
description: "PraisonAI is a production-ready Multi-AI Agents framework with self-reflection, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. By integrating PraisonAI Agents, AutoGen, and CrewAI into a low-code solution, it streamlines the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration."
|
||||
description: "PraisonAI is a production-ready Multi-AI Agents framework with self-reflection, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. By integrating PraisonAI Agents, AG2 (Formerly AutoGen), and CrewAI into a low-code solution, it streamlines the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration."
|
||||
icon: "house"
|
||||
openGraph:
|
||||
url: "/"
|
||||
@@ -45,7 +45,7 @@ seo:
|
||||
Automated creation and management of AI agents with self-reflection capabilities
|
||||
</Card>
|
||||
<Card title="Framework Integration" icon="puzzle-piece">
|
||||
Seamless integration with CrewAI and AutoGen frameworks
|
||||
Seamless integration with CrewAI and AG2 frameworks
|
||||
</Card>
|
||||
<Card title="LLM Support" icon="brain">
|
||||
Support for 100+ Language Learning Models
|
||||
@@ -711,8 +711,8 @@ flowchart LR
|
||||
<Card title="CrewAI Framework" icon="users-gear" href="/framework/crewai">
|
||||
Build collaborative AI teams with CrewAI integration
|
||||
</Card>
|
||||
<Card title="AutoGen Framework" icon="robot" href="/framework/autogen">
|
||||
Create autonomous agent networks using AutoGen
|
||||
<Card title="AG2 Framework" icon="robot" href="/framework/autogen">
|
||||
Create autonomous agent networks using AG2 (Formerly AutoGen)
|
||||
</Card>
|
||||
<Card title="Multimodal Agents" icon="icons" href="/framework/multimodalagents">
|
||||
Work with agents that can process text, images, and other data types
|
||||
@@ -726,7 +726,7 @@ flowchart LR
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Multi Agents UI" icon="users" href="/ui/ui">
|
||||
Work with CrewAI or AutoGen multi-agent systems
|
||||
Work with CrewAI or AG2 multi-agent systems
|
||||
</Card>
|
||||
<Card title="Chat Interface" icon="comments" href="/ui/chat">
|
||||
Chat with 100+ LLMs using a single AI Agent
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: "Airbnb MCP Integration"
|
||||
sidebarTitle: "Airbnb"
|
||||
description: "Guide for integrating Airbnb booking capabilities with PraisonAI agents using MCP"
|
||||
icon: "airbnb"
|
||||
---
|
||||
|
||||
## Add Airbnb Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `airbnb_search.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python airbnb_search.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
|
||||
## Gradio UI
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import gradio as gr
|
||||
|
||||
def search_airbnb(query):
|
||||
agent = Agent(
|
||||
instructions="You help book apartments on Airbnb.",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
result = agent.start(query)
|
||||
return f"## Airbnb Search Results\n\n{result}"
|
||||
|
||||
demo = gr.Interface(
|
||||
fn=search_airbnb,
|
||||
inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."),
|
||||
outputs=gr.Markdown(),
|
||||
title="Airbnb Booking Assistant",
|
||||
description="Enter your booking requirements below:"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Accommodation Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Booking Details" icon="calendar">
|
||||
Specify dates, guests, and location preferences in natural language.
|
||||
</Card>
|
||||
<Card title="NPM Package" icon="js">
|
||||
Leverages the official Airbnb MCP server package.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: "Anthropic MCP Integration"
|
||||
sidebarTitle: "Anthropic"
|
||||
description: "Guide for integrating Anthropic's Claude models with PraisonAI agents using MCP"
|
||||
icon: "a"
|
||||
---
|
||||
|
||||
## Add Anthropic Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your Anthropic API key as an environment variable in your terminal:
|
||||
```zsh
|
||||
export ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `anthropic_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get API key from environment variable
|
||||
anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY")
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="anthropic/claude-3-7-sonnet-20250219",
|
||||
tools=MCP(
|
||||
command="npx",
|
||||
args=["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"],
|
||||
env={"ANTHROPIC_API_KEY": anthropic_api_key}
|
||||
)
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python anthropic_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Anthropic API key
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Claude 3.7 Sonnet" icon="brain">
|
||||
Leverage Anthropic's powerful Claude 3.7 Sonnet model.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Environment Variables" icon="key">
|
||||
Securely pass API keys using environment variables.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: "AWS KB Retrieval MCP Integration"
|
||||
sidebarTitle: "AWS KB Retrieval"
|
||||
description: "Guide for integrating AWS Knowledge Base retrieval capabilities with PraisonAI agents using MCP"
|
||||
icon: "aws"
|
||||
---
|
||||
|
||||
## Add AWS KB Retrieval Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[AWS KB Retrieval MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF9900,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Keys">
|
||||
Set your AWS credentials as environment variables in your terminal:
|
||||
```bash
|
||||
export AWS_ACCESS_KEY_ID=your_aws_access_key_id_here
|
||||
export AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key_here
|
||||
export AWS_REGION=your_aws_region_here
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `aws_kb_retrieval.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get AWS credentials from environment
|
||||
aws_access_key = os.getenv("AWS_ACCESS_KEY_ID")
|
||||
aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY")
|
||||
aws_region = os.getenv("AWS_REGION")
|
||||
|
||||
# Use a single string command with AWS KB Retrieval configuration
|
||||
aws_kb_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with AWS Knowledge Base.
|
||||
Use the available tools when relevant to retrieve and process AWS information.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-aws-kb-retrieval",
|
||||
env={
|
||||
"AWS_ACCESS_KEY_ID": aws_access_key,
|
||||
"AWS_SECRET_ACCESS_KEY": aws_secret_key,
|
||||
"AWS_REGION": aws_region
|
||||
})
|
||||
)
|
||||
|
||||
aws_kb_agent.start("Search AWS documentation about EC2 instances")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python aws_kb_retrieval.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- AWS credentials (Access Key ID, Secret Access Key, and Region)
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
title: "Brave Search MCP Integration"
|
||||
sidebarTitle: "Brave Search"
|
||||
description: "Guide for integrating Brave Search capabilities with PraisonAI agents using MCP"
|
||||
icon: "searchengin"
|
||||
---
|
||||
|
||||
## Add Brave Search Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Brave Search MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#4169E1,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your Brave Search API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export BRAVE_API_KEY=your_brave_api_key_here
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
|
||||
You can obtain a Brave Search API key from [Brave Search API](https://brave.com/search/api/).
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `brave_search.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API key from environment or set it directly
|
||||
brave_api_key = os.getenv("BRAVE_API_KEY") or "your_brave_api_key_here"
|
||||
|
||||
# Use a single string command with environment variables
|
||||
search_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("npx -y @modelcontextprotocol/server-brave-search", env={"BRAVE_API_KEY": brave_api_key})
|
||||
)
|
||||
|
||||
search_agent.start("Search more information about AI News")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python brave_search.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Brave Search API key
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
title: "Custom Python MCP Client"
|
||||
sidebarTitle: "Custom Python Client"
|
||||
description: "Guide for creating a client to interact with a custom Python MCP server"
|
||||
icon: "person-digging"
|
||||
---
|
||||
|
||||
## Custom Python MCP Client
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Client[Python MCP Client]
|
||||
Client --> Server[Python MCP Server]
|
||||
Server --> Client
|
||||
Client --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Client fill:#3776AB,color:#fff
|
||||
style Server fill:#3776AB,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Overview
|
||||
|
||||
The Custom Python MCP Client demonstrates how to integrate a custom Python MCP server with a PraisonAI agent. This client connects to a stock price MCP server to retrieve real-time stock information.
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Install the required packages:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set Up the Server">
|
||||
First, set up the Custom Python MCP Server.
|
||||
</Step>
|
||||
<Step title="Create Custom Python Client">
|
||||
Save the code above to a file named `custom-python-client.py`.
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools = MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/custom-python-server.py")
|
||||
)
|
||||
|
||||
# NOTE: Python Path replace with yours: /Users/praison/miniconda3/envs/mcp/bin/python
|
||||
# NOTE: custom-python-server.py file path, replace it with yours: /Users/praison/stockprice/custom-python-server.py
|
||||
|
||||
agent.start("What is the stock price of Tesla?")
|
||||
```
|
||||
</Step>
|
||||
<Step title="Run the Client">
|
||||
Execute the client script:
|
||||
```bash
|
||||
python custom-python-client.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- praisonaiagents and mcp packages
|
||||
- A properly configured custom Python MCP server
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
|
||||
## Environment Variables
|
||||
|
||||
For better security and flexibility, you can modify the client to use environment variables:
|
||||
|
||||
```python
|
||||
import os
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
# Get paths from environment variables or use defaults
|
||||
python_path = os.getenv("PYTHON_PATH", "/path/to/python")
|
||||
server_path = os.getenv("SERVER_PATH", "/path/to/server.py")
|
||||
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP(f"{python_path} {server_path}")
|
||||
)
|
||||
|
||||
agent.start("What is the stock price of Tesla?")
|
||||
```
|
||||
|
||||
This approach allows you to set the paths using environment variables:
|
||||
|
||||
```bash
|
||||
export PYTHON_PATH=/Users/praison/miniconda3/envs/mcp/bin/python
|
||||
export SERVER_PATH=/Users/praison/stockprice/app.py
|
||||
```
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: "Custom Python MCP Server"
|
||||
sidebarTitle: "Custom Python Server"
|
||||
description: "Guide for creating a custom Python MCP server for stock price retrieval"
|
||||
icon: "server"
|
||||
---
|
||||
|
||||
## Custom Python MCP Server
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Client[Python MCP Client]
|
||||
Client --> Server[Python MCP Server]
|
||||
Server --> Client
|
||||
Client --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Client fill:#3776AB,color:#fff
|
||||
style Server fill:#3776AB,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Overview
|
||||
|
||||
The Custom Python MCP Server is a simple implementation of the Model Context Protocol (MCP) that provides stock price information using the yfinance library. This server can be used with PraisonAI agents to retrieve real-time stock prices.
|
||||
|
||||
## Server Implementation
|
||||
|
||||
Below is the complete implementation of the custom Python MCP server:
|
||||
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Install the required packages:
|
||||
```bash
|
||||
pip install yfinance mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Save the Server Code">
|
||||
Save the code above to a file named `custom-python-server.py`.
|
||||
```python
|
||||
import yfinance as yf
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("stock_prices")
|
||||
|
||||
@mcp.tool()
|
||||
async def get_stock_price(ticker: str) -> str:
|
||||
"""Get the current stock price for a given ticker symbol.
|
||||
|
||||
Args:
|
||||
ticker: Stock ticker symbol (e.g., AAPL, MSFT, GOOG)
|
||||
|
||||
Returns:
|
||||
Current stock price as a string
|
||||
"""
|
||||
if not ticker:
|
||||
return "No ticker provided"
|
||||
try:
|
||||
stock = yf.Ticker(ticker)
|
||||
info = stock.info
|
||||
current_price = info.get('currentPrice') or info.get('regularMarketPrice')
|
||||
if not current_price:
|
||||
return f"Could not retrieve price for {ticker}"
|
||||
return f"${current_price:.2f}"
|
||||
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport='stdio')
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- yfinance package
|
||||
- mcp package
|
||||
</Note>
|
||||
@@ -0,0 +1,168 @@
|
||||
---
|
||||
title: "Custom Python MCP Server"
|
||||
sidebarTitle: "Custom Python MCP"
|
||||
description: "Guide for creating and using custom Python MCP servers with PraisonAI agents"
|
||||
icon: "python"
|
||||
---
|
||||
|
||||
# Custom Python MCP Server
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Custom Python MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#3776AB,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Create MCP Server">
|
||||
Create a new file `app.py` with your custom MCP server implementation:
|
||||
```python
|
||||
import yfinance as yf
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("stock_prices")
|
||||
|
||||
@mcp.tool()
|
||||
async def get_stock_price(ticker: str) -> str:
|
||||
"""Get the current stock price for a given ticker symbol.
|
||||
|
||||
Args:
|
||||
ticker: Stock ticker symbol (e.g., AAPL, MSFT, GOOG)
|
||||
|
||||
Returns:
|
||||
Current stock price as a string
|
||||
"""
|
||||
if not ticker:
|
||||
return "No ticker provided"
|
||||
try:
|
||||
stock = yf.Ticker(ticker)
|
||||
info = stock.info
|
||||
current_price = info.get('currentPrice') or info.get('regularMarketPrice')
|
||||
if not current_price:
|
||||
return f"Could not retrieve price for {ticker}"
|
||||
return f"${current_price:.2f}"
|
||||
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport='stdio')
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Install the required dependencies in a conda environment:
|
||||
```bash
|
||||
pip install yfinance mcp
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create Agent Integration">
|
||||
Create a new file `stock_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools = MCP("/path/to/python /path/to/app.py")
|
||||
)
|
||||
|
||||
# NOTE: Replace with your actual Python path and app.py file path
|
||||
|
||||
agent.start("What is the stock price of Tesla?")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python stock_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Conda for environment management
|
||||
- yfinance package for stock data
|
||||
- mcp-python-sdk for MCP server implementation
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Custom Tools" icon="wrench">
|
||||
Create your own custom tools with Python.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Type Hints" icon="code">
|
||||
Strong typing for better code reliability.
|
||||
</Card>
|
||||
<Card title="Async Support" icon="bolt">
|
||||
Built-in support for asynchronous functions.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### FastMCP Class
|
||||
|
||||
The `FastMCP` class from the `mcp-python-sdk` package provides a simple way to create MCP servers in Python:
|
||||
|
||||
```python
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
# Create an MCP server with a name
|
||||
mcp = FastMCP("my_tools")
|
||||
|
||||
# Define a tool using the @mcp.tool decorator
|
||||
@mcp.tool()
|
||||
async def my_tool(param1: str, param2: int) -> str:
|
||||
"""Tool description with clear documentation.
|
||||
|
||||
Args:
|
||||
param1: Description of param1
|
||||
param2: Description of param2
|
||||
|
||||
Returns:
|
||||
Description of the return value
|
||||
"""
|
||||
# Tool implementation
|
||||
return f"Processed {param1} with {param2}"
|
||||
|
||||
# Run the server with stdio transport
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport='stdio')
|
||||
```
|
||||
|
||||
### Agent Integration
|
||||
|
||||
To use your custom MCP server with PraisonAI agents, use the `MCP` class to specify the command to run your Python script:
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
agent = Agent(
|
||||
instructions="Agent instructions",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP(
|
||||
command="python", # Or full path to Python
|
||||
args=["path/to/your/mcp_server.py"] # Path to your MCP server script
|
||||
)
|
||||
)
|
||||
```
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "Everart MCP Integration"
|
||||
sidebarTitle: "Everart"
|
||||
description: "Guide for integrating Everart AI art generation capabilities with PraisonAI agents using MCP"
|
||||
icon: "palette"
|
||||
---
|
||||
|
||||
## Add Everart Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Everart MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF6B6B,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your Everart API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export EVERART_API_KEY=your_everart_api_key_here
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `everart_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get Everart API key from environment
|
||||
everart_api_key = os.getenv("EVERART_API_KEY")
|
||||
|
||||
# Use a single string command with Everart configuration
|
||||
everart_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Everart.
|
||||
Use the available tools when relevant to generate and manage art.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-everart",
|
||||
env={"EVERART_API_KEY": everart_api_key})
|
||||
)
|
||||
|
||||
everart_agent.start("Generate an artistic image of a sunset")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python everart_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Everart API key
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
title: "Filesystem MCP Integration"
|
||||
sidebarTitle: "Filesystem"
|
||||
description: "Guide for integrating filesystem operations with PraisonAI agents using MCP"
|
||||
icon: "folder-open"
|
||||
---
|
||||
|
||||
## Add Filesystem Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Filesystem MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FFA500,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `filesystem_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Define allowed directories for filesystem access
|
||||
allowed_dirs = [
|
||||
"/Users/username/Desktop",
|
||||
"/path/to/other/allowed/dir"
|
||||
]
|
||||
|
||||
# Use a single string command with allowed directories
|
||||
filesystem_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with the filesystem.
|
||||
Use the available tools when relevant to manage files and directories.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-filesystem", args=allowed_dirs)
|
||||
)
|
||||
|
||||
filesystem_agent.start("List files in the allowed directories")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python filesystem_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
- Read/write access to the specified directories
|
||||
</Note>
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "Google Drive MCP Integration"
|
||||
sidebarTitle: "Google Drive"
|
||||
description: "Guide for integrating Google Drive file management with PraisonAI agents using MCP"
|
||||
icon: "google-drive"
|
||||
---
|
||||
|
||||
## Add Google Drive Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Google Drive MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#0F9D58,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set up Google Drive Credentials">
|
||||
Set your Google Drive credentials path as an environment variable in your terminal:
|
||||
```bash
|
||||
export GDRIVE_CREDENTIALS_PATH=path/to/your/gcp-oauth.keys.json
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `gdrive_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the credentials path from environment
|
||||
gdrive_credentials = os.getenv("GDRIVE_CREDENTIALS_PATH", "servers/gcp-oauth.keys.json")
|
||||
|
||||
# Use a single string command with Google Drive configuration
|
||||
gdrive_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Google Drive.
|
||||
Use the available tools when relevant to manage files and folders.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-gdrive",
|
||||
env={"GDRIVE_CREDENTIALS_PATH": gdrive_credentials})
|
||||
)
|
||||
|
||||
gdrive_agent.start("List files in my Google Drive")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python gdrive_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Google Drive API credentials (OAuth keys)
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: "Gemini MCP Integration"
|
||||
sidebarTitle: "Gemini"
|
||||
description: "Guide for integrating Google's Gemini models with PraisonAI agents using MCP"
|
||||
icon: "google"
|
||||
---
|
||||
|
||||
## Add Gemini Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your Google API key as an environment variable in your terminal:
|
||||
```zsh
|
||||
export GOOGLE_API_KEY=your_google_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `gemini_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get API key from environment variable
|
||||
google_api_key = os.environ.get("GOOGLE_API_KEY")
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gemini/gemini-2.5-pro-exp-03-25",
|
||||
tools=MCP(
|
||||
command="npx",
|
||||
args=["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"],
|
||||
env={"GOOGLE_API_KEY": google_api_key}
|
||||
)
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python gemini_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Google API key for Gemini models
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Gemini 2.5 Pro" icon="brain">
|
||||
Leverage Google's advanced Gemini 2.5 Pro model.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Environment Variables" icon="key">
|
||||
Securely pass API keys using environment variables.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "GitHub MCP Integration"
|
||||
sidebarTitle: "GitHub"
|
||||
description: "Guide for integrating GitHub repository management with PraisonAI agents using MCP"
|
||||
icon: "github"
|
||||
---
|
||||
|
||||
## Add GitHub Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[GitHub MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#181717,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your GitHub Personal Access Token as an environment variable in your terminal:
|
||||
```bash
|
||||
export GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token_here
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `github_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API key from environment or set it directly
|
||||
github_token = os.getenv("GITHUB_PERSONAL_ACCESS_TOKEN")
|
||||
|
||||
# Use a single string command with environment variables
|
||||
github_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with GitHub.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-github",
|
||||
env={"GITHUB_PERSONAL_ACCESS_TOKEN": github_token})
|
||||
)
|
||||
|
||||
github_agent.start("List my GitHub repositories")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python github_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- GitHub Personal Access Token
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: "GitLab MCP Integration"
|
||||
sidebarTitle: "GitLab"
|
||||
description: "Guide for integrating GitLab repository management with PraisonAI agents using MCP"
|
||||
icon: "gitlab"
|
||||
---
|
||||
|
||||
## Add GitLab Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[GitLab MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FC6D26,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Keys">
|
||||
Set your GitLab credentials as environment variables in your terminal:
|
||||
```bash
|
||||
export GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token_here
|
||||
export GITLAB_API_URL=https://gitlab.com/api/v4
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `gitlab_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API token and URL from environment or set directly
|
||||
gitlab_token = os.getenv("GITLAB_PERSONAL_ACCESS_TOKEN")
|
||||
gitlab_api_url = os.getenv("GITLAB_API_URL", "https://gitlab.com/api/v4")
|
||||
|
||||
# Use a single string command with environment variables
|
||||
gitlab_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with GitLab.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-gitlab",
|
||||
env={
|
||||
"GITLAB_PERSONAL_ACCESS_TOKEN": gitlab_token,
|
||||
"GITLAB_API_URL": gitlab_api_url
|
||||
})
|
||||
)
|
||||
|
||||
gitlab_agent.start("List my GitLab projects")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python gitlab_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- GitLab Personal Access Token
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "Google Maps MCP Integration"
|
||||
sidebarTitle: "Google Maps"
|
||||
description: "Guide for integrating Google Maps location services with PraisonAI agents using MCP"
|
||||
icon: "map"
|
||||
---
|
||||
|
||||
## Add Google Maps Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Google Maps MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#4285F4,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your Google Maps API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `google_maps_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the API key from environment
|
||||
maps_api_key = os.getenv("GOOGLE_MAPS_API_KEY")
|
||||
|
||||
# Use a single string command with Google Maps configuration
|
||||
maps_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Google Maps.
|
||||
Use the available tools when relevant to handle location-based queries.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-google-maps",
|
||||
env={"GOOGLE_MAPS_API_KEY": maps_api_key})
|
||||
)
|
||||
|
||||
maps_agent.start("Find nearby restaurants in London")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python google_maps_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Google Maps API key
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
title: "Groq MCP Integration"
|
||||
sidebarTitle: "Groq"
|
||||
description: "Guide for integrating Groq models with PraisonAI agents using MCP"
|
||||
icon: "bolt"
|
||||
---
|
||||
|
||||
## Add Groq Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your Groq API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export GROQ_API_KEY=your_groq_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `groq_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="groq/llama-3.2-90b-vision-preview",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python groq_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Groq API key
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Ultra-Fast Inference" icon="bolt">
|
||||
Utilize Groq's high-performance LPU inference for rapid responses.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Advanced Models" icon="brain">
|
||||
Access to Llama 3.2 90B and other powerful models.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
title: "Memory MCP Integration"
|
||||
sidebarTitle: "Memory"
|
||||
description: "Guide for integrating memory storage capabilities with PraisonAI agents using MCP"
|
||||
icon: "memory"
|
||||
---
|
||||
|
||||
## Add Memory Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Memory MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#4B0082,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `memory_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the memory file path from environment
|
||||
memory_file_path = os.getenv("MEMORY_FILE_PATH", "/path/to/custom/memory.json")
|
||||
|
||||
# Use a single string command with Memory configuration
|
||||
memory_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can store and retrieve information.
|
||||
Use the available tools when relevant to manage memory operations.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-memory",
|
||||
env={"MEMORY_FILE_PATH": memory_file_path})
|
||||
)
|
||||
|
||||
memory_agent.start("Store this conversation in memory")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python memory_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
- Write access to the specified memory file path
|
||||
</Note>
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: "Mistral MCP Integration"
|
||||
sidebarTitle: "Mistral"
|
||||
description: "Guide for integrating Mistral models with PraisonAI agents using MCP"
|
||||
icon: "wind"
|
||||
---
|
||||
|
||||
## Add Mistral Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your Mistral API key as an environment variable in your terminal:
|
||||
```zsh
|
||||
export MISTRAL_API_KEY=your_mistral_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `mistral_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get API key from environment variable
|
||||
mistral_api_key = os.environ.get("MISTRAL_API_KEY")
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="mistral/mistral-large-latest",
|
||||
tools=MCP(
|
||||
command="npx",
|
||||
args=["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"],
|
||||
env={"MISTRAL_API_KEY": mistral_api_key}
|
||||
)
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python mistral_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Mistral API key
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Mistral Large" icon="brain">
|
||||
Leverage Mistral's powerful large language model.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Environment Variables" icon="key">
|
||||
Securely pass API keys using environment variables.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
title: "Ollama Python MCP Integration"
|
||||
sidebarTitle: "Ollama Python"
|
||||
description: "Guide for integrating Ollama models with Python MCP servers using PraisonAI agents"
|
||||
icon: "python"
|
||||
---
|
||||
|
||||
## Add Ollama Python Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Stock Price MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#3776AB,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set Up Ollama">
|
||||
Make sure you have Ollama installed and running locally:
|
||||
```bash
|
||||
# Install Ollama from https://ollama.ai/
|
||||
# Pull the llama3.2 model
|
||||
ollama pull llama3.2
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `ollama_stock.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
stock_agent = Agent(
|
||||
instructions="""You are a Stock Price Assistant.""",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/app.py")
|
||||
)
|
||||
|
||||
# NOTE: Python Path replace with yours: /Users/praison/miniconda3/envs/mcp/bin/python
|
||||
# NOTE: app.py file path, replace it with yours: /Users/praison/stockprice/app.py
|
||||
|
||||
stock_agent.start("What is the Stock Price of Apple?")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have the required packages installed:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]" yfinance mcp
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python ollama_stock.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Ollama installed and running locally
|
||||
- yfinance and mcp packages installed
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Local LLM" icon="server">
|
||||
Run models locally using Ollama without relying on external APIs.
|
||||
</Card>
|
||||
<Card title="Stock Data" icon="chart-line">
|
||||
Retrieve real-time stock price information using the yfinance library.
|
||||
</Card>
|
||||
<Card title="Python MCP" icon="python">
|
||||
Use Python-based MCP servers for custom tool functionality.
|
||||
</Card>
|
||||
<Card title="Privacy-Focused" icon="shield-alt">
|
||||
Keep sensitive data local with on-device inference.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
title: "Ollama MCP Integration"
|
||||
sidebarTitle: "Ollama"
|
||||
description: "Guide for integrating Ollama models with PraisonAI agents using MCP"
|
||||
icon: "dragon"
|
||||
---
|
||||
|
||||
## Add Ollama Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set Up Ollama">
|
||||
Make sure you have Ollama installed and running locally:
|
||||
```bash
|
||||
# Install Ollama from https://ollama.ai/
|
||||
# Pull the llama3.2 model
|
||||
ollama pull llama3.2
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `ollama_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python ollama_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Ollama installed and running locally
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Local LLM" icon="server">
|
||||
Run models locally using Ollama without relying on external APIs.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Privacy-Focused" icon="shield-alt">
|
||||
Keep sensitive data local with on-device inference.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,128 @@
|
||||
---
|
||||
title: "OpenAI MCP Integration"
|
||||
sidebarTitle: "OpenAI"
|
||||
description: "Guide for integrating OpenAI models with PraisonAI agents using MCP"
|
||||
icon: "folder-open"
|
||||
---
|
||||
|
||||
## Add OpenAI Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```zsh
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `openai_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get API key from environment variable
|
||||
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP(
|
||||
command="npx",
|
||||
args=["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"],
|
||||
env={"OPENAI_API_KEY": openai_api_key}
|
||||
)
|
||||
)
|
||||
|
||||
search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```zsh
|
||||
pip install praisonaiagents
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```zsh
|
||||
python openai_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
|
||||
## Gradio UI
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import gradio as gr
|
||||
import os
|
||||
|
||||
# Get API key from environment variable
|
||||
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
||||
|
||||
def search_airbnb(query):
|
||||
agent = Agent(
|
||||
instructions="You help book apartments on Airbnb.",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP(
|
||||
command="npx",
|
||||
args=["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"],
|
||||
env={"OPENAI_API_KEY": openai_api_key}
|
||||
)
|
||||
)
|
||||
result = agent.start(query)
|
||||
return f"## Airbnb Search Results\n\n{result}"
|
||||
|
||||
demo = gr.Interface(
|
||||
fn=search_airbnb,
|
||||
inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."),
|
||||
outputs=gr.Markdown(),
|
||||
title="Airbnb Booking Assistant",
|
||||
description="Enter your booking requirements below:"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="GPT-4o-mini" icon="brain">
|
||||
Uses OpenAI's efficient GPT-4o-mini model for optimal performance.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Environment Variables" icon="key">
|
||||
Securely pass API keys using environment variables.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
title: "OpenRouter MCP Integration"
|
||||
sidebarTitle: "OpenRouter"
|
||||
description: "Guide for integrating OpenRouter models with PraisonAI agents using MCP"
|
||||
icon: "network-wired"
|
||||
---
|
||||
|
||||
## Add OpenRouter Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenRouter API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENROUTER_API_KEY=your_openrouter_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `openrouter_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="openrouter/google/gemini-2.0-flash-exp:free",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python openrouter_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenRouter API key
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Model Flexibility" icon="layer-group">
|
||||
Access to various models through OpenRouter's unified API.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="Cost Effective" icon="money-bill">
|
||||
Use free tier models like Gemini Flash through OpenRouter.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
title: "Perplexity MCP Integration"
|
||||
sidebarTitle: "Perplexity"
|
||||
description: "Guide for integrating Perplexity search with PraisonAI agents using MCP"
|
||||
icon: "magnifying-glass"
|
||||
---
|
||||
|
||||
## Add Perplexity Search Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Perplexity MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#4B0082,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your Perplexity API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export PERPLEXITY_API_KEY=your_perplexity_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `perplexity_search.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# 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)
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have the required packages installed:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python perplexity_search.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Perplexity API key
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Web Search" icon="globe">
|
||||
Search the web for real-time information using Perplexity's powerful search API.
|
||||
</Card>
|
||||
<Card title="Sonar Model" icon="radar">
|
||||
Utilize Perplexity's Sonar model for high-quality search results.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Environment Variables" icon="key">
|
||||
Securely pass API keys using environment variables.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title: "PostgreSQL MCP Integration"
|
||||
sidebarTitle: "PostgreSQL"
|
||||
description: "Guide for integrating PostgreSQL database operations with PraisonAI agents using MCP"
|
||||
icon: "database"
|
||||
---
|
||||
|
||||
## Add PostgreSQL Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[PostgreSQL MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#336791,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set up PostgreSQL">
|
||||
Ensure you have PostgreSQL running locally or specify your PostgreSQL connection URL.
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `postgres_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# PostgreSQL connection string
|
||||
postgres_url = "postgresql://localhost/mydb"
|
||||
|
||||
# Use a single string command with PostgreSQL configuration
|
||||
postgres_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with PostgreSQL databases.
|
||||
Use the available tools when relevant to manage database operations.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-postgres", args=[postgres_url])
|
||||
)
|
||||
|
||||
postgres_agent.start("List all tables in the database")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python postgres_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- PostgreSQL server running locally or remotely
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title: "Puppeteer MCP Integration"
|
||||
sidebarTitle: "Puppeteer"
|
||||
description: "Guide for integrating web automation capabilities with PraisonAI agents using Puppeteer MCP"
|
||||
icon: "chrome"
|
||||
---
|
||||
|
||||
## Add Puppeteer Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Puppeteer MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#00B4FF,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `puppeteer_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use a single string command with Puppeteer configuration
|
||||
puppeteer_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can automate web browser interactions.
|
||||
Use the available tools when relevant to perform web automation tasks.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-puppeteer")
|
||||
)
|
||||
|
||||
puppeteer_agent.start("Navigate to example.com and take a screenshot")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python puppeteer_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
- Chrome or Chromium browser installed on your system
|
||||
</Note>
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title: "Redis MCP Integration"
|
||||
sidebarTitle: "Redis"
|
||||
description: "Guide for integrating Redis database operations with PraisonAI agents using MCP"
|
||||
icon: "database"
|
||||
---
|
||||
|
||||
## Add Redis Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Redis MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#DC382D,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set up Redis">
|
||||
Ensure you have Redis running locally or specify your Redis connection URL.
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `redis_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Redis connection string
|
||||
redis_url = "redis://localhost:6379"
|
||||
|
||||
# Use a single string command with Redis configuration
|
||||
redis_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Redis.
|
||||
Use the available tools when relevant to manage Redis operations.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-redis", args=[redis_url])
|
||||
)
|
||||
|
||||
redis_agent.start("Set a key-value pair in Redis")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python redis_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Redis server running locally or remotely
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: "Sequential Thinking MCP Integration"
|
||||
sidebarTitle: "Sequential Thinking"
|
||||
description: "Guide for integrating sequential thinking capabilities with PraisonAI agents using MCP"
|
||||
icon: "brain"
|
||||
---
|
||||
|
||||
## Add Sequential Thinking Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Sequential Thinking MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#6A5ACD,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `sequential_thinking.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use a single string command with Sequential Thinking configuration
|
||||
sequential_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can break down complex problems.
|
||||
Use the available tools when relevant to perform step-by-step analysis.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-sequential-thinking")
|
||||
)
|
||||
|
||||
sequential_agent.start("Break down the process of making a cup of tea")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python sequential_thinking.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: "Slack MCP Integration"
|
||||
sidebarTitle: "Slack"
|
||||
description: "Guide for integrating Slack messaging capabilities with PraisonAI agents using MCP"
|
||||
icon: "slack"
|
||||
---
|
||||
|
||||
## Add Slack Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Slack MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#4A154B,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install praisonaiagents mcp
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Keys">
|
||||
Set your Slack credentials as environment variables in your terminal:
|
||||
```bash
|
||||
export SLACK_BOT_TOKEN=your_slack_bot_token_here
|
||||
export SLACK_TEAM_ID=your_slack_team_id_here
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `slack_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get Slack credentials from environment
|
||||
slack_token = os.getenv("SLACK_BOT_TOKEN")
|
||||
slack_team_id = os.getenv("SLACK_TEAM_ID")
|
||||
|
||||
# Use a single string command with Slack configuration
|
||||
slack_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Slack.
|
||||
Use the available tools when relevant to manage Slack communications.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-slack",
|
||||
env={
|
||||
"SLACK_BOT_TOKEN": slack_token,
|
||||
"SLACK_TEAM_ID": slack_team_id
|
||||
})
|
||||
)
|
||||
|
||||
slack_agent.start("Send a message to the general channel")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python slack_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- Slack Bot Token and Team ID
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
@@ -0,0 +1,248 @@
|
||||
---
|
||||
title: "MCP SSE Integration"
|
||||
sidebarTitle: "MCP SSE"
|
||||
description: "Guide for integrating Server-Sent Events (SSE) with PraisonAI agents using MCP"
|
||||
icon: "server"
|
||||
---
|
||||
|
||||
## Add SSE Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[SSE MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#4169E1,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Create a client file">
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You are a weather agent that can provide weather information for a given city.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("http://localhost:8080/sse")
|
||||
)
|
||||
|
||||
search_agent.start("What is the weather in London?")
|
||||
```
|
||||
|
||||
</Step>
|
||||
<Step title="Set Up SSE MCP Server">
|
||||
|
||||
```python
|
||||
# python mcp-sse-direct-server.py --host 127.0.0.1 --port 8080
|
||||
from typing import Any
|
||||
import httpx
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from starlette.applications import Starlette
|
||||
from mcp.server.sse import SseServerTransport
|
||||
from starlette.requests import Request
|
||||
from starlette.routing import Mount, Route
|
||||
from mcp.server import Server
|
||||
import uvicorn
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import inspect
|
||||
|
||||
# Set up logging based on environment variable
|
||||
log_level = os.environ.get("LOGLEVEL", "info").upper()
|
||||
logging.basicConfig(level=getattr(logging, log_level))
|
||||
logger = logging.getLogger("mcp-server")
|
||||
|
||||
# Initialize FastMCP server for simple tools (SSE)
|
||||
mcp = FastMCP("simple-tools")
|
||||
|
||||
@mcp.tool()
|
||||
async def get_greeting(name: str) -> str:
|
||||
"""Get a personalized greeting.
|
||||
|
||||
Args:
|
||||
name: Name of the person to greet
|
||||
"""
|
||||
logger.debug(f"get_greeting called with name: {name}")
|
||||
return f"Hello, {name}! Welcome to our MCP SSE server."
|
||||
|
||||
@mcp.tool()
|
||||
async def get_weather(city: str) -> str:
|
||||
"""Get a simulated weather report for a city.
|
||||
|
||||
Args:
|
||||
city: Name of the city
|
||||
"""
|
||||
logger.debug(f"get_weather called with city: {city}")
|
||||
# This is a mock implementation
|
||||
weather_data = {
|
||||
"Paris": "Sunny with a temperature of 22°C",
|
||||
"London": "Rainy with a temperature of 15°C",
|
||||
"New York": "Cloudy with a temperature of 18°C",
|
||||
"Tokyo": "Clear skies with a temperature of 25°C",
|
||||
"Sydney": "Partly cloudy with a temperature of 20°C"
|
||||
}
|
||||
|
||||
return weather_data.get(city, f"Weather data not available for {city}")
|
||||
|
||||
def create_starlette_app(mcp_server: Server, *, debug: bool = False) -> Starlette:
|
||||
"""Create a Starlette application that can serve the provided mcp server with SSE."""
|
||||
sse = SseServerTransport("/messages/")
|
||||
|
||||
async def handle_sse(request: Request) -> None:
|
||||
logger.debug(f"SSE connection request received from {request.client}")
|
||||
async with sse.connect_sse(
|
||||
request.scope,
|
||||
request.receive,
|
||||
request._send, # noqa: SLF001
|
||||
) as (read_stream, write_stream):
|
||||
await mcp_server.run(
|
||||
read_stream,
|
||||
write_stream,
|
||||
mcp_server.create_initialization_options(),
|
||||
)
|
||||
|
||||
return Starlette(
|
||||
debug=debug,
|
||||
routes=[
|
||||
Route("/sse", endpoint=handle_sse),
|
||||
Mount("/messages/", app=sse.handle_post_message),
|
||||
],
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp_server = mcp._mcp_server # noqa: WPS437
|
||||
|
||||
parser = argparse.ArgumentParser(description='Run MCP SSE-based server')
|
||||
parser.add_argument('--host', default='localhost', help='Host to bind to')
|
||||
parser.add_argument('--port', type=int, default=8080, help='Port to listen on')
|
||||
args = parser.parse_args()
|
||||
|
||||
print(f"Starting MCP SSE server on {args.host}:{args.port}")
|
||||
|
||||
# Hardcode the tool names since we know what they are
|
||||
tool_names = ["get_greeting", "get_weather"]
|
||||
print(f"Available tools: {', '.join(tool_names)}")
|
||||
|
||||
# Bind SSE request handling to MCP server
|
||||
starlette_app = create_starlette_app(mcp_server, debug=True)
|
||||
|
||||
uvicorn.run(starlette_app, host=args.host, port=args.port)
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have the required packages installed:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]" mcp starlette uvicorn httpx
|
||||
```
|
||||
</Step>
|
||||
<Step title="Export API Key">
|
||||
```bash
|
||||
export OPENAI_API_KEY="your_api_key"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Server and Agent">
|
||||
First, start the SSE server:
|
||||
```bash
|
||||
python mcp-sse-direct-server.py --host 127.0.0.1 --port 8080
|
||||
```
|
||||
|
||||
Then, in a new terminal, run the agent:
|
||||
```bash
|
||||
python weather_agent.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- MCP server dependencies
|
||||
</Note>
|
||||
|
||||
## Alternative LLM Integrations
|
||||
|
||||
### Using Groq with SSE
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
weather_agent = Agent(
|
||||
instructions="""You are a weather agent that can provide weather information for a given city.""",
|
||||
llm="groq/llama-3.2-90b-vision-preview",
|
||||
tools=MCP("http://localhost:8080/sse")
|
||||
)
|
||||
|
||||
weather_agent.start("What is the weather in London?")
|
||||
```
|
||||
|
||||
### Using Ollama with SSE
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
weather_agent = Agent(
|
||||
instructions="""You are a weather agent that can provide weather information for a given city.""",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("http://localhost:8080/sse")
|
||||
)
|
||||
|
||||
weather_agent.start("What is the weather in London? Use get_weather tool, city is the required parameter.")
|
||||
```
|
||||
|
||||
## Gradio UI Integration
|
||||
|
||||
Create a Gradio UI for your weather service:
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import gradio as gr
|
||||
|
||||
def get_weather_info(query):
|
||||
weather_agent = Agent(
|
||||
instructions="""You are a weather agent that can provide weather information for a given city.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("http://localhost:8080/sse")
|
||||
)
|
||||
|
||||
result = weather_agent.start(query)
|
||||
return f"## Weather Information\n\n{result}"
|
||||
|
||||
demo = gr.Interface(
|
||||
fn=get_weather_info,
|
||||
inputs=gr.Textbox(placeholder="What's the weather in London?"),
|
||||
outputs=gr.Markdown(),
|
||||
title="Weather MCP Agent",
|
||||
description="Ask about the weather in any major city:"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Real-time Updates" icon="bolt">
|
||||
Receive server-sent events in real-time from your AI agent.
|
||||
</Card>
|
||||
<Card title="Multi-Agent Support" icon="users">
|
||||
Combine SSE with other MCP tools for complex workflows.
|
||||
</Card>
|
||||
<Card title="Multiple LLM Options" icon="brain">
|
||||
Use with OpenAI, Groq, Ollama, or other supported LLMs.
|
||||
</Card>
|
||||
<Card title="Gradio UI" icon="window">
|
||||
Create user-friendly interfaces for your SSE integrations.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,153 @@
|
||||
---
|
||||
title: "Stock Price MCP Integration"
|
||||
sidebarTitle: "Stock Price"
|
||||
description: "Guide for integrating stock price retrieval capabilities with PraisonAI agents using MCP"
|
||||
icon: "chart-line"
|
||||
---
|
||||
|
||||
## Add Stock Price Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[Query] --> Agent[AI Agent]
|
||||
Agent --> Tool[Stock Price MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Answer]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#2E8B57,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Install Dependencies">
|
||||
Create a conda environment and install the required packages:
|
||||
```bash
|
||||
zsh -c "source $(conda info --base)/etc/profile.d/conda.sh && conda create -n windsurf python=3.10 -y"
|
||||
zsh -c "source $(conda info --base)/etc/profile.d/conda.sh && conda activate windsurf && pip install praisonaiagents mcp yfinance"
|
||||
```
|
||||
</Step>
|
||||
<Step title="Set API Key">
|
||||
Set your OpenAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create the MCP Server">
|
||||
Create a new file `stock_price_server.py` with the following code:
|
||||
```python
|
||||
import yfinance as yf
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("stock_prices")
|
||||
|
||||
@mcp.tool()
|
||||
async def get_stock_price(ticker: str) -> str:
|
||||
"""Get the current stock price for a given ticker symbol.
|
||||
|
||||
Args:
|
||||
ticker: Stock ticker symbol (e.g., AAPL, MSFT, GOOG)
|
||||
|
||||
Returns:
|
||||
Current stock price as a string
|
||||
"""
|
||||
if not ticker:
|
||||
return "No ticker provided"
|
||||
try:
|
||||
stock = yf.Ticker(ticker)
|
||||
info = stock.info
|
||||
current_price = info.get('currentPrice') or info.get('regularMarketPrice')
|
||||
if not current_price:
|
||||
return f"Could not retrieve price for {ticker}"
|
||||
return f"${current_price:.2f}"
|
||||
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport='stdio')
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create the Agent">
|
||||
Create a new file `stock_price_agent.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the path to your Python interpreter and the server file
|
||||
python_path = os.getenv("PYTHON_PATH", "/path/to/your/python")
|
||||
server_path = os.getenv("SERVER_PATH", "/path/to/your/stock_price_server.py")
|
||||
|
||||
# Create the agent with the stock price MCP tool
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP(f"{python_path} {server_path}")
|
||||
)
|
||||
|
||||
agent.start("What is the stock price of Tesla?")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
zsh -c "source $(conda info --base)/etc/profile.d/conda.sh && conda activate windsurf && python stock_price_agent.py"
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- yfinance package
|
||||
- mcp-python-sdk package
|
||||
- praisonaiagents package
|
||||
- OpenAI API key (for the agent's LLM)
|
||||
</Note>
|
||||
|
||||
## Gradio UI Example
|
||||
|
||||
You can also create a simple web UI for your stock price agent using Gradio:
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
import gradio as gr
|
||||
import os
|
||||
|
||||
# Get the path to your Python interpreter and the server file
|
||||
python_path = os.getenv("PYTHON_PATH", "/path/to/your/python")
|
||||
server_path = os.getenv("SERVER_PATH", "/path/to/your/stock_price_server.py")
|
||||
|
||||
# Create the agent with the stock price MCP tool
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP(f"{python_path} {server_path}")
|
||||
)
|
||||
|
||||
def chat(message, history):
|
||||
return agent.chat(message)
|
||||
|
||||
demo = gr.ChatInterface(
|
||||
chat,
|
||||
title="Stock Price Assistant",
|
||||
description="Ask about any stock price and get real-time information",
|
||||
theme="soft"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
```
|
||||
|
||||
Install Gradio with:
|
||||
```bash
|
||||
zsh -c "source $(conda info --base)/etc/profile.d/conda.sh && conda activate windsurf && pip install gradio"
|
||||
```
|
||||
@@ -0,0 +1,185 @@
|
||||
---
|
||||
title: "WhatsApp MCP Integration"
|
||||
sidebarTitle: "WhatsApp"
|
||||
description: "Guide for integrating WhatsApp messaging with PraisonAI agents using MCP"
|
||||
icon: "whatsapp"
|
||||
---
|
||||
|
||||
## Add WhatsApp Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[WhatsApp MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#25D366,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set Up WhatsApp MCP Server">
|
||||
Clone and set up the WhatsApp MCP server:
|
||||
```bash
|
||||
git clone https://github.com/lharries/whatsapp-mcp.git
|
||||
cd whatsapp-mcp
|
||||
cd whatsapp-bridge
|
||||
go run main.go
|
||||
```
|
||||
</Step>
|
||||
<Step title="Create a file">
|
||||
Create a new file `whatsapp_message.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="Whatsapp Agent",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
whatsapp_agent.start("Send Hello to Mervin Praison")
|
||||
```
|
||||
|
||||
Note: Replace `/path/to/whatsapp-mcp` with the actual path to your WhatsApp MCP server.
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have the required packages installed:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]" mcp gradio
|
||||
```
|
||||
</Step>
|
||||
<Step title="Export API Key">
|
||||
```bash
|
||||
export OPENAI_API_KEY="your_api_key"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python whatsapp_message.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- WhatsApp MCP server set up and configured
|
||||
</Note>
|
||||
|
||||
## Multi-Agent Integration
|
||||
|
||||
You can also combine WhatsApp with other MCP tools, such as Airbnb search:
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, Agents, MCP
|
||||
|
||||
airbnb_agent = Agent(
|
||||
instructions="""Search for Apartments in Paris for 2 nights on Airbnb. 04/28 - 04/30 for 2 adults""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="""Send AirBnb Search Result to 'Mervin Praison'""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
agents = Agents(agents=[airbnb_agent, whatsapp_agent])
|
||||
|
||||
agents.start()
|
||||
```
|
||||
|
||||
## Alternative LLM Integrations
|
||||
|
||||
### Using Groq with WhatsApp
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="Whatsapp Agent",
|
||||
llm="groq/llama-3.2-90b-vision-preview",
|
||||
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
whatsapp_agent.start("Send Hello to Mervin Praison")
|
||||
```
|
||||
|
||||
### Using Ollama with WhatsApp
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="Whatsapp Agent",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
whatsapp_agent.start("Send Hello to Mervin Praison. Use send_message tool, recipient and message are the required parameters.")
|
||||
```
|
||||
|
||||
## Gradio UI Integration
|
||||
|
||||
Create a Gradio UI for your WhatsApp and Airbnb integration:
|
||||
|
||||
```python
|
||||
from praisonaiagents import Agent, Agents, MCP
|
||||
import gradio as gr
|
||||
|
||||
def search_airbnb(query):
|
||||
airbnb_agent = Agent(
|
||||
instructions=query+" on Airbnb",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="""Send AirBnb Search Result to 'Mervin Praison'. Don't include Phone Number in Response, but include the AirBnb Search Result""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
agents = Agents(agents=[airbnb_agent, whatsapp_agent])
|
||||
|
||||
result = agents.start()
|
||||
return f"## Airbnb Search Results\n\n{result}"
|
||||
|
||||
demo = gr.Interface(
|
||||
fn=search_airbnb,
|
||||
inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."),
|
||||
outputs=gr.Markdown(),
|
||||
title="WhatsApp MCP Agent",
|
||||
description="Enter your booking requirements below:"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="WhatsApp Messaging" icon="message">
|
||||
Send messages to WhatsApp contacts directly from your AI agent.
|
||||
</Card>
|
||||
<Card title="Multi-Agent Support" icon="users">
|
||||
Combine WhatsApp with other MCP tools for complex workflows.
|
||||
</Card>
|
||||
<Card title="Multiple LLM Options" icon="brain">
|
||||
Use with OpenAI, Groq, Ollama, or other supported LLMs.
|
||||
</Card>
|
||||
<Card title="Gradio UI" icon="window">
|
||||
Create user-friendly interfaces for your WhatsApp integrations.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
title: "xAI MCP Integration"
|
||||
sidebarTitle: "xAI"
|
||||
description: "Guide for integrating XAI's Grok model with PraisonAI agents using MCP"
|
||||
icon: "robot"
|
||||
---
|
||||
|
||||
## Add XAI Tool to AI Agent
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
In[In] --> Agent[AI Agent]
|
||||
Agent --> Tool[Airbnb MCP]
|
||||
Tool --> Agent
|
||||
Agent --> Out[Out]
|
||||
|
||||
style In fill:#8B0000,color:#fff
|
||||
style Agent fill:#2E8B57,color:#fff
|
||||
style Tool fill:#FF5A5F,color:#fff
|
||||
style Out fill:#8B0000,color:#fff
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Steps>
|
||||
<Step title="Set API Key">
|
||||
Set your XAI API key as an environment variable in your terminal:
|
||||
```bash
|
||||
export XAI_API_KEY=your_xai_api_key_here
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Create a file">
|
||||
Create a new file `xai_airbnb.py` with the following code:
|
||||
```python
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="xai/grok-2-latest",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Install Dependencies">
|
||||
Make sure you have Node.js installed, as the MCP server requires it:
|
||||
```bash
|
||||
pip install "praisonaiagents[llm]"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the Agent">
|
||||
Execute your script:
|
||||
```bash
|
||||
python xai_airbnb.py
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Note>
|
||||
**Requirements**
|
||||
- Python 3.10 or higher
|
||||
- Node.js installed on your system
|
||||
- XAI API key (for the Grok model)
|
||||
</Note>
|
||||
|
||||
## Features
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Grok Integration" icon="robot">
|
||||
Uses XAI's Grok model for advanced natural language understanding.
|
||||
</Card>
|
||||
<Card title="MCP Integration" icon="plug">
|
||||
Seamless integration with Model Context Protocol.
|
||||
</Card>
|
||||
<Card title="Airbnb Search" icon="hotel">
|
||||
Search for accommodations on Airbnb with natural language queries.
|
||||
</Card>
|
||||
<Card title="NPM Package" icon="js">
|
||||
Leverages the official Airbnb MCP server package.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -75,6 +75,10 @@
|
||||
"name": "Tools",
|
||||
"url": "/tools"
|
||||
},
|
||||
{
|
||||
"name": "MCP",
|
||||
"url": "/mcp"
|
||||
},
|
||||
{
|
||||
"name": "JS",
|
||||
"url": "/js"
|
||||
@@ -230,6 +234,41 @@
|
||||
"agents/recommendation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "MCP",
|
||||
"pages": [
|
||||
"mcp/airbnb",
|
||||
"mcp/sse",
|
||||
"mcp/ollama",
|
||||
"mcp/groq",
|
||||
"mcp/openrouter",
|
||||
"mcp/xai",
|
||||
"mcp/openai",
|
||||
"mcp/anthropic",
|
||||
"mcp/gemini",
|
||||
"mcp/mistral",
|
||||
"mcp/whatsapp",
|
||||
"mcp/perplexity",
|
||||
"mcp/ollama-python",
|
||||
"mcp/bravesearch",
|
||||
"mcp/custom",
|
||||
"mcp/sequential-thinking",
|
||||
"mcp/filesystem",
|
||||
"mcp/github",
|
||||
"mcp/gdrive",
|
||||
"mcp/gitlab",
|
||||
"mcp/google-maps",
|
||||
"mcp/memory",
|
||||
"mcp/redis",
|
||||
"mcp/stockprice",
|
||||
"mcp/postgres",
|
||||
"mcp/puppeteer",
|
||||
"mcp/everart",
|
||||
"mcp/slack",
|
||||
"mcp/custom-python-client",
|
||||
"mcp/custom-python-server"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Tools",
|
||||
"pages": [
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "Auto Generation Mode"
|
||||
description: "Guide to PraisonAI's automatic agent generation feature, supporting both CrewAI and AutoGen frameworks for automated task execution"
|
||||
description: "Guide to PraisonAI's automatic agent generation feature, supporting both CrewAI and AG2 frameworks for automated task execution"
|
||||
icon: "robot"
|
||||
---
|
||||
|
||||
PraisonAI supports automatic agent generation with PraisonAI Agents, CrewAI and AutoGen frameworks.
|
||||
PraisonAI supports automatic agent generation with PraisonAI Agents, CrewAI and AG2 frameworks.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -17,7 +17,7 @@ pip install praisonai
|
||||
# For CrewAI
|
||||
pip install "praisonai[crewai]"
|
||||
|
||||
# For AutoGen
|
||||
# For AG2 (Formerly AutoGen)
|
||||
pip install "praisonai[autogen]"
|
||||
|
||||
# For both frameworks
|
||||
@@ -36,7 +36,7 @@ praisonai --auto "create a movie script about Dog in Moon"
|
||||
praisonai --framework crewai --auto "create a movie script about Dog in Moon"
|
||||
```
|
||||
|
||||
### With AutoGen
|
||||
### With AG2
|
||||
```bash
|
||||
praisonai --framework autogen --auto "create a movie script about Dog in Moon"
|
||||
```
|
||||
@@ -49,7 +49,7 @@ praisonai --framework autogen --auto "create a movie script about Dog in Moon"
|
||||
- Built-in tools integration
|
||||
- Structured agent-task relationships
|
||||
|
||||
### AutoGen
|
||||
### AG2 (Formerly AutoGen)
|
||||
- Multi-agent conversation capabilities
|
||||
- Code execution environment
|
||||
- Built-in tools integration
|
||||
|
||||
@@ -28,13 +28,13 @@ Includes:
|
||||
- Task delegation capabilities
|
||||
- Sequential and parallel task execution
|
||||
|
||||
### AutoGen Support
|
||||
### AG2 Support
|
||||
```bash
|
||||
pip install "praisonai[autogen]"
|
||||
```
|
||||
|
||||
Includes:
|
||||
- AutoGen framework
|
||||
- AG2 framework
|
||||
- PraisonAI tools integration
|
||||
- Multi-agent conversation capabilities
|
||||
- Code execution environment
|
||||
|
||||
@@ -21,7 +21,7 @@ icon: "hand-wave"
|
||||
Create and orchestrate sophisticated multi-agent systems with ease
|
||||
</Card>
|
||||
<Card title="Framework Integration" icon="puzzle-piece">
|
||||
Seamlessly integrates AutoGen and CrewAI capabilities
|
||||
Seamlessly integrates AG2 and CrewAI capabilities
|
||||
</Card>
|
||||
<Card title="Low-Code Design" icon="code">
|
||||
Build complex AI systems with minimal coding required
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "TL;DR"
|
||||
description: "Quick start guide for PraisonAI with CrewAI, AutoGen, and UI setup instructions"
|
||||
description: "Quick start guide for PraisonAI with CrewAI, AG2 (Formerly AutoGen), and UI setup instructions"
|
||||
icon: "bolt"
|
||||
---
|
||||
|
||||
@@ -32,10 +32,10 @@ praisonai --framework crewai --init "create a movie script about dog in moon"
|
||||
praisonai --framework crewai
|
||||
```
|
||||
|
||||
## Quick Start with AutoGen
|
||||
## Quick Start with AG2
|
||||
|
||||
```bash
|
||||
# Install with AutoGen support
|
||||
# Install with AG2 support
|
||||
pip install "praisonai[autogen]"
|
||||
|
||||
# Set your API key
|
||||
|
||||
@@ -71,7 +71,7 @@ To run the PraisonAI tool, simply type the following command in your terminal:
|
||||
praisonai
|
||||
```
|
||||
|
||||
If you want to run the `autogen` framework, use:
|
||||
If you want to run the AG2 framework (Formerly AutoGen), use:
|
||||
|
||||
```bash
|
||||
praisonai --framework autogen
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ icon: "comments"
|
||||
|
||||
| Interface | Description | URL |
|
||||
|---|---|---|
|
||||
| **UI** | Multi Agents such as CrewAI or AutoGen | [https://docs.praison.ai/ui/ui](https://docs.praison.ai/ui/ui) |
|
||||
| **UI** | Multi Agents such as CrewAI or AG2 | [https://docs.praison.ai/ui/ui](https://docs.praison.ai/ui/ui) |
|
||||
| **Chat** | Chat with 100+ LLMs, single AI Agent | [https://docs.praison.ai/ui/chat](https://docs.praison.ai/ui/chat) |
|
||||
| **Code** | Chat with entire Codebase, single AI Agent | [https://docs.praison.ai/ui/code](https://docs.praison.ai/ui/code) |
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ PraisonAI Code helps you to interact with your whole codebase using the power of
|
||||
|
||||
| Interface | Description | URL |
|
||||
|---|---|---|
|
||||
| **UI** | Multi Agents such as CrewAI or AutoGen | [https://docs.praison.ai/ui/ui](https://docs.praison.ai/ui/ui) |
|
||||
| **UI** | Multi Agents such as CrewAI or AG2 | [https://docs.praison.ai/ui/ui](https://docs.praison.ai/ui/ui) |
|
||||
| **Chat** | Chat with 100+ LLMs, single AI Agent | [https://docs.praison.ai/ui/chat](https://docs.praison.ai/ui/chat) |
|
||||
| **Code** | Chat with entire Codebase, single AI Agent | [https://docs.praison.ai/ui/code](https://docs.praison.ai/ui/code) |
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ icon: "browser"
|
||||
|---|---|---|
|
||||
| **Streamlit** | Create interactive web apps with Python | [https://docs.praison.ai/ui/streamlit](/ui/streamlit) |
|
||||
| **Gradio** | Build machine learning web apps rapidly | [https://docs.praison.ai/ui/gradio](/ui/gradio) |
|
||||
| **UI** | Multi Agents such as CrewAI or AutoGen | [https://docs.praison.ai/ui/ui](/ui/ui) |
|
||||
| **UI** | Multi Agents such as CrewAI or AG2 | [https://docs.praison.ai/ui/ui](/ui/ui) |
|
||||
| **Chat** | Chat with 100+ LLMs, single AI Agent | [https://docs.praison.ai/ui/chat](/ui/chat) |
|
||||
| **Code** | Chat with entire Codebase, single AI Agent | [https://docs.praison.ai/ui/code](/ui/code) |
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="anthropic/claude-3-7-sonnet-20250219",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,22 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get AWS credentials from environment
|
||||
aws_access_key = os.getenv("AWS_ACCESS_KEY_ID")
|
||||
aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY")
|
||||
aws_region = os.getenv("AWS_REGION")
|
||||
|
||||
# Use a single string command with AWS KB Retrieval configuration
|
||||
aws_kb_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with AWS Knowledge Base.
|
||||
Use the available tools when relevant to retrieve and process AWS information.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-aws-kb-retrieval",
|
||||
env={
|
||||
"AWS_ACCESS_KEY_ID": aws_access_key,
|
||||
"AWS_SECRET_ACCESS_KEY": aws_secret_key,
|
||||
"AWS_REGION": aws_region
|
||||
})
|
||||
)
|
||||
|
||||
aws_kb_agent.start("Search AWS documentation about EC2 instances")
|
||||
@@ -0,0 +1,15 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API key from environment or set it directly
|
||||
brave_api_key = os.getenv("BRAVE_API_KEY")
|
||||
|
||||
# Use a single string command with environment variables
|
||||
search_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("npx -y @modelcontextprotocol/server-brave-search", env={"BRAVE_API_KEY": brave_api_key})
|
||||
)
|
||||
|
||||
search_agent.start("Search more information about AI News")
|
||||
@@ -0,0 +1,13 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools = MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/app.py")
|
||||
)
|
||||
|
||||
# NOTE: Python Path replace with yours: /Users/praison/miniconda3/envs/mcp/bin/python
|
||||
# NOTE: app.py file path, replace it with yours: /Users/praison/stockprice/app.py
|
||||
|
||||
agent.start("What is the stock price of Tesla?")
|
||||
@@ -0,0 +1,30 @@
|
||||
import yfinance as yf
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("stock_prices")
|
||||
|
||||
@mcp.tool()
|
||||
async def get_stock_price(ticker: str) -> str:
|
||||
"""Get the current stock price for a given ticker symbol.
|
||||
|
||||
Args:
|
||||
ticker: Stock ticker symbol (e.g., AAPL, MSFT, GOOG)
|
||||
|
||||
Returns:
|
||||
Current stock price as a string
|
||||
"""
|
||||
if not ticker:
|
||||
return "No ticker provided"
|
||||
try:
|
||||
stock = yf.Ticker(ticker)
|
||||
info = stock.info
|
||||
current_price = info.get('currentPrice') or info.get('regularMarketPrice')
|
||||
if not current_price:
|
||||
return f"Could not retrieve price for {ticker}"
|
||||
return f"${current_price:.2f}"
|
||||
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport='stdio')
|
||||
@@ -0,0 +1,15 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Databutton API key
|
||||
databutton_api_key = os.getenv("DATABUTTON_API_KEY")
|
||||
|
||||
# Create databutton agent
|
||||
databutton_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Databutton.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("uvx databutton-app-mcp@latest", env={"DATABUTTON_API_KEY": databutton_api_key})
|
||||
)
|
||||
|
||||
databutton_agent.start("Get the current stock price for AAPL, Tesla, and Amazon")
|
||||
@@ -0,0 +1,16 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get Everart API key from environment
|
||||
everart_api_key = os.getenv("EVERART_API_KEY")
|
||||
|
||||
# Use a single string command with Everart configuration
|
||||
everart_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Everart.
|
||||
Use the available tools when relevant to generate and manage art.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-everart",
|
||||
env={"EVERART_API_KEY": everart_api_key})
|
||||
)
|
||||
|
||||
everart_agent.start("Generate an artistic image of a sunset")
|
||||
@@ -0,0 +1,13 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# pip install mcp-server-fetch
|
||||
# Use a single string command with Fetch configuration
|
||||
fetch_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can fetch and process web content.
|
||||
Use the available tools when relevant to retrieve and convert web pages to markdown.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python -m mcp_server_fetch")
|
||||
)
|
||||
|
||||
fetch_agent.start("Fetch and convert the content from https://example.com to markdown")
|
||||
@@ -0,0 +1,18 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Define allowed directories for filesystem access
|
||||
allowed_dirs = [
|
||||
"/Users/username/Desktop",
|
||||
"/path/to/other/allowed/dir"
|
||||
]
|
||||
|
||||
# Use a single string command with allowed directories
|
||||
filesystem_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with the filesystem.
|
||||
Use the available tools when relevant to manage files and directories.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-filesystem", args=allowed_dirs)
|
||||
)
|
||||
|
||||
filesystem_agent.start("List files in the allowed directories")
|
||||
@@ -0,0 +1,16 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the credentials path from environment
|
||||
gdrive_credentials = os.getenv("GDRIVE_CREDENTIALS_PATH", "servers/gcp-oauth.keys.json")
|
||||
|
||||
# Use a single string command with Google Drive configuration
|
||||
gdrive_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Google Drive.
|
||||
Use the available tools when relevant to manage files and folders.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-gdrive",
|
||||
env={"GDRIVE_CREDENTIALS_PATH": gdrive_credentials})
|
||||
)
|
||||
|
||||
gdrive_agent.start("List files in my Google Drive")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gemini/gemini-2.5-pro-exp-03-25",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,23 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# pip install mcp-server-git
|
||||
# Get Git credentials from environment
|
||||
git_username = os.getenv("GIT_USERNAME")
|
||||
git_email = os.getenv("GIT_EMAIL")
|
||||
git_token = os.getenv("GIT_TOKEN") # For private repos
|
||||
|
||||
# Use a single string command with Git configuration
|
||||
git_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can perform Git operations.
|
||||
Use the available tools when relevant to manage repositories, commits, and branches.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python -m mcp_server_git",
|
||||
env={
|
||||
"GIT_USERNAME": git_username,
|
||||
"GIT_EMAIL": git_email,
|
||||
"GIT_TOKEN": git_token
|
||||
})
|
||||
)
|
||||
|
||||
git_agent.start("Clone and analyze the repository at https://github.com/modelcontextprotocol/servers")
|
||||
@@ -0,0 +1,15 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API key from environment or set it directly
|
||||
github_token = os.getenv("GITHUB_PERSONAL_ACCESS_TOKEN")
|
||||
|
||||
# Use a single string command with environment variables
|
||||
github_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with GitHub.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-github", env={"GITHUB_PERSONAL_ACCESS_TOKEN": github_token})
|
||||
)
|
||||
|
||||
github_agent.start("List my GitHub repositories")
|
||||
@@ -0,0 +1,20 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API token and URL from environment or set directly
|
||||
gitlab_token = os.getenv("GITLAB_PERSONAL_ACCESS_TOKEN")
|
||||
gitlab_api_url = os.getenv("GITLAB_API_URL", "https://gitlab.com/api/v4")
|
||||
|
||||
# Use a single string command with environment variables
|
||||
gitlab_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with GitLab.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-gitlab",
|
||||
env={
|
||||
"GITLAB_PERSONAL_ACCESS_TOKEN": gitlab_token,
|
||||
"GITLAB_API_URL": gitlab_api_url
|
||||
})
|
||||
)
|
||||
|
||||
gitlab_agent.start("List my GitLab projects")
|
||||
@@ -0,0 +1,16 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the API key from environment
|
||||
maps_api_key = os.getenv("GOOGLE_MAPS_API_KEY")
|
||||
|
||||
# Use a single string command with Google Maps configuration
|
||||
maps_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Google Maps.
|
||||
Use the available tools when relevant to handle location-based queries.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-google-maps",
|
||||
env={"GOOGLE_MAPS_API_KEY": maps_api_key})
|
||||
)
|
||||
|
||||
maps_agent.start("Find nearby restaurants in London")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="groq/llama-3.2-90b-vision-preview",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,16 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get the memory file path from environment
|
||||
memory_file_path = os.getenv("MEMORY_FILE_PATH", "/path/to/custom/memory.json")
|
||||
|
||||
# Use a single string command with Memory configuration
|
||||
memory_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can store and retrieve information.
|
||||
Use the available tools when relevant to manage memory operations.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-memory",
|
||||
env={"MEMORY_FILE_PATH": memory_file_path})
|
||||
)
|
||||
|
||||
memory_agent.start("Store this conversation in memory")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="mistral/mistral-large-latest",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,12 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
stock_agent = Agent(
|
||||
instructions="""You are a Stock Price Assistant.""",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/app.py")
|
||||
)
|
||||
|
||||
# NOTE: Python Path replace with yours: /Users/praison/miniconda3/envs/mcp/bin/python
|
||||
# NOTE: app.py file path, replace it with yours: /Users/praison/stockprice/app.py
|
||||
|
||||
stock_agent.start("What is the Stock Price of Apple?")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="openrouter/google/gemini-2.0-flash-exp:free",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,14 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
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)
|
||||
@@ -0,0 +1,15 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# PostgreSQL connection string
|
||||
postgres_url = "postgresql://localhost/mydb"
|
||||
|
||||
# Use a single string command with PostgreSQL configuration
|
||||
postgres_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with PostgreSQL databases.
|
||||
Use the available tools when relevant to manage database operations.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-postgres", args=[postgres_url])
|
||||
)
|
||||
|
||||
postgres_agent.start("List all tables in the database")
|
||||
@@ -0,0 +1,12 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use a single string command with Puppeteer configuration
|
||||
puppeteer_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can automate web browser interactions.
|
||||
Use the available tools when relevant to perform web automation tasks.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-puppeteer")
|
||||
)
|
||||
|
||||
puppeteer_agent.start("Navigate to example.com and take a screenshot")
|
||||
@@ -0,0 +1,15 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Redis connection string
|
||||
redis_url = "redis://localhost:6379"
|
||||
|
||||
# Use a single string command with Redis configuration
|
||||
redis_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Redis.
|
||||
Use the available tools when relevant to manage Redis operations.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-redis", args=[redis_url])
|
||||
)
|
||||
|
||||
redis_agent.start("Set a key-value pair in Redis")
|
||||
@@ -0,0 +1,16 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# pip install mcp-server-sentry
|
||||
# Get Sentry auth token from environment
|
||||
sentry_token = os.getenv("SENTRY_AUTH_TOKEN")
|
||||
|
||||
# Use a single string command with Sentry configuration
|
||||
sentry_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can analyze Sentry error reports.
|
||||
Use the available tools when relevant to inspect and debug application issues.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python -m mcp_server_sentry --auth-token", args=[sentry_token])
|
||||
)
|
||||
|
||||
sentry_agent.start("Analyze the most recent critical error in Sentry")
|
||||
@@ -0,0 +1,12 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use a single string command with Sequential Thinking configuration
|
||||
sequential_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can break down complex problems.
|
||||
Use the available tools when relevant to perform step-by-step analysis.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-sequential-thinking")
|
||||
)
|
||||
|
||||
sequential_agent.start("Break down the process of making a cup of tea")
|
||||
@@ -0,0 +1,20 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Get Slack credentials from environment
|
||||
slack_token = os.getenv("SLACK_BOT_TOKEN")
|
||||
slack_team_id = os.getenv("SLACK_TEAM_ID")
|
||||
|
||||
# Use a single string command with Slack configuration
|
||||
slack_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can interact with Slack.
|
||||
Use the available tools when relevant to manage Slack communications.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-slack",
|
||||
env={
|
||||
"SLACK_BOT_TOKEN": slack_token,
|
||||
"SLACK_TEAM_ID": slack_team_id
|
||||
})
|
||||
)
|
||||
|
||||
slack_agent.start("Send a message to the general channel")
|
||||
@@ -0,0 +1,13 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# pip install mcp-server-time
|
||||
# Use a single string command with Time Server configuration
|
||||
time_agent = Agent(
|
||||
instructions="""You are a helpful assistant that can handle time-related operations.
|
||||
Use the available tools when relevant to manage timezone conversions and time information.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python -m mcp_server_time --local-timezone=America/New_York")
|
||||
)
|
||||
|
||||
time_agent.start("Get the current time in New York and convert it to UTC")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="Whatsapp Agent",
|
||||
llm="groq/llama-3.2-90b-vision-preview",
|
||||
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
whatsapp_agent.start("Send Hello to Mervin Praison")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="Whatsapp Agent",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
whatsapp_agent.start("Send Hello to Mervin Praison")
|
||||
@@ -0,0 +1,17 @@
|
||||
from praisonaiagents import Agent, Agents, MCP
|
||||
|
||||
airbnb_agent = Agent(
|
||||
instructions="""Search for Apartments in Paris for 2 nights on Airbnb. 04/28 - 04/30 for 2 adults""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="""Send AirBnb Search Result to 'Mervin Praison'""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
agents = Agents(agents=[airbnb_agent, whatsapp_agent])
|
||||
|
||||
agents.start()
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="Whatsapp Agent",
|
||||
llm="ollama/llama3.2",
|
||||
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
whatsapp_agent.start("Send Hello to Mervin Praison. Use send_message tool, recipient and message are the required parameters.")
|
||||
@@ -0,0 +1,31 @@
|
||||
from praisonaiagents import Agent, Agents, MCP
|
||||
import gradio as gr
|
||||
|
||||
def search_airbnb(query):
|
||||
airbnb_agent = Agent(
|
||||
instructions=query+" on Airbnb",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
whatsapp_agent = Agent(
|
||||
instructions="""Send AirBnb Search Result to 'Mervin Praison'. Don't include Phone Number in Response, but include the AirBnb Search Result""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("python /Users/praison/whatsapp-mcp/whatsapp-mcp-server/main.py")
|
||||
)
|
||||
|
||||
agents = Agents(agents=[airbnb_agent, whatsapp_agent])
|
||||
|
||||
result = agents.start()
|
||||
return f"## Airbnb Search Results\n\n{result}"
|
||||
|
||||
demo = gr.Interface(
|
||||
fn=search_airbnb,
|
||||
inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."),
|
||||
outputs=gr.Markdown(),
|
||||
title="WhatsApp MCP Agent",
|
||||
description="Enter your booking requirements below:"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.launch()
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="xai/grok-2-latest",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
Generated
+9735
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -3,7 +3,7 @@ class Praisonai < Formula
|
||||
|
||||
desc "AI tools for various AI applications"
|
||||
homepage "https://github.com/MervinPraison/PraisonAI"
|
||||
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.81.tar.gz"
|
||||
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.1.1.tar.gz"
|
||||
sha256 "1828fb9227d10f991522c3f24f061943a254b667196b40b1a3e4a54a8d30ce32" # Replace with actual SHA256 checksum
|
||||
license "MIT"
|
||||
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ class CloudDeployer:
|
||||
file.write("FROM python:3.11-slim\n")
|
||||
file.write("WORKDIR /app\n")
|
||||
file.write("COPY . .\n")
|
||||
file.write("RUN pip install flask praisonai==2.0.81 gunicorn markdown\n")
|
||||
file.write("RUN pip install flask praisonai==2.1.1 gunicorn markdown\n")
|
||||
file.write("EXPOSE 8080\n")
|
||||
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Only try to import autogen_tools if either CrewAI or AutoGen is available
|
||||
# Only try to import autogen_tools if either CrewAI or AG2 is available
|
||||
CREWAI_AVAILABLE = False
|
||||
AUTOGEN_AVAILABLE = False
|
||||
PRAISONAI_TOOLS_AVAILABLE = False
|
||||
|
||||
+6
-4
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "PraisonAI"
|
||||
version = "2.0.81"
|
||||
version = "2.1.1"
|
||||
description = "PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration."
|
||||
readme = "README.md"
|
||||
license = ""
|
||||
@@ -12,10 +12,11 @@ dependencies = [
|
||||
"rich>=13.7",
|
||||
"markdown>=3.5",
|
||||
"pyparsing>=3.0.0",
|
||||
"praisonaiagents>=0.0.67",
|
||||
"praisonaiagents>=0.0.71",
|
||||
"python-dotenv>=0.19.0",
|
||||
"instructor>=1.3.3",
|
||||
"PyYAML>=6.0",
|
||||
"mcp==1.6.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
@@ -84,7 +85,7 @@ autogen = ["pyautogen>=0.2.19", "praisonai-tools>=0.0.7", "crewai"]
|
||||
|
||||
[tool.poetry]
|
||||
name = "PraisonAI"
|
||||
version = "2.0.81"
|
||||
version = "2.1.1"
|
||||
description = "PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human–agent collaboration."
|
||||
authors = ["Mervin Praison"]
|
||||
license = ""
|
||||
@@ -102,10 +103,11 @@ python = ">=3.10,<3.13"
|
||||
rich = ">=13.7"
|
||||
markdown = ">=3.5"
|
||||
pyparsing = ">=3.0.0"
|
||||
praisonaiagents = ">=0.0.67"
|
||||
praisonaiagents = ">=0.0.71"
|
||||
python-dotenv = ">=0.19.0"
|
||||
instructor = ">=1.3.3"
|
||||
PyYAML = ">=6.0"
|
||||
mcp = "==1.6.0"
|
||||
pyautogen = {version = ">=0.2.19", optional = true}
|
||||
crewai = {version = ">=0.32.0", optional = true}
|
||||
praisonai-tools = {version = ">=0.0.7", optional = true}
|
||||
|
||||
@@ -12,7 +12,7 @@ print_message() {
|
||||
print_usage() {
|
||||
echo "Usage: $0 [-u|--ui] [-c|--chat] [-d|--code] [-r|--realtime] [-a|--all] [--run] [--quick] [--model MODEL] [--base URL]"
|
||||
echo "Options:"
|
||||
echo " -u, --ui Install UI dependencies for Multi Agents (CrewAI/AutoGen)"
|
||||
echo " -u, --ui Install UI dependencies for Multi Agents (CrewAI/AG2)"
|
||||
echo " -c, --chat Install Chat interface for single AI Agent"
|
||||
echo " -d, --code Install Code interface for codebase interaction"
|
||||
echo " -r, --realtime Install Realtime voice interaction interface"
|
||||
@@ -97,8 +97,8 @@ run_ui_interface() {
|
||||
if [ -z "$prompt" ]; then
|
||||
prompt="create a movie script about dog in moon"
|
||||
fi
|
||||
read -p "Use AutoGen framework? (y/N): " use_autogen
|
||||
if [[ $use_autogen =~ ^[Yy]$ ]]; then
|
||||
read -p "Use AG2 (Formerly AutoGen) framework? (y/N): " use_ag2
|
||||
if [[ $use_ag2 =~ ^[Yy]$ ]]; then
|
||||
praisonai --framework autogen --init "$prompt"
|
||||
else
|
||||
praisonai --init "$prompt"
|
||||
|
||||
@@ -84,4 +84,5 @@ build
|
||||
*.mp4
|
||||
*.png
|
||||
graph.py
|
||||
chroma_db/
|
||||
chroma_db/
|
||||
.qodo
|
||||
@@ -0,0 +1,83 @@
|
||||
# MCP SSE Server and Client Implementation
|
||||
|
||||
This project demonstrates a working pattern for SSE-based MCP (Model Context Protocol) servers and clients. It consists of three main components:
|
||||
|
||||
1. **server.py**: An SSE-based MCP server that provides simple tools
|
||||
2. **client.py**: A standalone client that connects to the server and uses its tools with Claude
|
||||
3. **mcp-sse.py**: A client using praisonaiagents that connects to the server and uses its tools with OpenAI
|
||||
|
||||
## Tools Provided by the Server
|
||||
|
||||
The server implements two simple tools:
|
||||
|
||||
- **get_greeting**: Returns a personalized greeting for a given name
|
||||
- **get_weather**: Returns simulated weather data for a given city
|
||||
|
||||
## Setup and Usage
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Make sure you have the required packages installed:
|
||||
|
||||
```bash
|
||||
pip install praisonaiagents mcp httpx starlette uvicorn anthropic python-dotenv
|
||||
```
|
||||
|
||||
### Running the Server
|
||||
|
||||
First, start the MCP SSE server:
|
||||
|
||||
```bash
|
||||
python server.py
|
||||
```
|
||||
|
||||
By default, the server runs on 0.0.0.0:8080, but you can customize the host and port:
|
||||
|
||||
```bash
|
||||
python server.py --host 127.0.0.1 --port 8081
|
||||
```
|
||||
|
||||
### Running the Standalone Client
|
||||
|
||||
The standalone client uses Claude to interact with the MCP server tools:
|
||||
|
||||
```bash
|
||||
# Set your Anthropic API key
|
||||
export ANTHROPIC_API_KEY=your_api_key_here
|
||||
|
||||
# Run the client
|
||||
python client.py http://0.0.0.0:8080/sse
|
||||
```
|
||||
|
||||
You'll see a prompt where you can type queries for Claude to process using the MCP tools.
|
||||
|
||||
### Running the praisonaiagents Client
|
||||
|
||||
The praisonaiagents client uses OpenAI to interact with the MCP server tools:
|
||||
|
||||
```bash
|
||||
# Set your OpenAI API key
|
||||
export OPENAI_API_KEY=your_api_key_here
|
||||
|
||||
# Run the client
|
||||
python mcp-sse.py
|
||||
```
|
||||
|
||||
This will automatically send a query about the weather in Paris to the agent.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. The server exposes MCP tools via an SSE endpoint
|
||||
2. Clients connect to this endpoint and discover available tools
|
||||
3. When a user makes a query, the client:
|
||||
- For client.py: Uses Claude to determine which tool to call
|
||||
- For mcp-sse.py: Uses OpenAI to determine which tool to call
|
||||
4. The client executes the tool call against the server
|
||||
5. The result is returned to the user
|
||||
|
||||
This pattern allows for decoupled processes where the MCP server can run independently of clients, making it suitable for cloud-native applications.
|
||||
|
||||
## Customizing
|
||||
|
||||
- To add more tools to the server, define new functions with the `@mcp.tool()` decorator in `server.py`
|
||||
- To change the client's behavior, update the instructions and query in `mcp-sse.py`
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="groq/llama-3.2-90b-vision-preview",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("MUST USE airbnb_search Tool to Search. Search for Apartments in Paris for 2 nights. 04/28 - 04/30 for 2 adults. All Your Preference")
|
||||
@@ -0,0 +1,12 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
brave_api_key = os.getenv("BRAVE_API_KEY")
|
||||
|
||||
research_agent = Agent(
|
||||
instructions="Research Agent",
|
||||
llm="groq/meta-llama/llama-4-scout-17b-16e-instruct",
|
||||
tools=MCP("npx -y @modelcontextprotocol/server-brave-search", env={"BRAVE_API_KEY": brave_api_key})
|
||||
)
|
||||
|
||||
research_agent.start("What is the latest research on the topic of AI and its impact on society?")
|
||||
@@ -0,0 +1,9 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
|
||||
@@ -0,0 +1,15 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
# Use the API key from environment or set it directly
|
||||
brave_api_key = os.getenv("BRAVE_API_KEY")
|
||||
|
||||
# Use a single string command with environment variables
|
||||
search_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("npx -y @modelcontextprotocol/server-brave-search", env={"BRAVE_API_KEY": brave_api_key})
|
||||
)
|
||||
|
||||
search_agent.start("Search more information about AI News")
|
||||
@@ -1,24 +1,18 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
import os
|
||||
|
||||
brave_api_key = os.getenv("BRAVE_API_KEY")
|
||||
|
||||
# Pass the environment variable directly to the MCP server
|
||||
search_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(
|
||||
command="npx",
|
||||
args=[
|
||||
"-y",
|
||||
"@smithery/cli@latest",
|
||||
"install",
|
||||
"@smithery-ai/brave-search",
|
||||
"--client",
|
||||
"claude",
|
||||
"--config",
|
||||
'{"braveApiKey":"BSANfDaqLKO9wq7e08mrPth9ZlJvKtc"}'
|
||||
],
|
||||
timeout=30, # 3 minutes for brave-search
|
||||
debug=True # Enable detailed logging
|
||||
args=["-y", "@modelcontextprotocol/server-brave-search"],
|
||||
env={"BRAVE_API_KEY": brave_api_key}
|
||||
)
|
||||
)
|
||||
|
||||
search_agent.start("Search more information about Praison AI")
|
||||
search_agent.start("Search more information about AI News")
|
||||
@@ -0,0 +1,18 @@
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
instructions="""You help book apartments on Airbnb.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
|
||||
)
|
||||
|
||||
search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
|
||||
|
||||
agent = Agent(
|
||||
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
|
||||
Use the available tools when relevant to answer user questions.""",
|
||||
llm="gpt-4o-mini",
|
||||
tools = MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/app.py")
|
||||
)
|
||||
|
||||
agent.start("What is the stock price of Tesla?")
|
||||
Loaded 100 of 121 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user