feat: serve Executions over A2A with a pre-approved /generate
Increment 7 of .scratch/solution-architect-agent/spec.md. - app/assembly.py: composition root building the engine from settings and the provider bundle (roles, ADK runtime, MCP catalog, Terraform tools, checkpointer, recorder). - app/a2a: a2a-sdk 1.1 JSON-RPC server (v0.3 compatible) mapping tasks to Executions; questions, Approvals and permissions pause as input-required; Approvals accepted only as structured data; completed tasks return the guide and code as artifacts; agent card derived from the dependency graph. - POST /generate runs a pre-approved Execution with the legacy keys. - Specialist exceptions are relayed to the user; Orchestrator exceptions fail the task. Engine accepts a caller-chosen execution id. - Dockerfile installs checksum-verified Terraform and ships agents, providers and skills; add mcp and a2a-sdk requirements. - 17 new tests; full suite 206 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
66
app/a2a/card.py
Normal file
66
app/a2a/card.py
Normal file
@@ -0,0 +1,66 @@
|
||||
"""The A2A agent card, derived from the dependency graph and settings."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from a2a.types import (
|
||||
AgentCapabilities,
|
||||
AgentCard,
|
||||
AgentInterface,
|
||||
AgentProvider,
|
||||
AgentSkill,
|
||||
)
|
||||
|
||||
from app.config import Settings
|
||||
from app.execution.deliverables import PHASE_ORDER, deliverables_in
|
||||
|
||||
A2A_PATH = "/a2a"
|
||||
|
||||
|
||||
def build_agent_card(settings: Settings) -> AgentCard:
|
||||
base_url = (
|
||||
settings.A2A_PUBLIC_URL or f"http://{settings.A2A_HOST}:{settings.A2A_PORT}"
|
||||
).rstrip("/")
|
||||
phases = "; ".join(
|
||||
f"{phase.value}: {', '.join(kind.value for kind in deliverables_in(phase))}"
|
||||
for phase in PHASE_ORDER
|
||||
)
|
||||
return AgentCard(
|
||||
name=settings.AGENT_NAME,
|
||||
description=(
|
||||
"Designs a cloud solution architecture with you: requirements discovery, "
|
||||
"grounded product selection, diagram, design recommendations, "
|
||||
"infrastructure-as-code and dry-run validation, packaged as a solution "
|
||||
f"guide. Cloud provider: {settings.CLOUD_PROVIDER}."
|
||||
),
|
||||
version=settings.AGENT_VERSION,
|
||||
provider=AgentProvider(
|
||||
organization="Kyndryl Agent Builder", url="https://www.kyndryl.com"
|
||||
),
|
||||
supported_interfaces=[
|
||||
AgentInterface(
|
||||
url=f"{base_url}{A2A_PATH}",
|
||||
protocol_binding="JSONRPC",
|
||||
protocol_version="1.0",
|
||||
)
|
||||
],
|
||||
capabilities=AgentCapabilities(streaming=True, push_notifications=False),
|
||||
default_input_modes=["text/plain", "application/json"],
|
||||
default_output_modes=["text/plain", "text/markdown", "application/json"],
|
||||
skills=[
|
||||
AgentSkill(
|
||||
id="solution-architecture",
|
||||
name="Cloud solution architecture",
|
||||
description=(
|
||||
"Interactive, multi-turn engagement. Phases and their Deliverables: "
|
||||
f"{phases}. Each Phase needs your approval, sent as data."
|
||||
),
|
||||
tags=["architecture", "cloud", settings.CLOUD_PROVIDER, "terraform"],
|
||||
examples=[
|
||||
"Design a regional event ingestion platform on Google Cloud.",
|
||||
"Migrate our on-premises order service to managed services.",
|
||||
],
|
||||
input_modes=["text/plain", "application/json"],
|
||||
output_modes=["text/plain", "text/markdown", "application/json"],
|
||||
)
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user