⚪GroupChat
A production-grade multi-agent system enabling sophisticated group conversations between AI agents with customizable speaking patterns, parallel processing capabilities, and comprehensive conversation tracking.
Advanced Configuration
Agent Parameters
agent_name
str
Required
Unique identifier for the agent
system_prompt
str
Required
Role and behavior instructions
llm
Any
Required
Language model instance
max_loops
int
1
Maximum conversation turns
autosave
bool
False
Enable conversation saving
dashboard
bool
False
Enable monitoring dashboard
verbose
bool
True
Enable detailed logging
dynamic_temperature
bool
True
Enable dynamic temperature
retry_attempts
int
1
Failed request retry count
context_length
int
200000
Maximum context window
output_type
str
"string"
Response format type
streaming_on
bool
False
Enable streaming responses
GroupChat Parameters
name
str
"GroupChat"
Chat group identifier
description
str
""
Purpose description
agents
List[Agent]
[]
Participating agents
speaker_fn
Callable
round_robin
Speaker selection function
max_turns
int
10
Maximum conversation turns
Installation
Core Concepts
The GroupChat system consists of several key components:
Agents: Individual AI agents with specialized knowledge and roles
Speaker Functions: Control mechanisms for conversation flow
Chat History: Structured conversation tracking
Response Models: Pydantic models for data validation
Basic Usage
Speaker Functions
Built-in Functions
Custom Speaker Function Example
Response Models
Complete Schema
Advanced Examples
Multi-Agent Analysis Team
Parallel Processing
Best Practices
Agent Design
Give agents clear, specific roles
Use detailed system prompts
Set appropriate context lengths
Enable retries for reliability
Speaker Functions
Match function to use case
Consider conversation flow
Handle edge cases
Add appropriate logging
Error Handling
Use try-except blocks
Log errors appropriately
Implement retry logic
Provide fallback responses
Performance
Use concurrent processing for multiple tasks
Monitor context lengths
Implement proper cleanup
Cache responses when appropriate
API Reference
GroupChat Methods
run
Run single conversation
task: str
ChatHistory
batched_run
Run multiple sequential tasks
tasks: List[str]
List[ChatHistory]
concurrent_run
Run multiple parallel tasks
tasks: List[str]
List[ChatHistory]
get_recent_messages
Get recent messages
n: int = 3
List[str]
Agent Methods
run
Process single task
str
generate_response
Generate LLM response
str
save_context
Save conversation context
None
Last updated