| 123456789101112131415161718192021222324252627282930 |
- """判定 find_agent 调度执行是否真正成功完成。"""
- from __future__ import annotations
- from dataclasses import dataclass
- from supply_agent.types import AgentResult
- from supply_infra.services.video_discovery_service import get_video_discovery_service
- @dataclass(frozen=True)
- class FindAgentRunOutcome:
- succeeded: bool
- failure_reason: str | None = None
- def evaluate_find_agent_run(
- run_id: str,
- agent_result: AgentResult | None = None,
- ) -> FindAgentRunOutcome:
- """有候选写入即成功:``video_discovery_candidate`` 按 run_id 存在记录。
- ``agent_result`` 保留给调用方兼容,不再参与成败判定。
- """
- del agent_result # 成败只看库表,不看模型最终文案
- if get_video_discovery_service().has_candidates(run_id):
- return FindAgentRunOutcome(succeeded=True)
- return FindAgentRunOutcome(
- succeeded=False,
- failure_reason="no_candidates",
- )
|