diff --git a/pyproject.toml b/pyproject.toml index 266c492..560ce82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,3 +45,11 @@ src = ["src", "tests", "spikes"] pythonpath = ["src", "."] testpaths = ["tests"] asyncio_mode = "auto" + +[tool.mypy] +python_version = "3.10" + +# Third-party libs without bundled type stubs (py.typed) — analysed as untyped, not errors. +[[tool.mypy.overrides]] +module = ["pulp.*", "agent_framework_foundry.*"] +ignore_missing_imports = true diff --git a/src/portfolio_optimiser/workflow.py b/src/portfolio_optimiser/workflow.py index 1dffb6e..9b9bf2b 100644 --- a/src/portfolio_optimiser/workflow.py +++ b/src/portfolio_optimiser/workflow.py @@ -18,6 +18,7 @@ resume is fragile; the durable verdict is captured out-of-band in Step 12). from __future__ import annotations from collections.abc import Callable, Sequence +from typing import Any from agent_framework import Agent, BaseChatClient, Message from agent_framework.orchestrations import GroupChatBuilder @@ -54,13 +55,15 @@ def fresh_workflow( *, max_rounds: int = 3, enable_layer1_hitl: bool = False, -) -> object: +) -> Any: """Build a FRESH maker-checker GroupChat with FRESH clients per call (B7). Bounded by ``with_max_rounds`` (B4) plus a higher turn-count termination safety net. ``client_factory`` is called once per role, so each run owns its own clients — no state survives between runs. """ agents = maker_checker_agents(client_factory) - names = [a.name for a in agents] + # Agents are built from _MAKER_CHECKER_ROLES in order with name=role, so the role tuple + # IS the (typed, non-None) name list the selector cycles over. + names: list[str] = list(_MAKER_CHECKER_ROLES) counter = {"n": 0} def select(_state: object) -> str: