Files
Jonathan Boniface c84dbdea20 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>
2026-10-21 19:49:28 +01:00

124 lines
4.0 KiB
Python

"""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