core.graph_execution_helpers
Pure helper functions for prompt resolution, abort checking, and failure propagation during graph (DAG) execution.
These functions operate on results_by_name (the executor’s accumulated
result dict) rather than the shared prompt_attr_history, making them
suitable for level-by-level graph execution where results are only written
to the shared history after the entire graph completes.
Pure helper functions for prompt resolution, abort checking, and failure propagation during graph (DAG) execution.
These functions operate on results_by_name (the executor’s accumulated
result dict) rather than the shared prompt_attr_history, making them
suitable for level-by-level graph execution where results are only written
to the shared history after the entire graph completes.
- build_graph_history_dict(results_by_name)[source]
Build a
{name: response_text}mapping from executor results.
- resolve_graph_prompt(prompt_spec, results_by_name)[source]
Resolve interpolation and history injection for a graph node.
Performs two-phase prompt assembly:
Interpolation: Resolves
{{name.response}}patterns using results from earlier DAG levels.History injection: For each name in
prompt_spec["history"], formats the prior Q&A as<conversation_history>XML. Entries already interpolated are deduplicated.
- check_abort_condition(prompt_spec, results_by_name)[source]
Check if a prompt’s
abort_conditiontriggers a cascade abort.
- should_skip_for_failed_deps(node, results_by_name, nodes)[source]
Check if a node should be skipped because any dependency failed.
Only failed dependencies trigger a skip. Skipped dependencies do NOT cascade — a node whose only dependency was skipped will still execute (its condition will determine whether it should proceed).
- Parameters:
node (PromptNode) – The prompt node to check.
results_by_name (dict[str, dict[str, Any]]) – Accumulated results indexed by prompt_name.
nodes (dict[int, PromptNode]) – All graph nodes indexed by sequence number.
- Returns:
Tuple of (should_skip, reason_string).
- Return type:
Functions
- build_graph_history_dict(results_by_name)[source]
Build a
{name: response_text}mapping from executor results.
- check_abort_condition(prompt_spec, results_by_name)[source]
Check if a prompt’s
abort_conditiontriggers a cascade abort.
- resolve_graph_prompt(prompt_spec, results_by_name)[source]
Resolve interpolation and history injection for a graph node.
Performs two-phase prompt assembly:
Interpolation: Resolves
{{name.response}}patterns using results from earlier DAG levels.History injection: For each name in
prompt_spec["history"], formats the prior Q&A as<conversation_history>XML. Entries already interpolated are deduplicated.
- should_skip_for_failed_deps(node, results_by_name, nodes)[source]
Check if a node should be skipped because any dependency failed.
Only failed dependencies trigger a skip. Skipped dependencies do NOT cascade — a node whose only dependency was skipped will still execute (its condition will determine whether it should proceed).
- Parameters:
node (PromptNode) – The prompt node to check.
results_by_name (dict[str, dict[str, Any]]) – Accumulated results indexed by prompt_name.
nodes (dict[int, PromptNode]) – All graph nodes indexed by sequence number.
- Returns:
Tuple of (should_skip, reason_string).
- Return type: