Files
gcp_solution_architecture_a…/app/workflows/execution_graph.py
Jonathan Boniface e9246828b3 feat: establish the Target architecture as a graph before code
Design is now approved before any infrastructure code is written (ADR-0005).
A new target-architect Specialist produces one graph of Elements,
Relationships and Checks; the diagram is rendered from it, deployment
guidance must account for every Check, and validation gives a verdict per
Check. Requirements, components, products and recommendations carry ids in
data files, and a submission with a gap in the Requirements chain is refused.

Also in this commit:
- Customer cases group Executions, with an intent history per case
- lesson candidates are captured when an Execution ends
- evaluation gains chain, verdict, judged and interactive checks, and
  per-case thresholds
- Terraform providers are cached between checks
- the requirements analyst proposes defaults instead of asking
- the legacy-baseline case and the checks that only read it are removed
- ADR-0006 (Change requests) accepted; ADR-0004 and ADR-0007 proposed
- plans for iterations 4 to 7 under .agents/plans/

Unproven with a real model: no evaluation run has completed on this design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 13:59:09 +01:00

61 lines
2.1 KiB
Python

"""The LangGraph that holds an Execution (ADR-0003).
START -> orchestrator_turn
orchestrator_turn -> specialist_task x N (Send, parallel) -> orchestrator_turn
orchestrator_turn -> await_user (interrupt) -> orchestrator_turn
orchestrator_turn -> finalize -> END
orchestrator_turn -> end_with_warnings -> END
The nodes live in app/nodes/execution_nodes.py; they route with Command and Send, so
only the fixed edges are declared here.
"""
from __future__ import annotations
from collections.abc import Mapping
from pathlib import Path
from typing import Any, cast
from langgraph.graph import END, START, StateGraph
from app.adk.runtime import AgentRuntime, RoleSpec, RunLimiter, ToolFactory
from app.nodes.execution_nodes import make_execution_nodes
from app.recorder import ExecutionRecorder
from app.states.execution_state import ExecutionState
def build_execution_graph(
*,
runtime: AgentRuntime,
roles: Mapping[str, RoleSpec],
recorder: ExecutionRecorder,
output_root: Path,
max_orchestrator_turns: int = 100,
tool_factory: ToolFactory | None = None,
limiter: RunLimiter | None = None,
skill_versions: Mapping[str, str] | None = None,
) -> StateGraph:
nodes = make_execution_nodes(
runtime=runtime,
roles=roles,
recorder=recorder,
output_root=output_root,
max_orchestrator_turns=max_orchestrator_turns,
tool_factory=tool_factory,
limiter=limiter,
skill_versions=skill_versions,
)
graph = StateGraph(ExecutionState)
graph.add_node("orchestrator_turn", cast(Any, nodes.orchestrator_turn))
# Specialist tasks receive their Send payload, not the Execution state.
graph.add_node("specialist_task", cast(Any, nodes.specialist_task))
graph.add_node("await_user", cast(Any, nodes.await_user))
graph.add_node("finalize", cast(Any, nodes.finalize))
graph.add_node("end_with_warnings", cast(Any, nodes.end_with_warnings))
graph.add_edge(START, "orchestrator_turn")
graph.add_edge("specialist_task", "orchestrator_turn")
graph.add_edge("finalize", END)
graph.add_edge("end_with_warnings", END)
return graph