This repository has been archived on 2026-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
agent-runtime/agent/graphs/v2_director_drives.py
Nico 58734c34d2 Wire model overrides end-to-end: API → runtime → frame engine
- /api/chat accepts {"models": {"role": "provider/model"}} for per-request overrides
- runtime.handle_message passes model_overrides through to frame engine
- All 4 graph definitions (v1-v4) now declare MODELS dicts
- test_graph_has_models expanded to verify all graphs
- 11/11 engine tests green

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 18:07:42 +02:00

75 lines
3.2 KiB
Python

"""v2-director-drives: Director is the brain, Thinker is the executor.
Director (smart model) receives Input, decides what to do, produces a plan.
Thinker (fast model) executes the plan's tool_sequence without autonomous reasoning.
Interpreter (fast model) summarizes tool results factually.
No S3* audits needed — Director controls everything.
Flow: Input -> Director -> Thinker -> [Output, UI] -> Memorizer -> Director.update()
(Interpreter is called by Thinker when tool results need summarization)
"""
NAME = "v2-director-drives"
DESCRIPTION = "Director is the brain, Thinker executes, Interpreter reads results"
NODES = {
"input": "input_v1", # Same structured classifier
"director": "director_v2", # NEW: always-on brain, produces DirectorPlan
"thinker": "thinker_v2", # NEW: pure executor, follows DirectorPlan
"interpreter": "interpreter_v1", # NEW: factual result summarizer
"output": "output_v1", # Same text renderer
"ui": "ui", # Same dashboard renderer
"memorizer": "memorizer_v1", # Same long-term memory
"sensor": "sensor", # Same state monitor
}
EDGES = [
# Data edges — Director drives the pipeline
{"from": "input", "to": "director", "type": "data", "carries": "Command"},
{"from": "input", "to": "output", "type": "data", "carries": "Command",
"condition": "reflex"},
{"from": "director", "to": "thinker", "type": "data", "carries": "DirectorPlan"},
{"from": "thinker", "to": ["output", "ui"], "type": "data",
"carries": "ThoughtResult", "parallel": True},
{"from": "thinker", "to": "interpreter", "type": "data",
"carries": "tool_output", "condition": "has_tool_output"},
{"from": "interpreter", "to": "output", "type": "data",
"carries": "InterpretedResult", "condition": "has_tool_output"},
{"from": "output", "to": "memorizer", "type": "data", "carries": "history"},
# Context edges
{"from": "memorizer", "to": "director", "type": "context",
"method": "get_context_block"},
{"from": "memorizer", "to": "input", "type": "context",
"method": "get_context_block"},
{"from": "memorizer", "to": "output", "type": "context",
"method": "get_context_block"},
{"from": "director", "to": "output", "type": "context",
"method": "get_context_line"},
{"from": "sensor", "to": "director", "type": "context",
"method": "get_context_lines"},
{"from": "ui", "to": "director", "type": "context",
"method": "get_machine_summary"},
# State edges
{"from": "sensor", "to": "runtime", "type": "state", "reads": "flags"},
{"from": "ui", "to": "runtime", "type": "state", "reads": "current_controls"},
]
CONDITIONS = {
"reflex": "intent==social AND complexity==trivial",
"has_tool_output": "thinker.tool_used is not empty",
}
MODELS = {
"input": "google/gemini-2.0-flash-001",
"director": "anthropic/claude-haiku-4.5",
"thinker": "google/gemini-2.0-flash-001",
"interpreter": "google/gemini-2.0-flash-001",
"output": "google/gemini-2.0-flash-001",
"memorizer": "google/gemini-2.0-flash-001",
}
# No audits — Director controls tool usage, no need for S3* corrections
AUDIT = {}