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

80 lines
2.9 KiB
Python

"""A review of the requirements: they describe the problem, not the solution.
Requirements discovery is kept apart from solutioning, so a requirement names no
product. That rule was an instruction the engine could not enforce; the evaluation
checked it only afterwards, against a list of product names. This asks the decider
(ADR-0007), once per requirement, whether it names a cloud product or managed
service. It never blocks: what it raises is returned to the Specialist once.
"""
from __future__ import annotations
import logging
from collections.abc import Mapping, Sequence
from typing import Any
from execution_engine.adk.runtime import Decider, Question
from app.solution_architecture.chain import REQUIREMENTS_FILE, read_list
from app.solution_architecture.kinds import DeliverableKind
logger = logging.getLogger(__name__)
_TEXT = 200
class RequirementsReview:
def __init__(self, decider: Decider, *, act: float = 0.3) -> None:
self._decider = decider
# Lower than the router's threshold, from measurement on 2026-10-08: across
# 61 requirements from three passed runs the highest answer was 0.10, and
# requirements written to name a product scored 0.34, 0.61 and 0.93.
self._act = act
async def __call__(
self,
kind: DeliverableKind,
attachments: Mapping[str, str],
upstream: Mapping[str, Mapping[str, Any]] | None,
scope: str = "",
) -> Sequence[str]:
"""The requirements that name a product, each as a line for the Specialist."""
if kind != DeliverableKind.REQUIREMENTS:
return ()
items = [
item
for item in read_list(
{"requirements": {"attachments": attachments}},
"requirements",
REQUIREMENTS_FILE,
)
if isinstance(item.get("id"), str) and isinstance(item.get("text"), str)
]
if not items:
return ()
answers = await self._decider.decide(
"Requirements for a workload, written before any product is chosen.",
{
item["id"]: Question(
"noul",
f'Requirement: "{item["text"]}". Does it name a specific cloud '
"provider's product or managed service, as opposed to "
"describing what is needed?",
)
for item in items
},
scope=scope,
)
if not answers:
return ()
raised = [
f'{item["id"]} names a product or service: "{item["text"][:_TEXT]}". '
"Say what is needed, not what to use"
for item in items
if (answer := answers.get(item["id"])) is not None
and answer.is_yes(self._act)
]
if raised:
logger.info("[%s] requirements review raised %d", scope, len(raised))
return tuple(raised)