feat(ml): multi-agent context framework + v4 orchestrator prompt
Adds ml/agents/ — five specialised sub-agents (overdue_task, momentum, time_of_day, recent_patterns, focus_area) each producing a prompt snippet from user signals. A registry wires them up; the orchestrator prompt in ml/serving/prompts.py synthesises their outputs into one tip via LiteLLM. Also wires /api/agents route in the API and updates the Dockerfile to copy the full ml/ tree with PYTHONPATH=/app so agent imports resolve correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
ml/agents/registry.py
Normal file
28
ml/agents/registry.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from __future__ import annotations
|
||||
from .base import BaseAgent
|
||||
from .overdue_task import OverdueTaskAgent
|
||||
from .momentum import MomentumAgent
|
||||
from .time_of_day import TimeOfDayAgent
|
||||
from .recent_patterns import RecentPatternsAgent
|
||||
from .focus_area import FocusAreaAgent
|
||||
|
||||
_AGENTS: dict[str, BaseAgent] = {
|
||||
a.agent_id: a
|
||||
for a in [
|
||||
OverdueTaskAgent(),
|
||||
MomentumAgent(),
|
||||
TimeOfDayAgent(),
|
||||
RecentPatternsAgent(),
|
||||
FocusAreaAgent(),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
def get_agent(agent_id: str) -> BaseAgent:
|
||||
if agent_id not in _AGENTS:
|
||||
raise KeyError(f"Unknown agent: {agent_id!r}. Known: {sorted(_AGENTS)}")
|
||||
return _AGENTS[agent_id]
|
||||
|
||||
|
||||
def all_agents() -> list[BaseAgent]:
|
||||
return list(_AGENTS.values())
|
||||
Reference in New Issue
Block a user