AI Task Complexity Routing Engine - Helps AI coding agents choose the right execution strategy
Project description
๐ง AERRIK
AI Task Complexity Routing Engine
Helps AI coding agents choose the right execution strategy for every software task.
๐ Quick Start
Installation
pip install aerrik
Classify a Task
aerrik classify "Build a distributed event-driven system"
Output:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โก AERRIK Task Classification โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Task
Build a distributed event-driven system
Classification
COMPLEX
Scope
PLATFORM
Confidence
100%
Reasons
โ Architecture: distributed
โ Architecture: event-driven
โ Multi-concern scope: 2 independent concerns
Agent Strategy
โ Architecture planning, risk analysis, system decomposition
๐ What Is AERRIK?
AERRIK is a task complexity routing engine โ an intelligence layer that analyzes software development tasks and classifies them into SIMPLE, MEDIUM, or COMPLEX.
AI coding agents use this classification to decide how much planning, reasoning, architecture, tooling, and execution a task requires.
The Flow
User describes a software task
โ
AERRIK analyzes the task description
โ
Detects complexity signals (architecture, security, integration, data, etc.)
โ
Classifies: SIMPLE | MEDIUM | COMPLEX
โ
AI agent uses the result to select an execution strategy
Example Classifications
| Task | Classification |
|---|---|
"Create a simple button component" |
SIMPLE |
"Build a user profile system with database" |
MEDIUM |
"Design a distributed event-driven system" |
COMPLEX |
๐ก Why AERRIK Exists
AI coding agents often use the same reasoning process for every task โ whether it's creating a button or designing a distributed system. This causes:
- โ Overthinking simple tasks (wasting tokens and time)
- โ Under-planning complex tasks (missing architecture, security, edge cases)
- โ Inefficient tool usage (same tools for every task)
- โ Bad execution strategies (one-size-fits-all approach)
AERRIK acts as a complexity-aware routing layer that helps agents calibrate their approach:
| Complexity | Agent Strategy |
|---|---|
| SIMPLE | Minimal planning, direct implementation, fewer tools, fast execution |
| MEDIUM | Structured planning, feature decomposition, database/API awareness, validation |
| COMPLEX | Architecture planning, risk analysis, system decomposition, security review, testing strategy |
๐ฆ Installation
From PyPI (Recommended)
pip install aerrik
Upgrade
pip install --upgrade aerrik
Verify Installation
aerrik --version
# Output: aerrik 5.4.0
Development Installation
git clone https://github.com/aerrik-studio/aerrik.git
cd aerrik
pip install -e .
๐ฏ CLI Usage
Classify a Task
aerrik classify "Create a REST API for tasks"
JSON Output
aerrik classify "Build a payment system" --json
Output:
{
"policy": "medium",
"scope_level": "feature",
"score": 5.0,
"confidence": 0.99,
"reasons": [
"Feature scope: 1 signals (score: 3.0)",
"Security: 3/10",
"Multi-concern scope: 2 independent concerns"
],
"signals": {
"architecture": 0.0,
"scope": 2.64,
"integration": 0.0,
"data": 0.0,
"security": 3.0,
"realtime": 0.0,
"workflow": 0.0,
"concern_count": 2,
"concern_types": []
}
}
Detailed Explanation
aerrik explain "Build a multi-tenant SaaS platform"
Shows comprehensive breakdown including:
- Classification and scope
- Score and confidence
- All signal dimensions (architecture, integration, security, etc.)
- Concern count and types
- All detection reasons
Agent Strategy
aerrik strategy "Build a distributed payment system"
Output:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ค AERRIK Agent Strategy โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Classification: COMPLEX
Recommended Agent Strategy
Planning Steps 5
Maximum Tools 15
Architecture Review ENABLED
Security Review ENABLED
Review Required YES
Testing Full test suite
Architecture planning, risk analysis, system decomposition
๐ Python API
Basic Usage
from aerrik import TaskComplexity
# Simple classification
result = TaskComplexity.classify("Build a distributed cache")
print(result.value) # "complex"
# Detailed classification
breakdown = TaskComplexity.classify_detailed("Build a distributed cache")
print(f"Policy: {breakdown.policy.value}") # "complex"
print(f"Scope: {breakdown.scope_level.value}") # "platform"
print(f"Score: {breakdown.score}") # 23.9
print(f"Confidence: {breakdown.confidence}") # 1.0
print(f"Reasons: {breakdown.reasons}") # ["Architecture: distributed", ...]
Advanced Usage
from aerrik import TaskComplexity, ActivationPolicy
breakdown = TaskComplexity.classify_detailed("Build SaaS with multi-tenancy")
# Check policy
if breakdown.policy == ActivationPolicy.COMPLEX:
print("This is a complex task!")
# Access signal dimensions
print(f"Architecture: {breakdown.signals.architecture}") # 8.5
print(f"Security: {breakdown.signals.security}") # 0.0
print(f"Integration: {breakdown.signals.integration}") # 0.0
print(f"Concern count: {breakdown.signals.concern_count}") # 2
# Check specific signals
if breakdown.signals.architecture > 5:
print("Enable architecture review")
if breakdown.signals.security > 5:
print("Enable security review")
๐ค For AI Agent Developers
AERRIK is designed to be integrated into AI coding agents as a pre-execution routing layer.
Integration Architecture
User Task
โ
AERRIK (classify)
โ
SIMPLE | MEDIUM | COMPLEX
โ
Agent Strategy Selection
โ
Planning โ Tool Selection โ Code Generation โ Testing
Strategy Mapping Example
from aerrik import TaskComplexity
def get_agent_strategy(task_description: str) -> dict:
"""Map AERRIK classification to agent execution strategy."""
breakdown = TaskComplexity.classify_detailed(task_description)
strategies = {
"simple": {
"planning_steps": 1,
"max_tools": 3,
"review_required": False,
"test_depth": "unit_only",
"architecture_review": False,
},
"medium": {
"planning_steps": 3,
"max_tools": 8,
"review_required": True,
"test_depth": "unit_and_integration",
"architecture_review": False,
},
"complex": {
"planning_steps": 5,
"max_tools": 15,
"review_required": True,
"test_depth": "full_suite",
"architecture_review": True,
"security_review": True,
},
}
return strategies[breakdown.policy.value]
Using Signal Dimensions
breakdown = TaskComplexity.classify_detailed(task)
# Fine-grained decisions based on signals
if breakdown.signals.security > 5:
enable_security_review()
if breakdown.signals.architecture > 5:
enable_architecture_planning()
if breakdown.signals.realtime > 0:
enable_realtime_considerations()
if breakdown.signals.concern_count >= 3:
enable_task_decomposition()
Important: AERRIK classifies complexity. The agent decides the final execution strategy. AERRIK does not generate code, run tools, or execute tasks on its own.
๐ฌ How It Works
Signal Detection
AERRIK analyzes task descriptions across 8 independent signal dimensions:
| Dimension | What It Detects | Examples |
|---|---|---|
| Scope | Size of the task | button, form, dashboard, platform |
| Architecture | System design patterns | distributed, microservices, event-driven, CQRS |
| Integration | External service dependencies | Stripe, AWS, Kafka, Twilio |
| Data | Data persistence and sensitivity | database, PII, financial, health |
| Security | Authentication, encryption, compliance | OAuth2, JWT, encryption, GDPR |
| Realtime | Real-time communication needs | WebSocket, live, streaming |
| Workflow | Multi-step or multi-role processes | saga, compensation, versioning |
| Concerns | Number of independent implementation areas | Multiple dimensions active |
Classification Pipeline
Task Description
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ STEP 0: Simple Context Detection โ
โ (health check, status endpoint, etc.) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 1: Negative Signal Detection โ
โ (simple, basic, single, utility) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 2: Strong Signal Detection โ
โ Architecture, Domain, Workflow, Infra โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 3: Feature Signal Scoring โ
โ With cross-signal deduplication โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 4-7: Multi-Dimensional Scoring โ
โ Integration, Security, Data, Realtime โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 8: Multi-Concern Analysis โ
โ Count independent implementation areas โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 9: Scope Level Detection โ
โ LOCAL โ FEATURE โ SYSTEM โ PLATFORM โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 10-12: Overrides & Adjustments โ
โ Architecture singletons, context rules โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ STEP 13: Policy Mapping โ
โ LOCALโSIMPLE FEATUREโMEDIUM โ
โ SYSTEMโCOMPLEX PLATFORMโCOMPLEX โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
SIMPLE | MEDIUM | COMPLEX
Key Design Decisions
- Strong Architecture Singletons: A single "distributed" or "event-driven" signal is strong enough to prevent SIMPLE classification
- False-Positive Suppression: "form" inside "format" or "list" inside "wishlist" are detected and suppressed
- Context-Aware Detection: "health check" โ "health data"; "landing page" forces simple regardless of domain
- Component Context: "comparison table component" is recognized as a simple UI element
๐ Validation Results
AERRIK v5.4 has been validated against 480 tasks across multiple test suites:
| Test Suite | Tasks | Result | Status |
|---|---|---|---|
| Existing Benchmark | 180 | 100.0% | โ |
| Regression Tests | 100 | 100.0% | โ |
| Security Tests | 18 | 100.0% | โ |
| 300-Task Unseen Validation | 300 | 95.3% | โ |
Unseen Validation โ Per-Class Metrics
| Class | Precision | Recall | F1 Score |
|---|---|---|---|
| Simple | 0.969 | 0.940 | 0.954 |
| Medium | 0.907 | 0.970 | 0.937 |
| Complex | 0.990 | 0.950 | 0.969 |
Generalization Proof
| Version | Benchmark | Unseen Validation | Gap |
|---|---|---|---|
| v5.3 | 100.0% | 66.7% | 33.3pp |
| v5.4 | 100.0% | 95.3% | 4.7pp |
The 28.6 percentage point improvement on unseen tasks demonstrates genuine generalization โ not benchmark overfitting.
๐๏ธ Architecture
Engine Architecture
AERRIK has three core engines:
Task Description
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Routing Engine (routing_engine.py) โ
โ Classifies: SIMPLE/MEDIUM/COMPLEX โ
โ Output: RoutingBreakdown โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Risk Engine (risk_engine.py) โ
โ Scores: 0-10 risk level โ
โ Output: RiskBreakdown โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Policy Engine (policy_engine.py) โ
โ Decides: execution policy โ
โ Output: PolicyDecision โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Package Structure
aerrik/
โโโ pyproject.toml # Package configuration
โโโ README.md # This file
โโโ LICENSE # MIT License
โโโ CHANGELOG.md # Version history
โ
โโโ src/
โ โโโ aerrik/
โ โโโ __init__.py # Public API
โ โโโ __main__.py # python -m aerrik
โ โโโ version.py # Version: 5.4.0
โ โ
โ โโโ engines/ # Core intelligence engines
โ โ โโโ routing_engine.py
โ โ โโโ risk_engine.py
โ โ โโโ policy_engine.py
โ โ
โ โโโ cli/ # Command-line interface
โ โโโ main.py
โ โโโ formatting.py
โ
โโโ tests/ # Test suites
โ โโโ test_launch_checklist.py
โ โโโ security_audit.py
โ โโโ test_routing_engine_v51.py
โ
โโโ benchmark/ # Benchmarking system
โโโ tasks_300.py
โโโ benchmark_300.py
๐งช Testing
Run all tests:
# Core tests (155 tests)
python3 tests/test_launch_checklist.py
# Security tests (18 tests)
python3 tests/security_audit.py
# Regression tests (100 tests)
python3 tests/test_routing_engine_v51.py
# Benchmark (180 tasks)
python3 benchmark/benchmark_300.py
# Unseen validation (300 tasks)
python3 run_unseen_validation.py
๐ Design Principles
-
No Benchmark Hardcoding โ The router never matches specific benchmark task descriptions. All classification is based on general signal detection.
-
Validation-First Development โ Every change is validated against benchmark, regression, security, and unseen test suites before acceptance.
-
Generalization Over Perfection โ A 95% score on unseen tasks is more valuable than 100% on known tasks.
-
Deterministic Classification โ Same input always produces same output. No randomness, no LLM dependency in the routing engine.
-
Context-Aware Signals โ "health check" โ "health data"; "landing page" โ "SaaS platform"; context matters.
-
Security Preservation โ All 18 security tests must pass with every change. Security is non-negotiable.
-
Explainable Results โ Every classification includes human-readable reasons explaining why the task was classified as it was.
โ ๏ธ Limitations
AERRIK is a task complexity classifier, not a complete AI system. Here's what it does NOT do:
- โ Does not write code โ It classifies tasks; agents write code
- โ Does not understand all software requirements โ It detects patterns in task descriptions
- โ Is not an autonomous coding agent โ It's a routing layer for agents
- โ May have edge cases โ 14 out of 300 unseen tasks were misclassified (4.7%)
- โ English-only โ Currently optimized for English task descriptions
- โ Text-based only โ Cannot analyze images, diagrams, or code directly
- โ No LLM required โ The routing engine is standalone and deterministic
Known Edge Cases (v5.4)
- Non-adjacent compound signals (e.g., "ping endpoint for monitoring")
- Novel vocabulary not yet in signal dictionaries
- Tasks that genuinely sit at complexity boundaries
๐บ๏ธ Roadmap
โ Current (v5.4)
- Task complexity routing engine
- 8-dimensional signal detection
- Strong architecture singletons
- False-positive suppression
- Context-aware classification
- 95.3% unseen validation accuracy
- 100% benchmark accuracy
- 18/18 security tests passing
- PyPI package
- CLI with Rich formatting
- JSON output support
๐ Next
- Stable public Python API with versioning (v1.0)
- Agent strategy adapter library
- More adversarial unseen validation datasets
- Multi-language task description support
- Batch classification API
๐ฎ Future
- Pluggable routing policies (customizable signal weights)
- LLM-assisted classification mode (hybrid deterministic + LLM)
- Code-aware routing (analyze actual code, not just descriptions)
- Real-time routing API endpoint
- Integration adapters for popular agent frameworks (LangChain, AutoGPT, etc.)
- Community-contributed signal packs
- Web UI for task visualization
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines.
Golden Rule: Do NOT improve benchmark accuracy by hardcoding benchmark task descriptions.
Quick Start for Contributors
git clone https://github.com/aerrik-studio/aerrik.git
cd aerrik
pip install -e ".[dev]"
# Make your changes, then run ALL tests:
python3 tests/test_launch_checklist.py
python3 tests/security_audit.py
python3 tests/test_routing_engine_v51.py
python3 benchmark/benchmark_300.py
python3 run_unseen_validation.py
๐ Security
If you discover a security vulnerability, please report it responsibly.
- Use GitHub Security Advisories to report vulnerabilities privately
- Do NOT open public issues for security vulnerabilities
- See SECURITY.md for details
๐ License
MIT License โ see LICENSE for details.
๐ Credits
Created by: Anmol Singh / AERRIK Studio
Built with: Python, Rich, Typer, Hatch
Tested with: 480 tasks across 5 validation suites
๐ Documentation
- Installation Guide โ Detailed installation instructions
- Agent Integration Guide โ How to integrate with AI agents
- Architecture Deep Dive โ Technical architecture details
- API Reference โ Complete API documentation
AERRIK โ Complexity-aware routing for AI coding agents
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aerrik-5.4.0.tar.gz.
File metadata
- Download URL: aerrik-5.4.0.tar.gz
- Upload date:
- Size: 65.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27088fe8921d88fdab00139623257cd5d2af9f5d8b65e6e754365187dadd58ed
|
|
| MD5 |
19368deab9439588a3afc44686b1af48
|
|
| BLAKE2b-256 |
9f382cb54a7fd9a83ad874d29ef0232789f49116c7f3c560378eef531614c46b
|
File details
Details for the file aerrik-5.4.0-py3-none-any.whl.
File metadata
- Download URL: aerrik-5.4.0-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f378e5202eb955a656d5d1d21435fd01c64a316ebe38140700f0fdfd6881b90
|
|
| MD5 |
dba3a0aea21fcc2e88853bf44896d024
|
|
| BLAKE2b-256 |
8e0ddfb9a7286121401b594146d5bd51c1fbfddb50cd7d97e2b2c1f8989ba0ce
|