53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
"""Building the engine from settings and the provider bundle."""
|
|
|
|
from typing import Any
|
|
|
|
from app.adk.fake_runtime import Call, FakeAgentRuntime
|
|
from app.agent import open_assembly
|
|
from app.config import Settings
|
|
from app.recorder import InMemoryRecorder
|
|
|
|
|
|
def settings(tmp_path, **overrides) -> Settings:
|
|
values: dict[str, Any] = {
|
|
"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
|