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>
87 lines
3.5 KiB
Python
87 lines
3.5 KiB
Python
"""The Reference's Workflow for one deployment: its settings and its provider bundle.
|
|
|
|
In the Reference this is the body of `open_assembly` in `app/agent.py`: the
|
|
Terraform runner, the local tools built on it, and the reviews of a design before
|
|
it is submitted.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import dataclasses
|
|
from typing import Any
|
|
|
|
from execution_engine.adk.runtime import SubmissionReview
|
|
from execution_engine.tools.jev import JevDecider
|
|
from execution_engine.workflows.workflow import Assembling, LocalToolBuilder, Workflow
|
|
|
|
from app.solution_architecture.coverage import CoverageReview
|
|
from app.solution_architecture.design_review import DesignCoverageReview
|
|
from app.solution_architecture.hooks import (
|
|
COVERAGE_REVIEWER,
|
|
MODULES_OPTION,
|
|
consultations,
|
|
modules_option,
|
|
pillar_hints,
|
|
)
|
|
from app.solution_architecture.local import TerraformRunner, local_tools
|
|
from app.solution_architecture.requirements_review import RequirementsReview
|
|
from app.solution_architecture.schema_review import Reviews, SchemaReview
|
|
from app.solution_architecture.workflow import WORKFLOW
|
|
|
|
|
|
def _runner(given: Assembling) -> TerraformRunner:
|
|
settings, bundle = given.settings, given.bundle
|
|
return TerraformRunner(
|
|
binary=settings.TERRAFORM_BINARY,
|
|
timeout_seconds=settings.TERRAFORM_TIMEOUT_SECONDS,
|
|
plugin_cache_dir=settings.terraform_plugin_cache(),
|
|
providers=bundle.terraform_providers,
|
|
module_namespaces=bundle.terraform_module_namespaces,
|
|
)
|
|
|
|
|
|
def local(given: Assembling) -> LocalToolBuilder:
|
|
runner = _runner(given)
|
|
offered = [name for names in given.bundle.tools.values() for name in names]
|
|
return lambda working_copy: local_tools(offered, runner, working_copy)
|
|
|
|
|
|
def reviews(given: Assembling) -> SubmissionReview | None:
|
|
"""What is looked at in a design before it is submitted. Each raises what it
|
|
finds once and never blocks."""
|
|
settings, bundle, decider = given.settings, given.bundle, given.decider
|
|
found: list[SubmissionReview] = []
|
|
if bundle.terraform_providers:
|
|
# In code: every setting a Check names exists on its resource type.
|
|
found.append(SchemaReview(_runner(given)))
|
|
if settings.JEV_REQUIREMENTS_REVIEW and isinstance(decider, JevDecider):
|
|
# Optional, and off by default: Jev says whether a requirement names a product.
|
|
found.append(
|
|
RequirementsReview(decider, act=settings.JEV_REQUIREMENTS_THRESHOLD)
|
|
)
|
|
if settings.DESIGN_COVERAGE_REVIEW and COVERAGE_REVIEWER in given.roles:
|
|
# A model reads the requirements against the Checks, once, before the
|
|
# design is approved: the reading the validator would make after the code.
|
|
found.append(
|
|
DesignCoverageReview(given.runtime, given.roles[COVERAGE_REVIEWER])
|
|
)
|
|
if settings.JEV_COVERAGE_REVIEW and isinstance(decider, JevDecider):
|
|
# Optional, and off by default: Jev says which Check verifies each condition.
|
|
found.append(CoverageReview(decider, none_at=settings.JEV_COVERAGE_THRESHOLD))
|
|
return Reviews(found) if found else None
|
|
|
|
|
|
def workflow_for(settings: Any, bundle: Any) -> Workflow:
|
|
return dataclasses.replace(
|
|
WORKFLOW,
|
|
role_tools=consultations(bundle.pillar_skills),
|
|
task_hints=pillar_hints(settings.JEV_PILLAR_THRESHOLD),
|
|
options={
|
|
MODULES_OPTION: modules_option(
|
|
bool(bundle.terraform_module_namespaces), settings.TERRAFORM_MODULES
|
|
)
|
|
},
|
|
local_tools=local,
|
|
reviews=reviews,
|
|
)
|