feat: the solution architecture agent on the shared Execution engine

The reference agent's subject, cloud solution architecture, as an agent in
the operating model agent's pattern: the Execution engine (from
orchestration_engine) and one Workflow in app/solution_architecture,
built for the settings and provider bundle by assembly.workflow_for.

Copied from gcp_solution_architecture_agent at 8b397cd without its own
engine: its role files, Skills, provider bundle, ADRs, vocabulary, scripts
and evaluation datasets. The image takes the engine from a named build
context and installs Terraform. It is called through the Orchestration
engine, and its files are what the operating model agent digests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 19:49:28 +01:00
commit c84dbdea20
127 changed files with 14672 additions and 0 deletions

0
tests/__init__.py Normal file
View File

123
tests/support.py Normal file
View File

@@ -0,0 +1,123 @@
"""Scripted turns for a whole Execution of this agent's Workflow on its real roles."""
from __future__ import annotations
import json
from typing import Any
from execution_engine.adk.fake_runtime import Call
from app.solution_architecture.workflow import (
DEPENDENCY_GRAPH,
SAMPLE_DATA,
DeliverableKind,
sample_submission,
)
K = DeliverableKind
# A complete spec, small: the essential fields stated or left to the agent.
SPEC = """\
metadata:
customer_case: bench
engagement:
kind: workload
intent:
statement: Accept webhooks and keep them for replay.
estate:
cloud_provider: gcp
mode: greenfield
regions:
primary: europe-west2
data_residency: United Kingdom
compliance:
frameworks: [ISO27001]
data_classification: internal
workload:
users:
who: decide
count: decide
availability:
target: decide
cost:
monthly_budget: decide
"""
# The fields of SPEC that bind the design: each is carried by a requirement.
BINDING = [
"estate.regions.primary",
"estate.data_residency",
"compliance.frameworks",
"compliance.data_classification",
]
def submission(kind: DeliverableKind, **files: str) -> Call:
call = sample_submission(kind)
return Call(
call.tool, {**call.args, "attachments": {**call.args["attachments"], **files}}
)
def carrying(sources: list[str]) -> dict[str, list[Any]]:
"""Turns for the Specialists along the Requirements chain in which one more
requirement, NFR-2, carries what the customer stated (`sources`), and a Check,
K-3, holds the design to it. From the Execution engine's tests."""
requirements = json.loads(SAMPLE_DATA["requirements.json"])
requirements.append(
{
"id": "NFR-2",
"kind": "non_functional",
"text": "The design honours what the customer stated.",
"conditions": ["Each stated choice is configured as stated."],
"from": sources,
}
)
components = json.loads(SAMPLE_DATA["components.json"])
components[0]["requirements"].append("NFR-2")
graph = json.loads(SAMPLE_DATA["target-architecture.json"])
graph["checks"].append(
{
"id": "K-3",
"applies_to": "E-1",
"source": "NFR-2",
"statement": "the stated choices are configured",
}
)
implementation = json.loads(SAMPLE_DATA["implementation.json"])
implementation.append(
{"check": "K-3", "file": "terraform/main.tf", "address": "example.run"}
)
verdicts = json.loads(SAMPLE_DATA["verdicts.json"])
verdicts["checks"].append(
{"check": "K-3", "verdict": "pass", "evidence": "Configured as stated."}
)
files = {
K.REQUIREMENTS: {"requirements.json": json.dumps(requirements)},
K.TECHNICAL_DECOMPOSITION: {"components.json": json.dumps(components)},
K.TARGET_ARCHITECTURE: {"target-architecture.json": json.dumps(graph)},
K.DEPLOYMENT_GUIDANCE: {"implementation.json": json.dumps(implementation)},
K.VALIDATION_RESULTS: {"verdicts.json": json.dumps(verdicts)},
}
return {
DEPENDENCY_GRAPH[kind].specialist: [[submission(kind, **attached)]]
for kind, attached in files.items()
}
def whole_execution() -> dict[str, list[Any]]:
"""Every Specialist submits once: the scope analyst SPEC, the Requirements chain
carrying its binding fields, the rest their samples."""
turns: dict[str, list[Any]] = {
spec.specialist: [[sample_submission(kind)]]
for kind, spec in DEPENDENCY_GRAPH.items()
}
turns[DEPENDENCY_GRAPH[K.SCOPE].specialist] = [
[submission(K.SCOPE, **{"scope.yaml": SPEC})]
]
turns.update(carrying(BINDING))
# The schema review reads the sample's placeholder resource types against the
# provider when Terraform is installed, and lets the run's next submission through.
architect = DEPENDENCY_GRAPH[K.TARGET_ARCHITECTURE].specialist
(only_turn,) = turns[architect]
turns[architect] = [only_turn * 2]
return turns

84
tests/test_assembly.py Normal file
View File

@@ -0,0 +1,84 @@
"""The agent assembled from its own folder on the Execution engine: its role files,
its Skills and its provider bundle, with a scripted runtime in place of models."""
from __future__ import annotations
from pathlib import Path
from typing import Any
from execution_engine.adk.fake_runtime import FakeAgentRuntime
from execution_engine.agent import open_assembly
from execution_engine.config import Settings
from execution_engine.recorder import InMemoryRecorder
from app.main import ROOT
from app.solution_architecture.assembly import workflow_for
from app.solution_architecture.workflow import DEPENDENCY_GRAPH, WORKFLOW
from tests.support import SPEC, whole_execution
CASE = "bench"
# What the operating model agent digests of a completed architecture Execution.
DIGESTED = {
"components.json",
"products.json",
"recommendations.json",
"requirements.json",
"scope.json",
"target-architecture.json",
"verdicts.json",
"work-breakdown.json",
}
def settings(**overrides: Any) -> Settings:
values: dict[str, Any] = {
"CLOUD_PROVIDER": "gcp",
"CHECKPOINTER": "memory",
"MCP_ENABLED": False,
"LESSONS_ENABLED": False,
}
values.update(overrides)
return Settings(_env_file=None, **values) # type: ignore[call-arg]
def assembled(tmp_path: Path, runtime: FakeAgentRuntime, **overrides: Any) -> Any:
return open_assembly(
settings(**overrides),
workflow_for,
root=ROOT,
runtime=runtime,
recorder=InMemoryRecorder(),
output_root=tmp_path,
)
async def test_every_role_the_workflow_names_has_its_file(tmp_path):
async with assembled(tmp_path, FakeAgentRuntime({})) as assembly:
roles = set(assembly.roles)
assert {spec.specialist for spec in DEPENDENCY_GRAPH.values()} <= roles
assert {"orchestrator", "reply-writer"} <= roles
assert assembly.bundle.name == "gcp"
# The pillar advisors come from the provider bundle's pillar Skills.
assert assembly.engine.workflow.role_tools is not None
async def test_a_pre_approved_execution_delivers_what_the_operating_model_reads(
tmp_path,
):
async with assembled(tmp_path, FakeAgentRuntime(whole_execution())) as assembly:
result = await assembly.engine.start(
"Accept webhooks and keep them for replay.",
pre_approved=True,
customer_case=CASE,
scope=SPEC,
)
assert result.status == "completed", result.state.get("warnings")
out = tmp_path / "deliverables" / "cases" / CASE / "executions"
folder = next(out.iterdir())
written = {path.name for path in folder.rglob("*.json")}
assert DIGESTED <= written
assert (folder / "execution.json").is_file()
assert (folder / WORKFLOW.final_file).is_file()