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:
2026-09-16 10:23:24 +01:00
parent ed104e5697
commit ad371b2ec4
19 changed files with 1116 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ Driven entirely through ExecutionEngine.start/resume with a scripted agent runti
from pathlib import Path
import pytest
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
@@ -629,3 +630,34 @@ async def test_paused_execution_resumes_from_a_durable_checkpoint(tmp_path):
"questions": [{"from": "orchestrator", "question": "Resumed"}]
}
assert resumed.state["ledger"]["phases"]["requirements_discovery"] == "approved"
# --- identity and failures ------------------------------------------------------------------
async def test_caller_can_choose_the_execution_id_once(tmp_path):
runtime = FakeAgentRuntime({"orchestrator": [[ask_user("Hello?")]]})
engine = make_engine(tmp_path, runtime)
first = await engine.start("Ingestion", execution_id="task-123")
assert first.execution_id == "task-123"
with pytest.raises(ValueError, match="task-123"):
await engine.start("Again", execution_id="task-123")
async def test_a_failing_specialist_is_relayed_to_the_user_as_a_question(tmp_path):
class Failing(FakeAgentRuntime):
async def run(self, role, task, tools):
if role.name == specialist(K.REQUIREMENTS):
raise RuntimeError("model API unavailable")
return await super().run(role, task, tools)
runtime = Failing({"orchestrator": [[delegate(K.REQUIREMENTS)], [ask_user()]]})
result = await make_engine(tmp_path, runtime).start("Ingestion")
[question] = result.prompt["questions"]
assert question["from"] == "requirements"
assert "model API unavailable" in question["question"]
assert result.state["ledger"]["deliverables"]["requirements"]["status"] == "pending"