"""需求分级统筹规划 Agent 工厂。"""
from __future__ import annotations

from pathlib import Path

from supply_agent import Agent
from supply_agent.config import Settings
from agents.demand_grade_orchestrator_agent.tools import register_all_tools

_PROMPT_PATH = Path(__file__).parent / "prompt" / "system_prompt.md"


def create_demand_grade_orchestrator_agent(
    settings: Settings | None = None, *, model: str | None = None
) -> Agent:
    agent = Agent(
        settings=settings,
        name="demand_grade_orchestrator_agent",
        model=model,
        system_prompt=_PROMPT_PATH.read_text(encoding="utf-8"),
        max_iterations=48,
    )
    register_all_tools(agent.tools)
    return agent
