Skip to content

Orchestrator

The Orchestrator is the brain of Octipus. It receives incoming messages, classifies them, and decides how to handle them — from simple casual responses to complex multi-step task execution with specialized worker agents.

  1. Message arrives from any channel (Telegram, Slack, Teams, WebChat)
  2. Classifier analyzes the message and assigns a type: casual, task, or agent
  3. Routing determines the appropriate response strategy:
    • Casual messages get a direct LLM response
    • Task messages spawn an orchestrator agent that breaks work into sub-tasks
    • Agent messages are routed to a specific existing agent

The classifier uses keyword matching combined with optional LLM classification to determine message intent with a confidence score.

ClassificationDescriptionAction
casualGreetings, questions, small talkDirect LLM response
taskWork requests requiring toolsSpawn orchestrator agent
agentDirected at a specific agentRoute to that agent

When a task message arrives, the orchestrator classifies it and spawns a specialist worker with the appropriate role. Each role has a set of tools attached to it.

RoleToolsDescription
orchestratorprofilesBreaks tasks into sub-tasks, coordinates workers
researchbrowser, browser-ext, websearch, knowledge, filesystem, profiles, mcpWeb research, data gathering, knowledge base
codingfilesystem, shell, git, knowledge, mcpCode writing, debugging, git operations
reviewfilesystem, shell, git, knowledgeCode review, testing, linting (read-only)
qabrowser, browser-ext, shell, docker, filesystem, knowledgeTesting, UI automation, test suites
communicationgoogle-workspace, microsoft365, messaging, scheduling, profiles, email-processor, voiceEmail, calendar, contacts, phone calls
designbrowser, filesystemUI/UX design, mockups, visual analysis
devopsshell, docker, git, filesystem, mcpCI/CD, infrastructure, containers
securityshell, filesystem, browser, browser-ext, websearch, knowledge, mcpSecurity analysis, vulnerability assessment
datashell, filesystem, knowledge, mcpDatabases, data engineering, ETL
aishell, filesystem, browser, browser-ext, websearch, knowledge, mcpML/AI tasks, model evaluation
financebrowser, websearch, filesystemFinancial analysis, reporting
automationshell, docker, filesystem, scheduling, mcpWorkflow automation, cron tasks, hooks
pmfilesystem, messagingProject management, planning
writingfilesystem, browser, websearch, knowledge, messagingDocumentation, content creation
generalfilesystem, browser-ext, websearch, messaging, knowledge, scheduling, profiles, email-processor, mcpMulti-purpose: browsing, messaging, knowledge

The orchestrator itself has access to special meta-tools for managing the workflow:

ToolDescription
spawn_workerSpawn a role-specific worker agent
create_pipelineCreate a multi-stage pipeline
filter_piiFilter personally identifiable information
request_user_approvalAsk the user for approval before proceeding
send_status_updateSend progress updates to the user

The classifier uses keyword matching to suggest a role before the orchestrator decides:

CategoryKeywords
developmentimplement, write code, fix bug, refactor, debug, typescript, react, git commit, pull request
researchresearch, investigate, search the web, compare, find out, tell me about, summarize
devopsdocker, kubernetes, deploy, CI/CD, nginx, terraform, infrastructure
securityvulnerability, audit, OWASP, threat model, security review, encryption
datadatabase schema, SQL query, migration, ETL, data pipeline
writingdocumentation, write docs, readme, technical writing, changelog
designUI design, UX, wireframe, mockup, accessibility, typography
financebudget, financial analysis, ROI, cost analysis, pricing
communicationemail, gmail, calendar, phone call, call me, outlook, contacts
automationschedule, cron, recurring task, remind me, automate, hook
generalbrowser, screenshot, telegram, send message, knowledge base, upload
"Fix the login bug in auth.ts" → coding role
"Search the web for React best practices" → research role
"Deploy the Docker container" → devops role
"Check my Gmail inbox" → communication role
"Call +1234567890" → communication role
"Create a daily reminder at 9 AM" → automation role
"Run the test suite" → qa role
"Who is my wife?" → general role
"Scan for SQL injection vulnerabilities" → security role

The orchestrator uses a prioritized fallback chain when selecting a model for worker agents:

  1. CLI models (Claude Code, Gemini CLI, Codex CLI) — free subscription-based
  2. Default model — configured in the database
  3. Any local model — Ollama models with tool support
  • Reasoning model detection: Automatically skips reasoning models (DeepSeek Reasoner, etc.) for orchestration since they are incompatible with tool-calling agent loops
  • CLI sub-agent fallback: When CLI models fail (quota exhausted), retries with the default local model
  • Safe fallback: Only falls back to local (Ollama) models for tool-calling roles — never silently routes to paid API models

The orchestrator includes an approval system for sensitive operations:

  1. Agent encounters a tool call requiring user approval (permission level: ASK)
  2. Agent pauses and sends an approval request notification
  3. User reviews the request in the web UI or via the API
  4. User can approve, skip, or stop the operation
  5. Agent resumes or stops based on the user’s decision