Skip to main content

LangChain integration for PraisonAI multi-agent framework

Project description

langchain-praisonai

LangChain integration for PraisonAI multi-agent framework.

Installation

pip install langchain-praisonai

Prerequisites

  1. Install and start PraisonAI server:
pip install praisonai
praisonai serve agents.yaml --port 8080

Usage

Basic Usage

from langchain_praisonai import PraisonAITool
from langchain_openai import ChatOpenAI
from langchain.agents import initialize_agent, AgentType

# Create the PraisonAI tool
praisonai_tool = PraisonAITool(api_url="http://localhost:8080")

# Use with LangChain agent
llm = ChatOpenAI(model="gpt-4o-mini")
agent = initialize_agent(
    tools=[praisonai_tool],
    llm=llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True
)

result = agent.run("Research the latest trends in AI and summarize them")
print(result)

Using Specific Agents

from langchain_praisonai import PraisonAIAgentTool

# Create tools for specific agents
researcher = PraisonAIAgentTool(agent_name="researcher")
writer = PraisonAIAgentTool(agent_name="writer")

# Use multiple agent tools
tools = [researcher, writer]

List Available Agents

from langchain_praisonai import PraisonAIListAgentsTool

list_tool = PraisonAIListAgentsTool()
agents = list_tool.run({})
print(agents)

Direct Tool Usage

from langchain_praisonai import PraisonAITool

tool = PraisonAITool()

# Run with default workflow
result = tool.run({"query": "What are the benefits of AI?"})

# Run with specific agent
result = tool.run({"query": "Research quantum computing", "agent": "researcher"})

Async Usage

import asyncio
from langchain_praisonai import PraisonAITool

async def main():
    tool = PraisonAITool()
    result = await tool.arun({"query": "Analyze market trends"})
    print(result)

asyncio.run(main())

Configuration

Parameter Default Description
api_url http://localhost:8080 PraisonAI server URL
timeout 300 Request timeout in seconds

Available Tools

Tool Description
PraisonAITool General-purpose tool for running PraisonAI workflows
PraisonAIAgentTool Tool for running a specific named agent
PraisonAIListAgentsTool Tool for listing available agents

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_praisonai-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_praisonai-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_praisonai-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_praisonai-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for langchain_praisonai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 351c3ee7326725b3d7f31dc9cde24d0381232b8bfae2513d8f6f5c3929081d44
MD5 e9363f553665a546754009ef403e9c38
BLAKE2b-256 37e1d1243faea8e24ffda12bc2836e2de85d28bd15108227b11a0506eb1fe71d

See more details on using hashes here.

File details

Details for the file langchain_praisonai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_praisonai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14cb8a1fee49f6d477d30fb9dc45d594de97206c3fff6c7577b22a1a98cfda82
MD5 0b3d0cc032390d00d3820b4c6d4a0989
BLAKE2b-256 fcc7ef0b39f852ff9ceaf7fd3d6371c5ce6963ff653520dd783750e2f56f911a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page