Skip to main content

OfficeLLM

A TypeScript framework for building multi-agent AI systems where a manager coordinates specialized worker agents that autonomously use tools to complete tasks.

What is OfficeLLM?

OfficeLLM provides a framework for creating multi-agent systems:
  • Manager Agent coordinates and delegates tasks to specialized workers
  • Worker Agents execute specific tasks using their own tools and LLM providers
  • Provider Support for OpenAI, Anthropic, Gemini, and OpenRouter
  • Type Safety with Zod schemas for tool parameters
  • Continuous Execution where agents work until completion

Key Features

  • Multi-Agent: Manager orchestrates specialized worker agents
  • Provider Agnostic: OpenAI, Anthropic, Gemini, and OpenRouter
  • Type Safe: Zod schemas for all tool parameters
  • User-Defined Tools: Bring your own tool implementations
  • Extensible: Add new providers and customize behavior

Quick Example

import { OfficeLLM } from 'officellm';
import { z } from 'zod';

// Define a worker agent
const mathWorker = {
  name: 'Math Solver',
  description: 'Specialized in mathematical calculations',
  provider: {
    type: 'openai' as const,
    apiKey: process.env.OPENAI_API_KEY!,
    model: 'gpt-4',
    temperature: 0.1,
  },
  systemPrompt: 'You are a mathematical expert. Solve problems step by step.',
  tools: [
    {
      name: 'calculate',
      description: 'Perform mathematical calculations',
      parameters: z.object({
        expression: z.string().describe('Math expression to evaluate'),
      }),
    },
  ],
};

// Manager configuration
const manager = {
  name: 'Project Manager',
  description: 'Coordinates AI worker agents',
  provider: {
    type: 'anthropic' as const,
    apiKey: process.env.ANTHROPIC_API_KEY!,
    model: 'claude-3-sonnet-20240229',
    temperature: 0.7,
  },
  systemPrompt: 'You coordinate specialized AI agents to complete tasks.',
  tools: [
    {
      name: 'math_solver',
      description: 'Delegate math tasks to the math expert',
      parameters: z.object({
        task: z.string().describe('Math task to solve'),
        priority: z.enum(['low', 'medium', 'high']).default('medium'),
      }),
    },
  ],
};

// Initialize and use
const office = new OfficeLLM({
  manager,
  workers: [mathWorker],
});

const result = await office.executeTask({
  title: 'Calculate compound interest',
  description: 'What is the compound interest on $1000 at 5% for 3 years?',
  priority: 'high',
});

console.log('Result:', result.content);

Why OfficeLLM?

  • Simplified Architecture: Workers are called like functions
  • Type Safety: Zod validates all tool parameters
  • Provider Agnostic: Easy to switch between LLM providers
  • Extensible: Adding new providers is straightforward

How It Works

  1. User submits a task to the manager via executeTask()
  2. Manager analyzes the task and calls appropriate worker agents
  3. Workers execute tasks using their specialized tools
  4. Manager synthesizes results and returns to the user

Next Steps