Files
solution_architecture_agent/tests/test_assembly.py
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

85 lines
2.7 KiB
Python

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