ChainlitUI Module
Chainlit-based user interface for PraisonAI
ChainlitUI Module
The ChainlitUI module provides a Chainlit-based user interface for interacting with PraisonAI agents.
Prerequisites
pip install chainlitImport
from praisonai.chainlit_ui import *Quick Start
- Create a
chainlit_app.pyfile:
from praisonai.chainlit_ui import *- Run with Chainlit:
chainlit run chainlit_app.pyFeatures
Chat Profiles
The UI supports multiple chat profiles:
- Auto: Automatically generate agents and tasks based on input
- Manual: Configure agents manually from YAML
Starter Prompts
Pre-configured starter prompts for common use cases:
- Create a movie script
- Design a fantasy world
- Write a futuristic political thriller
- Develop a mystery novel
- Plan a sci-fi adventure
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
OPENAI_MODEL_NAME | Model to use | gpt-4o-mini |
OPENAI_API_BASE | API base URL | https://api.openai.com/v1 |
OPENAI_API_KEY | API key | Required |
Agent Configuration
Configure agents via agents.yaml:
agents:
- name: Researcher
role: Research Specialist
goal: Research topics thoroughly
tools:
- web_search
- name: Writer
role: Content Writer
goal: Write engaging content
tasks:
- agent: Researcher
task: Research the given topic
- agent: Writer
task: Write content based on researchActions
Run Action
Execute the configured agents with the current input.
Modify Action
Modify agents and tools from the settings panel.
Example: Custom Chainlit App
import chainlit as cl
from praisonai.agents_generator import AgentsGenerator
from praisonai.auto import AutoGenerator
@cl.on_chat_start
async def start():
await cl.Message(
content="Welcome to PraisonAI! What would you like to create?"
).send()
@cl.on_message
async def main(message: cl.Message):
# Auto-generate agents based on user input
generator = AutoGenerator(topic=message.content)
agents_config = generator.generate()
# Run the agents
agents = AgentsGenerator(agents_config)
result = agents.run()
await cl.Message(content=result).send()Chat Settings
Configure via the Chainlit settings panel:
- Framework: Choose between CrewAI, AutoGen, PraisonAI, or Google ADK
- Model: Select the LLM model
- Agent File: Path to agents.yaml configuration
Related
- UI Overview – UI options
- AgentsGenerator Module – Agent generation
- Auto Module – Auto-generation