Overview
The Team Leader is the main orchestrator in Junkie’s multi-agent system. It receives user messages, delegates tasks to specialized agents, and synthesizes their responses.Initialization
Configuration
Model Selection
The team leader uses a configurable model based onPROVIDER and MODEL_NAME:
Tools
The team leader has direct access to:- BioTools: User profile and biographical information
- CalculatorTools: Basic arithmetic operations
System Instructions
Instructions are fetched from Phoenix (production tag) with fallback to local file:Delegation Hierarchy
Fromsystem_prompt.md:75-89, the team leader follows this delegation order:
- Deep research / real-time web data / complex analysis →
pplx-agent - Short code execution / quick runs / math →
groq-compound - Complex code / sandboxed execution / file ops →
code-agent - Long-context chat history / thread analysis →
context-qna-agent - MCP / platform-specific integrations →
mcp_agent(if present)
Delegation Rules
- Parallel delegation: Can delegate to multiple agents simultaneously for complex tasks
- Fallback: If chosen agent fails, attempt next appropriate agent once
- Transparency: Never reveal internal delegation to users
Team Members
The team is composed of specialized agents:Memory Integration
The team leader has memory capabilities enabled:- Remember user preferences
- Recall past conversations
- Build context over time
Session Management
Sessions are stored in PostgreSQL:num_history_runs.
Debugging
Enable detailed logging:- Agent selection reasoning
- Tool calls
- Response synthesis
- Memory operations
Context Awareness
The team leader receives temporal context:system_prompt.md:48-73, this enables:
- Understanding message timestamps
- Distinguishing past from present
- Time-sensitive responses
- Reply context awareness