This commit is contained in:
@@ -9,11 +9,11 @@ import pytest
|
||||
from langgraph.checkpoint.memory import InMemorySaver
|
||||
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
|
||||
|
||||
from app.agents.fake_runtime import Call, FakeAgentRuntime
|
||||
from app.agents.runtime import RoleSpec, ToolResult, ToolSpec
|
||||
from app.execution.deliverables import DEPENDENCY_GRAPH, DeliverableKind, PhaseId
|
||||
from app.execution.engine import ExecutionEngine
|
||||
from app.execution.recorder import InMemoryRecorder
|
||||
from app.adk.fake_runtime import Call, FakeAgentRuntime
|
||||
from app.adk.runtime import RoleSpec, ToolResult, ToolSpec
|
||||
from app.agent import ExecutionEngine
|
||||
from app.recorder import InMemoryRecorder
|
||||
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind, PhaseId
|
||||
|
||||
K = DeliverableKind
|
||||
P = PhaseId
|
||||
@@ -661,3 +661,28 @@ async def test_a_failing_specialist_is_relayed_to_the_user_as_a_question(tmp_pat
|
||||
assert question["from"] == "requirements"
|
||||
assert "model API unavailable" in question["question"]
|
||||
assert result.state["ledger"]["deliverables"]["requirements"]["status"] == "pending"
|
||||
|
||||
|
||||
async def test_pre_approved_questions_use_matching_scripted_answers(tmp_path):
|
||||
runtime = FakeAgentRuntime(
|
||||
{
|
||||
"orchestrator": [
|
||||
[ask_user("What is the RTO?", "Which region?")],
|
||||
[ask_user("Anything else?")],
|
||||
]
|
||||
}
|
||||
)
|
||||
engine = make_engine(tmp_path, runtime, max_orchestrator_turns=2)
|
||||
|
||||
result = await engine.start(
|
||||
"Ingestion",
|
||||
pre_approved=True,
|
||||
scripted_answers=[(r"\bRTO\b", "One hour."), ("region", "europe-west2")],
|
||||
)
|
||||
|
||||
first_reply = result.state["conversation"][2]["text"]
|
||||
assert "Q: What is the RTO?\nA: One hour." in first_reply
|
||||
assert "Q: Which region?\nA: europe-west2" in first_reply
|
||||
assert "No user is available" not in first_reply
|
||||
second_reply = result.state["conversation"][4]["text"]
|
||||
assert second_reply.startswith("No user is available")
|
||||
|
||||
Reference in New Issue
Block a user