create_model
Create a model instance for a specific user.User ID for model configuration
Configured model instance (Groq or Custom provider)
Example
create_team_for_user
Create a full AI Team for a specific user with multiple specialized agents.User ID to create team for
Discord client instance for bio tools
Tuple of (model, team) instances
Team Members
The created team includes:- Code Agent: Sandbox execution, code generation (GPT-5)
- Perplexity Agent: Real-time web research (Sonar Pro)
- Compound Agent: Fast code execution (Groq Compound)
- Context QnA Agent: Chat history analysis
- MCP Agent (optional): MCP tool interactions
Example
get_or_create_team
Get existing team for a user or create a new one. Implements LRU cache with automatic resource cleanup.User ID to get or create team for
Discord client instance
Team instance (existing or newly created)
Caching Behavior
- Maintains up to
MAX_AGENTSteams in memory - Uses LRU eviction when cache is full
- Automatically cleans up evicted team resources
- Thread-safe with per-user locks
Example
get_prompt
Retrieve system prompt from Phoenix or fallback to local prompt.System prompt content
Example
Configuration
The module uses these environment variables:PROVIDER: Model provider (groq or custom)MODEL_NAME: Model identifierCUSTOM_PROVIDER_API_KEY: Custom provider API keyGROQ_API_KEY: Groq API keyMAX_AGENTS: Maximum teams in cache (default: 100)POSTGRES_URL: Database URL for sessionsFIRECRAWL_API_KEY: Optional Firecrawl integration