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:
97
scripts/check-terraform-modules.py
Normal file
97
scripts/check-terraform-modules.py
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Review the published Terraform modules a provider bundle's modules Skill uses.
|
||||
|
||||
For each module the Skill's examples call: the version pinned there, the latest in
|
||||
the registry, and whether the latest still works with the pinned provider. For each
|
||||
module the bundle lists under `terraform.modules.watch`, which could not be used
|
||||
when last looked at: whether its latest version now can.
|
||||
|
||||
It reads the public registry and changes nothing. Raising a pinned version is a
|
||||
change to the Skill's example, which `tests/test_iac_modules.py` then validates.
|
||||
|
||||
Usage: .venv/bin/python scripts/check-terraform-modules.py [provider]
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from execution_engine.adk.runtime import ToolResult
|
||||
from execution_engine.providers import load_provider
|
||||
|
||||
from app.solution_architecture.modules import ModuleLookup, admits, module_calls
|
||||
|
||||
_HCL = re.compile(r"^```hcl\n(.*?)^```", re.MULTILINE | re.DOTALL)
|
||||
|
||||
|
||||
def _blocked(part: dict, pinned: dict[str, str]) -> list[str]:
|
||||
"""The provider requirements of a module that the pinned versions do not meet."""
|
||||
return [
|
||||
f"{need.get('name')} {need.get('version')}"
|
||||
for need in part.get("provider_dependencies") or []
|
||||
if need.get("name") in pinned
|
||||
and need.get("version")
|
||||
and not admits(need["version"], pinned[need["name"]])
|
||||
]
|
||||
|
||||
|
||||
async def main(provider: str) -> int:
|
||||
bundle = load_provider(provider)
|
||||
if not bundle.terraform_modules_skill:
|
||||
print(f"The {provider} bundle names no modules Skill.")
|
||||
return 0
|
||||
pinned = {name: pin["version"] for name, pin in bundle.terraform_providers.items()}
|
||||
lookup = ModuleLookup(namespaces=bundle.terraform_module_namespaces, pinned=pinned)
|
||||
skill = bundle.skills[bundle.terraform_modules_skill].path
|
||||
|
||||
used: dict[str, set[str]] = {}
|
||||
for reference in sorted((skill / "references").glob("*.md")):
|
||||
code = "\n".join(_HCL.findall(reference.read_text(encoding="utf-8")))
|
||||
for call in module_calls({"main.tf": code}):
|
||||
used.setdefault(call.source.split("//")[0], set()).add(call.version)
|
||||
|
||||
stale = 0
|
||||
print(f"Pinned providers: {pinned}\n\nModules the Skill uses:")
|
||||
for module, versions in sorted(used.items()):
|
||||
data = await lookup._fetch(module, "")
|
||||
if isinstance(data, ToolResult):
|
||||
print(f" {module}: {data.message}")
|
||||
continue
|
||||
latest = str(data.get("version", "?"))
|
||||
blocked = _blocked(data.get("root") or {}, pinned)
|
||||
note = "up to date" if versions == {latest} else f"latest is {latest}"
|
||||
if versions != {latest}:
|
||||
stale += 1
|
||||
if blocked:
|
||||
note += f"; the latest needs {', '.join(blocked)}, so stay on the pin"
|
||||
print(f" {module} {', '.join(sorted(versions))}: {note}")
|
||||
|
||||
print("\nModules that could not be used when last looked at:")
|
||||
usable = 0
|
||||
for name in bundle.terraform_modules_watch:
|
||||
data = await lookup._fetch(name, "")
|
||||
if isinstance(data, ToolResult):
|
||||
print(f" {name}: {data.message}")
|
||||
continue
|
||||
blocked = _blocked(data.get("root") or {}, pinned)
|
||||
if blocked:
|
||||
print(f" {name} {data.get('version')}: still needs {', '.join(blocked)}")
|
||||
else:
|
||||
usable += 1
|
||||
print(
|
||||
f" {name} {data.get('version')}: NOW USABLE with the pinned provider"
|
||||
)
|
||||
print(
|
||||
f"\n{stale} pinned module(s) have a newer version; {usable} watched "
|
||||
"module(s) can now be used."
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(asyncio.run(main(sys.argv[1] if len(sys.argv) > 1 else "gcp")))
|
||||
80
scripts/list-mcp-tools.py
Normal file
80
scripts/list-mcp-tools.py
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
"""List every tool a provider bundle's remote MCP servers offer, with read-only hints.
|
||||
|
||||
Use it to review allowlists: only list tools; this never calls one.
|
||||
|
||||
Usage: .venv/bin/python scripts/list-mcp-tools.py [provider] [--json] [--no-auth]
|
||||
|
||||
--no-auth lists without credentials; Google Cloud MCP servers allow tools/list anonymously.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from execution_engine.config import get_settings
|
||||
from execution_engine.providers import load_provider
|
||||
from execution_engine.tools.mcp import McpClient, NoAuth, auth_from_config
|
||||
|
||||
|
||||
async def main(provider: str, as_json: bool, no_auth: bool) -> int:
|
||||
bundle = load_provider(provider)
|
||||
auth = (
|
||||
NoAuth()
|
||||
if no_auth
|
||||
else auth_from_config(bundle.mcp_auth, get_settings().MCP_QUOTA_PROJECT)
|
||||
)
|
||||
report: dict[str, dict[str, Any]] = {}
|
||||
for server in bundle.mcp_servers.values():
|
||||
try:
|
||||
tools = await McpClient(server, auth, timeout=30).list_tools()
|
||||
except Exception as exc: # noqa: BLE001 - report every server
|
||||
report[server.id] = {
|
||||
"url": server.url,
|
||||
"error": f"{type(exc).__name__}: {exc}",
|
||||
}
|
||||
continue
|
||||
report[server.id] = {
|
||||
"url": server.url,
|
||||
"tools": [
|
||||
{
|
||||
"name": tool.name,
|
||||
"read_only": tool.read_only,
|
||||
"allowed": tool.name in server.allow,
|
||||
"description": tool.description.split("\n")[0][:200],
|
||||
}
|
||||
for tool in tools
|
||||
],
|
||||
}
|
||||
if as_json:
|
||||
print(json.dumps(report, indent=2))
|
||||
return 0
|
||||
for server_id, entry in report.items():
|
||||
print(f"\n== {server_id} ({entry['url']})")
|
||||
if "error" in entry:
|
||||
print(f" ERROR {entry['error'][:200]}")
|
||||
continue
|
||||
for tool in entry["tools"]:
|
||||
flag = "RO" if tool["read_only"] else "RW"
|
||||
allowed = "allowed" if tool["allowed"] else ""
|
||||
print(f" [{flag}] {tool['name']:<40} {allowed:<8} {tool['description']}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = [a for a in sys.argv[1:] if not a.startswith("--")]
|
||||
sys.exit(
|
||||
asyncio.run(
|
||||
main(
|
||||
args[0] if args else "gcp",
|
||||
"--json" in sys.argv,
|
||||
"--no-auth" in sys.argv,
|
||||
)
|
||||
)
|
||||
)
|
||||
71
scripts/sync-vendored-skills.sh
Executable file
71
scripts/sync-vendored-skills.sh
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
# Re-vendor upstream Agent Skills from github.com/google/skills at a pinned commit.
|
||||
#
|
||||
# Usage: scripts/sync-vendored-skills.sh [<40-char commit sha>]
|
||||
#
|
||||
# Replaces skills/vendor/google/ wholesale, then rewrites SHA256SUMS and VENDOR.md.
|
||||
# Never edit vendored files by hand: review the upstream diff, then re-run this script.
|
||||
set -euo pipefail
|
||||
|
||||
REPO="google/skills"
|
||||
DEFAULT_COMMIT="81a31a6e4300425598a69fd96c8e843c947ae308"
|
||||
COMMIT="${1:-$DEFAULT_COMMIT}"
|
||||
SKILLS=(
|
||||
google-cloud-solution-architecture
|
||||
google-cloud-waf-security
|
||||
google-cloud-waf-reliability
|
||||
google-cloud-waf-cost-optimization
|
||||
google-cloud-waf-operational-excellence
|
||||
google-cloud-waf-performance-optimization
|
||||
google-cloud-waf-sustainability
|
||||
)
|
||||
|
||||
if [[ ! "$COMMIT" =~ ^[0-9a-f]{40}$ ]]; then
|
||||
echo "error: commit must be a full 40-character sha, got '$COMMIT'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
DEST="$ROOT/skills/vendor/google"
|
||||
TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
|
||||
echo "Fetching $REPO@$COMMIT"
|
||||
curl -fsSL "https://codeload.github.com/$REPO/tar.gz/$COMMIT" | tar -xz -C "$TMP"
|
||||
SRC="$TMP/skills-$COMMIT"
|
||||
[[ -d "$SRC" ]] || { echo "error: unexpected archive layout in $TMP" >&2; exit 1; }
|
||||
|
||||
rm -rf "$DEST"
|
||||
mkdir -p "$DEST"
|
||||
for skill in "${SKILLS[@]}"; do
|
||||
[[ -f "$SRC/skills/cloud/$skill/SKILL.md" ]] || { echo "error: $skill not found upstream" >&2; exit 1; }
|
||||
cp -R "$SRC/skills/cloud/$skill" "$DEST/$skill"
|
||||
done
|
||||
cp "$SRC/LICENSE" "$DEST/LICENSE"
|
||||
|
||||
(
|
||||
cd "$DEST"
|
||||
find . -type f ! -name SHA256SUMS ! -name VENDOR.md | sed 's#^\./##' | LC_ALL=C sort \
|
||||
| while IFS= read -r file; do sha256sum "$file"; done > SHA256SUMS
|
||||
)
|
||||
|
||||
{
|
||||
echo "# Vendored Agent Skills: google/skills"
|
||||
echo
|
||||
echo "Unmodified copies of upstream Agent Skills. Do not edit these files; re-run"
|
||||
echo "\`scripts/sync-vendored-skills.sh <commit>\` and review the diff instead (ADR-0002)."
|
||||
echo
|
||||
echo "- Source: https://github.com/$REPO"
|
||||
echo "- Commit: \`$COMMIT\`"
|
||||
echo "- Synced: $(date -u +%Y-%m-%d)"
|
||||
echo "- Licence: Apache License 2.0, see \`LICENSE\`"
|
||||
echo "- Integrity: \`SHA256SUMS\` lists every vendored file; \`tests/test_vendored_skills.py\` verifies it."
|
||||
echo
|
||||
echo "## Skills"
|
||||
echo
|
||||
for skill in "${SKILLS[@]}"; do
|
||||
echo "- \`$skill\` (upstream \`skills/cloud/$skill\`)"
|
||||
done
|
||||
} > "$DEST/VENDOR.md"
|
||||
|
||||
echo "Vendored ${#SKILLS[@]} skills into ${DEST#"$ROOT"/}"
|
||||
Reference in New Issue
Block a user