Skip to content

feat: complexity-based model routing at dispatch time #1011

Description

@cgcardona

Background

Inspired by Kit-Daemon's agent orchestration pattern. Currently AgentCeption routes all tasks to a single configured model regardless of complexity. We already have natural complexity signals we are not using.

Problem

All agent roles (CTO, VP, engineer, reviewer) hit the same model with the same timeout budget. A simple file rename and a full architecture refactor get the same compute. This wastes tokens on simple tasks and potentially underserves complex ones.

Proposed solution

Implement a task complexity classifier at dispatch time that maps to a model tier:

  • TRIVIAL (tiny issue body, single-file label) -> smallest/fastest local model
  • SIMPLE (normal engineer task, <500 token context) -> local Qwen
  • MODERATE (multi-file, VP-level) -> larger local model if available
  • COMPLEX (CTO-level planning, architecture) -> Claude Sonnet
  • CRITICAL (full system design, security) -> Claude Opus

The CTO/VP/Engineer role hierarchy we already have is a strong complexity signal. Role alone gets us 80% of the way there.

Implementation notes

  • Classifier lives in agentception/readers/ (new file: task_classifier.py)
  • At dispatch, compute complexity tier from: role, issue body token count, label set
  • Pass the resulting model override into agent_loop.py (already accepts per-usecase overrides via config.py)
  • Fall back to the globally configured model if no tier match
  • Add task_complexity field to ACAgentRun so we can query it later

Acceptance criteria

  • task_classifier.py with unit tests
  • ACAgentRun gains task_complexity column (Alembic migration)
  • Dispatch route passes complexity-derived model override to agent loop
  • Config: per-complexity model override env vars (AC_MODEL_SIMPLE, AC_MODEL_COMPLEX, etc.)
  • Docs updated in docs/guides/dispatch.md
  • mypy clean, all tests pass

Context

Per-usecase override fields already exist in agentception/config.py (local_llm_model_plan, etc.). This extends that pattern to be automatic rather than manual.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions