OSSS.ai.orchestration.routers.builtins¶
OSSS.ai.orchestration.routers.builtins
¶
should_run_data_query(state)
¶
Decide if data_query should execute within a graph that already contains it.
NOTE
- This is NOT the planner’s job.
- This is only used by conditional edges in patterns that include data_query.
router_refiner_query_or_reflect(state)
¶
Returns (LEGAL BRANCH KEYS ONLY): - "data_query" if query prefix OR should_run_data_query - "reflect" otherwise (GraphFactory maps "reflect" to critic/historian/synthesis)
IMPORTANT
- Routers MUST NOT interpret yes/no wizard turns. That contract is handled in TurnNormalizer (planning/compile-time), not runtime branching.
- Routers MUST ignore route_locked/route (planning inputs), and only choose among compiled branch keys.
route_after_refiner(state)
¶
Back-compat router name used by graph-patterns.json / older wiring.
Should return ONLY legal branch keys for the edge out of refiner
in the data_query pattern: {"data_query", "final"}.
We delegate to the canonical router implementation.
router_pick_reflection_node(state)
¶
Convention supported
execution_state.agent_output_meta._reflection_target = "critic"|"historian"|"synthesis"|"final"
route_after_data_query(state)
¶
For graph-patterns.json 'data_query' pattern (legal keys: {"historian","final","END"}):
✅ Correctness goals: - If protocol is awaiting user input (e.g. confirm_yes_no), DO NOT run FinalAgent. Return END and let the API surface the prompt (query.py synthesizes prompt). - If the wizard prompted the user this turn, DO NOT run FinalAgent. Return END and let the API surface the prompt. - If wizard bailed, END. - If CRUD operation, route to historian (to narrate/validate the change). - Otherwise (read/query): if data_query already produced an answer/result, END (avoid FinalAgent), else allow final as a fallback.
✅ Best-practice: - Pending-action gating uses has_awaiting_pending_action() predicate (NOT presence checks). - Router decisions are pure (no state mutation).