Quick Start

1

Install Package

First, install the required packages:

pip install praisonaiagents langchain-community wikipedia youtube-search
2

Set API Key

Set your OpenAI API key as an environment variable in your terminal:

export OPENAI_API_KEY=your_api_key_here
3

Create a file

Create a new file app.py with the basic setup:

4

Start Agents

Type this in your terminal to run your agents:

python app.py

Requirements

  • Python 3.10 or higher
  • OpenAI API key. Generate OpenAI API key here
  • LangChain compatible tools and utilities

Understanding LangChain Integration

What is LangChain Integration?

LangChain integration enables agents to:

  • Use LangChain’s extensive tool ecosystem
  • Access various data sources and APIs
  • Leverage pre-built utilities and wrappers
  • Combine multiple tools in a single agent
  • Extend agent capabilities with community tools

Features

Tool Integration

Seamlessly use LangChain tools with PraisonAI agents.

Multiple Sources

Access various data sources through LangChain utilities.

Community Tools

Leverage the extensive LangChain community ecosystem.

Custom Tools

Create and integrate custom LangChain tools.

LangChain Tools with Wrappers

  • LangChain tools with wrappers can be directly used as Tools without modification.
  • PraisonAI will automatically detect the tool and use it.
  • Some exceptions apply where it doesn’t work.

Example Wrapper Usage

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()

Example without Wrapper Usage

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()

Next Steps

For optimal results, ensure all required dependencies are installed and API keys are properly configured for each tool.

With More Detailed Instructions

1

Install Package

First, install the required packages:

pip install praisonaiagents langchain-community wikipedia
2

Set API Key

Set your OpenAI API key as an environment variable in your terminal:

export OPENAI_API_KEY=your_api_key_here
3

Create a file

Create a new file app.py with the basic setup:

4

Start Agents

Type this in your terminal to run your agents:

python app.py

Was this page helpful?