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:
50
tests/test_assembly.py
Normal file
50
tests/test_assembly.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""Building the engine from settings and the provider bundle."""
|
||||
|
||||
from app.agents.fake_runtime import Call, FakeAgentRuntime
|
||||
from app.assembly import open_assembly
|
||||
from app.config import Settings
|
||||
from app.execution.recorder import InMemoryRecorder
|
||||
|
||||
|
||||
def settings(tmp_path, **overrides) -> Settings:
|
||||
values = {
|
||||
"CHECKPOINTER": "memory",
|
||||
"MCP_ENABLED": False,
|
||||
"ORCHESTRATOR_BUDGET": 9,
|
||||
"SPECIALIST_BUDGET": 4,
|
||||
}
|
||||
values.update(overrides)
|
||||
return Settings(**values)
|
||||
|
||||
|
||||
async def test_assembly_wires_roles_budgets_and_tools_from_settings(tmp_path):
|
||||
runtime = FakeAgentRuntime(
|
||||
{"orchestrator": [[Call("ask_user", {"questions": ["Which region?"]})]]}
|
||||
)
|
||||
|
||||
async with open_assembly(
|
||||
settings(tmp_path),
|
||||
runtime=runtime,
|
||||
recorder=InMemoryRecorder(),
|
||||
output_root=tmp_path,
|
||||
) as assembly:
|
||||
interaction = await assembly.engine.start("Design ingestion")
|
||||
|
||||
assert interaction.prompt["questions"][0]["question"] == "Which region?"
|
||||
assert assembly.bundle.name == "gcp"
|
||||
assert assembly.roles["orchestrator"].budget == 9
|
||||
assert assembly.roles["validator"].budget == 4
|
||||
assert assembly.mcp_gaps == {}
|
||||
|
||||
|
||||
async def test_preview_mcp_servers_follow_the_setting(tmp_path):
|
||||
async with open_assembly(
|
||||
settings(tmp_path, MCP_ENABLE_PREVIEW=False),
|
||||
runtime=FakeAgentRuntime({}),
|
||||
recorder=InMemoryRecorder(),
|
||||
output_root=tmp_path,
|
||||
) as assembly:
|
||||
servers = assembly.roles["requirements-analyst"].mcp_servers
|
||||
|
||||
assert "asset_inventory" not in servers
|
||||
assert "compute" in servers
|
||||
Reference in New Issue
Block a user