Skip to main content

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:
  1. Receives user tasks
  2. Analyzes requirements
  3. Calls appropriate workers (workers are registered as tools)
  4. Synthesizes results
  5. Returns final output

Worker Agent

Role: Execute specialized tasks using tools Workers:
  1. Receive delegated tasks from manager
  2. Use their specialized tools
  3. 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
Worker completes when:
  • 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
Error Handling
  • Graceful failures at all levels
  • Clear error messages
  • Usage tracking even on errors
Missing Implementations

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:
This is useful for:
  • Testing individual workers
  • Building custom workflows
  • Debugging worker behavior