Skip to main content

PraisonAI Chat

PraisonAI Chat is a powerful, modern chat interface designed for AI agent interactions. It provides a beautiful UI for interacting with PraisonAI agents with features like streaming responses, tool call visualization, and session management.

Installation

pip install praisonai[chat]

Quick Start

CLI Usage

Start the chat interface with a single command:
praisonai chat
This starts the chat server at http://localhost:8000.

With Custom Port

praisonai chat --port 3000

Programmatic Usage

from praisonaiagents import Agent
from praisonai.chat import start_chat_server

# Create your agent
agent = Agent(
    name="Assistant",
    instructions="You are a helpful AI assistant."
)

# Start the chat UI with your agent
start_chat_server(agent=agent, port=8000)

Features

Multi-Agent Support

Seamlessly interact with multiple AI agents in a single interface

Tool Visualization

See agent tool calls and their results in real-time

Streaming Responses

Real-time streaming of agent responses

Session Management

Persistent sessions with full history

Multi-Agent Chat

from praisonaiagents import Agent
from praisonai.chat import start_chat_server

# Define multiple agents
researcher = Agent(
    name="Researcher",
    role="Research specialist",
    instructions="You research topics thoroughly."
)

writer = Agent(
    name="Writer", 
    role="Content writer",
    instructions="You write clear, engaging content."
)

# Start chat with multiple agents
start_chat_server(agents=[researcher, writer], port=8000)

Configuration

ChatConfig Options

from praisonai.chat import start_chat_server, ChatConfig

config = ChatConfig(
    host="0.0.0.0",      # Host to bind to
    port=8000,           # Port number
    debug=False,         # Enable debug mode
    auth_enabled=False,  # Enable authentication
    session_id=None,     # Custom session ID
)

start_chat_server(config=config)

Environment Variables

VariableDescriptionDefault
PRAISONAI_CHAT_PORTServer port8000
PRAISONAI_CHAT_HOSTServer host0.0.0.0
CHAINLIT_AUTH_SECRETAuth secret for sessionsAuto-generated

UI Features

Chain of Thought Visualization

The chat interface displays agent reasoning steps, showing how agents arrive at their responses.

Tool Call Panel

When agents use tools, the UI displays:
  • Tool name
  • Input arguments
  • Tool output/results
  • Execution time

Session History

  • Automatic session persistence
  • Resume previous conversations
  • Export chat history

Integration with PraisonAI Agents

PraisonAI Chat integrates seamlessly with the full PraisonAI agent framework:
from praisonaiagents import Agent, Task, PraisonAIAgents

# Define agents with tools
from praisonaiagents.tools import duckduckgo_search

researcher = Agent(
    name="Researcher",
    role="Research specialist",
    tools=[duckduckgo_search]
)

writer = Agent(
    name="Writer",
    role="Content writer"
)

# Define tasks
research_task = Task(
    description="Research {topic}",
    agent=researcher,
    expected_output="Research findings"
)

write_task = Task(
    description="Write article based on research",
    agent=writer,
    expected_output="Article content"
)

# Create the agents system
agents = PraisonAIAgents(
    agents=[researcher, writer],
    tasks=[research_task, write_task]
)

# The chat UI will automatically detect and use these agents

Upstream Updates

PraisonAI Chat is based on Chainlit, an excellent open-source framework. We maintain compatibility with upstream updates. To sync with upstream improvements:
cd PraisonAIChat
make sync-upstream

License

PraisonAI Chat is licensed under the Apache 2.0 License. See THIRD_PARTY_NOTICES.md for attribution.