Implement hierarchical agent tree architecture

Core types with provability design:
- Task, Budget, Complexity with documented invariants
- VerificationCriteria with programmatic/LLM hybrid support
- SubtaskPlan with topological sort for execution order

Agent hierarchy:
- Agent trait with pre/post-conditions documented
- OrchestratorAgent for Root/Node agents
- LeafAgent for specialized workers

Leaf agents:
- ComplexityEstimator: estimates task difficulty (0-1 score)
- ModelSelector: U-curve optimization for cost/capability
- TaskExecutor: refactored from original agent loop
- Verifier: hybrid programmatic + LLM verification

Orchestrators:
- RootAgent: top-level, estimates complexity, splits tasks
- NodeAgent: intermediate, handles delegated subtasks

Budget system:
- Budget allocation strategies (proportional, equal, priority)
- OpenRouter pricing integration for cost estimation

API updated to use hierarchical RootAgent
This commit is contained in:
Thomas Marchand
2025-12-14 21:49:03 +00:00
parent 4ffa605c0c
commit 773991ffba
23 changed files with 3955 additions and 34 deletions

View File

@@ -36,6 +36,7 @@ walkdir = "2"
urlencoding = "2"
anyhow = "1"
async-stream = "0.3"
regex = "1"
[dev-dependencies]
tokio-test = "0.4"