Overview
OfficeLLM uses a manager-worker pattern where a manager agent coordinates specialized worker agents through function calling.Components
OfficeLLM Class
The main entry point that initializes and manages agents.Manager Agent
Role: Coordinates tasks and delegates to workers The manager:- Receives user tasks
- Analyzes requirements
- Calls appropriate workers (workers are registered as tools)
- Synthesizes results
- Returns final output
Worker Agent
Role: Execute specialized tasks using tools Workers:- Receive delegated tasks from manager
- Use their specialized tools
- Return results to manager
Execution Flow
1. Task Submission
2. Manager Processing
The manager’s LLM decides which workers to call:3. Worker Execution
The research worker executes:4. Manager Synthesis
Manager receives worker result and may:- Call more workers if needed
- Respond with final result when complete
Continuous Execution
Agents execute continuously until they signal completion by responding without making tool/worker calls. Manager completes when:- It responds without calling any workers
- It responds without calling any tools
Example Flow
Provider Independence
Each agent can use a different LLM provider:Worker Registration
Workers are registered as “tools” that the manager can call:Safety Features
Iteration Limits- Manager: 20 iterations max
- Workers: 15 iterations max
- Prevents infinite loops
- Graceful failures at all levels
- Clear error messages
- Usage tracking even on errors
Message Format
Between User and Manager
Between Manager and Workers
Between Workers and Tools
Best Practices
Manager System Prompts
Worker System Prompts
Tool Return Values
Tools should return:- Complete information in the response
- Formatted strings that are easy to read
- Error messages when something fails
Direct Worker Access
You can call workers directly, bypassing the manager:- Testing individual workers
- Building custom workflows
- Debugging worker behavior