> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PraisonAI Chat

> Modern AI Agent Chat Interface for PraisonAI

PraisonAI Chat is a modern chat UI for your agents with streaming replies, tool-call visualization, and session history.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

agent = Agent(name="chat-ui", instructions="Help users in the PraisonAI Chat interface.")
agent.start("Explain what you can do in this session.")
```

The user types in PraisonAI Chat; the agent streams replies with tool calls and session history visible in the UI.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph "PraisonAI Chat"
        In[👤 User Input] --> Agent[🤖 Agent]
        Agent --> Out[💬 Streamed Response]
    end

    classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef output fill:#10B981,stroke:#7C90A0,color:#fff

    class In input
    class Agent agent
    class Out output
```

## Quick Start

<Steps>
  <Step title="Install the chat extra">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    pip install praisonai[chat]
    ```
  </Step>

  <Step title="Launch the UI">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai chat
    ```

    Opens at `http://localhost:8000`. Use `--port 3000` for a custom port.
  </Step>

  <Step title="Or start programmatically">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonaiagents import Agent
    from praisonai.chat import start_chat_server

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

    start_chat_server(agent=agent, port=8000)
    ```
  </Step>
</Steps>

## Features

<CardGroup cols={2}>
  <Card title="Multi-Agent Support" icon="users">
    Seamlessly interact with multiple AI agents in a single interface
  </Card>

  <Card title="Tool Visualization" icon="wrench">
    See agent tool calls and their results in real-time
  </Card>

  <Card title="Streaming Responses" icon="bolt">
    Real-time streaming of agent responses
  </Card>

  <Card title="Session Management" icon="clock-rotate-left">
    Persistent sessions with full history
  </Card>
</CardGroup>

## Multi-Agent Chat

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

| Variable                        | Description                                 | Default        |
| ------------------------------- | ------------------------------------------- | -------------- |
| `PRAISONAI_CHAT_PORT`           | Server port                                 | `8000`         |
| `PRAISONAI_CHAT_HOST`           | Server host                                 | `0.0.0.0`      |
| `CHAINLIT_HOST`                 | Host the UI binds to (drives auth mode)     | `127.0.0.1`    |
| `CHAINLIT_USERNAME`             | Username for authentication                 | `admin`        |
| `CHAINLIT_PASSWORD`             | Password for authentication                 | `admin`        |
| `PRAISONAI_ALLOW_DEFAULT_CREDS` | Allow admin/admin on external bind (unsafe) | `false`        |
| `CHAINLIT_AUTH_SECRET`          | Auth secret for sessions                    | Auto-generated |

***

## Security

The chat UI enforces bind-aware authentication — stricter security when bound to external interfaces.

| Interface                               | Security Mode | Credentials                 |
| --------------------------------------- | ------------- | --------------------------- |
| **Loopback** (`127.0.0.1`, `localhost`) | Permissive    | `admin/admin` allowed       |
| **External** (`0.0.0.0`, LAN, public)   | Strict        | Custom credentials required |

<Warning>
  Using default `admin/admin` credentials on external interfaces will cause a `UIStartupError` unless `PRAISONAI_ALLOW_DEFAULT_CREDS=1` is set (demo only).
</Warning>

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Safe for external deployment
export CHAINLIT_USERNAME=myuser
export CHAINLIT_PASSWORD=mypass
praisonai chat --host 0.0.0.0
```

<Card title="Bind-Aware Authentication" icon="shield" href="/docs/features/gateway-bind-aware-auth">
  Complete security configuration guide
</Card>

## 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:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, Task, AgentTeam
from praisonaiagents.tools import internet_search

researcher = Agent(
    name="Researcher",
    role="Research specialist",
    tools=[internet_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 = AgentTeam(
    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](https://github.com/Chainlit/chainlit), an excellent open-source framework. We maintain compatibility with upstream updates.

To sync with upstream improvements:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
cd PraisonAIChat
make sync-upstream
```

## How It Works

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant ChatUI
    participant Agent

    User->>ChatUI: Type message
    ChatUI->>Agent: Forward to agent
    Agent->>Agent: Process with tools
    Agent-->>ChatUI: Stream response tokens
    ChatUI-->>User: Display streamed reply + tool calls
```

***

## Best Practices

<AccordionGroup>
  <Accordion title="Start with a single agent">
    Validate prompts and tools in chat before adding multi-agent complexity. One well-instructed agent is easier to debug than a team.
  </Accordion>

  <Accordion title="Enable streaming for long replies">
    Use streaming so users see progress during tool calls and multi-step reasoning instead of waiting for a full response.
  </Accordion>

  <Accordion title="Persist sessions in production">
    Configure session storage when users return across visits. Ephemeral sessions are fine for local dev only.
  </Accordion>

  <Accordion title="Pin the chat extra version">
    Install `praisonai[chat]` in CI and production with a pinned version so the UI and SDK stay compatible.
  </Accordion>
</AccordionGroup>

## License

PraisonAI Chat is licensed under the Apache 2.0 License. See [THIRD\_PARTY\_NOTICES.md](https://github.com/MervinPraison/PraisonAIChat/blob/main/THIRD_PARTY_NOTICES.md) for attribution.

## Related

<CardGroup cols={2}>
  <Card icon="file-lines" href="/features/chat-with-pdf">
    Chat with your documents by grounding replies in PDF content.
  </Card>

  <Card icon="database" href="/features/sessions">
    Persist conversation history so users can resume chats across visits.
  </Card>
</CardGroup>
