OSSS.ai.orchestration.patterns.spec¶
OSSS.ai.orchestration.patterns.spec
¶
Graph pattern specification and resolution layer.
Option A alignment (planning before compile; planned_agents authoritative):
This module:
- Loads graph patterns from JSON
- Resolves static edges only among the provided agent set
- Resolves conditional destination maps only among the provided agent set
- Evaluates optional when expressions safely
- Does NOT build LangGraph graphs directly
- Does NOT register or resolve router callables (router names only)
GraphFactory is the only place that mutates StateGraph.
GraphPattern
dataclass
¶
Declarative description of a graph pattern.
Option A: This layer must be agent-set strict. - If planned_agents does not include a node, edges and destinations referencing that node are considered inactive / unavailable.
resolve_edges(agents)
¶
Option A behavior:
- Only include edges whose endpoints exist in agents (except END).
- Apply when expressions against the provided agent set.
resolve_conditional_destinations_for(from_node, agents)
¶
✅ Option A helper: Returns the conditional destination mapping filtered to the provided agent set.
- Always preserves router keys whose destination is END
- Drops destinations that are not present in
agents(planned_agents)
required_router_names(agents)
¶
Return router names referenced by this pattern that are active for the provided agent set. This is used by GraphFactory/GraphAssembler to validate router registration before wiring.
PatternRegistry
¶
Loads and stores all graph patterns.
evaluate_when_expr(expr, agents)
¶
Safe evaluator for when expressions.
Supported
- has('agent') or has("agent")
- not
and or - parentheses: ( ... )
Precedence
not > and > or