Spaces:
Sleeping
Sleeping
File size: 1,677 Bytes
fdfe81a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | """Lead Auditor Agent β final dedupe / merge over collected findings.
* No SDK ``handoffs`` β the Python orchestrator in ``agents.runner`` invokes
this agent once with the union of slide + deck findings.
* No must-flag enforcement here β that lives in ``agents.runner`` so the
guarantee is deterministic Python, not LLM behaviour.
* Tools are limited to the rubric lookups so the agent can ground a merge
decision (e.g. confirm two findings share a category) but cannot
re-scan slide content from scratch.
"""
from __future__ import annotations
import os
from agents import Agent
from agents._prompt_loader import load_prompt
from agents.context import AuditContext
from agents.output_schemas import FinalAuditResult
from agents.tools import (
get_rubric_section,
list_rubric_categories,
)
def _model_name() -> str:
"""Return the OpenAI model for the final merge / dedupe pass.
Lead Auditor merges everything β wants the strong model. Defaults to
``gpt-4o``; override with ``OPENAI_MODEL_MERGE`` (or legacy
``OPENAI_MODEL``).
"""
return (
os.environ.get("OPENAI_MODEL_MERGE")
or os.environ.get("OPENAI_MODEL")
or "gpt-4o"
)
lead_auditor: Agent[AuditContext] = Agent[AuditContext](
name="Lead Auditor",
instructions=load_prompt("lead_auditor"),
model=_model_name(),
tools=[
list_rubric_categories,
get_rubric_section,
],
output_type=FinalAuditResult,
# Intentionally NO handoffs β the Python orchestrator drives concurrency
# and ordering. The SDK's `handoffs` mechanism is sequential and cannot
# express "5 slide reviewers in flight".
)
|