diff --git a/examples/tools/langchain/brave-search.py b/examples/tools/langchain/brave-search.py new file mode 100644 index 000000000..14d0fdb2f --- /dev/null +++ b/examples/tools/langchain/brave-search.py @@ -0,0 +1,18 @@ +# pip install langchain-community +# export BRAVE_SEARCH_API=your_api_key_here +# export OPENAI_API_KEY=your_api_key_here + +from praisonaiagents import Agent, PraisonAIAgents +from langchain_community.tools import BraveSearch +import os + +def search_brave(query: str): + """Searches using BraveSearch and returns results.""" + api_key = os.environ['BRAVE_SEARCH_API'] + tool = BraveSearch.from_api_key(api_key=api_key, search_kwargs={"count": 3}) + return tool.run(query) + +data_agent = Agent(instructions="Search about AI job trends in 2025", tools=[search_brave]) +editor_agent = Agent(instructions="Write a blog article") +agents = PraisonAIAgents(agents=[data_agent, editor_agent]) +agents.start() \ No newline at end of file diff --git a/examples/tools/langchain/google-trends.py b/examples/tools/langchain/google-trends.py new file mode 100644 index 000000000..32ba7ebd8 --- /dev/null +++ b/examples/tools/langchain/google-trends.py @@ -0,0 +1,18 @@ +# pip install langchain-community google-search-results +# export SERPAPI_API_KEY=your_api_key_here +# export OPENAI_API_KEY=your_api_key_here + +from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper +from praisonaiagents import Agent, PraisonAIAgents + +research_agent = Agent( + instructions="Research trending topics related to AI", + tools=[GoogleTrendsAPIWrapper] +) + +summarise_agent = Agent( + instructions="Summarise findings from the research agent", +) + +agents = PraisonAIAgents(agents=[research_agent, summarise_agent]) +agents.start() \ No newline at end of file diff --git a/examples/tools/langchain/serp-api.py b/examples/tools/langchain/serp-api.py new file mode 100644 index 000000000..230a2901e --- /dev/null +++ b/examples/tools/langchain/serp-api.py @@ -0,0 +1,12 @@ +# pip install langchain-community google-search-results +# export SERPAPI_API_KEY=your_api_key_here +# export OPENAI_API_KEY=your_api_key_here + +from praisonaiagents import Agent, PraisonAIAgents +from langchain_community.utilities import SerpAPIWrapper + +data_agent = Agent(instructions="Search about AI job trends in 2025", tools=[SerpAPIWrapper]) +editor_agent = Agent(instructions="Write a blog article") + +agents = PraisonAIAgents(agents=[data_agent, editor_agent]) +agents.start() \ No newline at end of file