Skip to main content
Use LangChain community tools and utilities directly on PraisonAI agents — no adapter layer required.
from praisonaiagents import Agent
from langchain_community.utilities import WikipediaAPIWrapper

wiki = WikipediaAPIWrapper()
agent = Agent(name="Researcher", tools=[wiki.run], instructions="Answer with Wikipedia")
agent.start("Summarise quantum computing in two paragraphs")
The user asks a research question; LangChain tools run inside the PraisonAI agent loop.

How It Works

Quick Start

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="${OPENAI_API_KEY:?Set OPENAI_API_KEY in your shell}"
3

Create a file

Create a new file app.py with the basic setup:
from praisonaiagents import Agent, Task, AgentTeam
from langchain_community.utilities import WikipediaAPIWrapper

# Create an agent with Wikipedia tool
agent = Agent(
    name="WikiAgent",
    role="Research Assistant",
    goal="Search Wikipedia for accurate information",
    backstory="I am an AI assistant specialized in Wikipedia research",
    tools=[WikipediaAPIWrapper],
    reflection=False
)

# Create a research task
task = Task(
    name="wiki_search",
    description="Research 'Artificial Intelligence' on Wikipedia",
    expected_output="Comprehensive information from Wikipedia articles",
    agent=agent
)

# Create and start the workflow
agents = AgentTeam(
    agents=[agent],
    tasks=[task]
)

agents.start()
from praisonaiagents import Agent, Task, AgentTeam
from langchain_community.tools import YouTubeSearchTool
from langchain_community.utilities import WikipediaAPIWrapper

# Create YouTube search agent
agent = Agent(
    name="SearchAgent",
    role="Research Assistant",
    goal="Search for information from YouTube",
    backstory="I am an AI assistant that can search YouTube for relevant videos.",
    tools=[YouTubeSearchTool],
    reflection=False
)

# Create Wikipedia research agent
agent2 = Agent(
    name="WikiAgent",
    role="Research Assistant",
    goal="Search for information from Wikipedia",
    backstory="I am an AI assistant that can search Wikipedia for accurate information.",
    tools=[WikipediaAPIWrapper],
    reflection=False
)

# Create YouTube search task
task = Task(
    name="search_task",
    description="Search for information about 'AI advancements' on YouTube",
    expected_output="Relevant information from YouTube videos",
    agent=agent
)

# Create Wikipedia research task
task2 = Task(
    name="wiki_task",
    description="Search for information about 'AI advancements' on Wikipedia",
    expected_output="Comprehensive information from Wikipedia articles",
    agent=agent2
)

# Create and start the workflow
agents = AgentTeam(
    agents=[agent, agent2],
    tasks=[task, task2]
)

agents.start()
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.

Best Practices

Each LangChain utility pulls its own deps — install langchain-community plus any package the tool needs (e.g. wikipedia for WikipediaAPIWrapper).
Set reflection=False on agents that call external tools frequently — reflection adds an extra LLM pass per turn.
Split YouTube and Wikipedia into separate agents with dedicated tasks when outputs must stay source-specific.
Export provider keys in the shell or load them with os.getenv — LangChain tools fail fast when credentials are missing.

Next Steps

Memory Integration

Learn how to combine LangChain tools with agent memory

Custom Tools

Create your own custom tools for agents
For optimal results, ensure all required dependencies are installed and API keys are properly configured for each tool.

Build and register custom tools for your agents.

Connect agents to external tool servers via Model Context Protocol.