feat(skill-learning): run replay arms through agent loop
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from types import SimpleNamespace
|
||||
|
||||
from beaver.skills.learning.replay import ReplayArmRequest, ReplayRunner
|
||||
|
||||
|
||||
class FakeAgentLoop:
|
||||
def boot(self):
|
||||
return SimpleNamespace(tool_executor=SimpleNamespace(), tool_registry=SimpleNamespace(get=lambda name: None))
|
||||
|
||||
async def process_direct(self, task: str, **kwargs):
|
||||
executor = kwargs["tool_executor_override"]
|
||||
await executor.execute("mcp_outlook_send_email", {"to": "ada@example.com"})
|
||||
return SimpleNamespace(session_id="session-replay", run_id="run-replay", output_text="done", finish_reason="stop")
|
||||
|
||||
|
||||
def test_replay_runner_returns_arm_report_with_tool_trace() -> None:
|
||||
runner = ReplayRunner(agent_loop=FakeAgentLoop())
|
||||
request = ReplayArmRequest(
|
||||
case_id="case-1",
|
||||
arm="candidate",
|
||||
task_text="Send a status email to Ada.",
|
||||
pinned_skill_names=[],
|
||||
pinned_skill_contexts=[],
|
||||
provider_bundle=object(),
|
||||
model_settings={"max_tool_iterations": 2},
|
||||
)
|
||||
|
||||
report = asyncio.run(runner.run_arm(request))
|
||||
|
||||
assert report["case_id"] == "case-1"
|
||||
assert report["arm"] == "candidate"
|
||||
assert report["finish_reason"] == "stop"
|
||||
assert report["tool_calls"][0]["tool_name"] == "mcp_outlook_send_email"
|
||||
Reference in New Issue
Block a user