Split out of #620, where the reporter asked for "mypy and ruff for strict checks of async / blocking code". The ruff half shipped in #812 (ASYNC ruleset, enforced in CI on 3.10/3.11/3.12). The mypy half was never adopted: sdk/python/mypy.ini exists but nothing in .github/workflows/sdk-python.yml runs it, and mypy --config-file mypy.ini agentfield/ currently reports ~194 errors across ~28 files.
What "done" looks like
- A
mypy step in sdk/python CI that is required to pass.
- A per-module allowlist (
[mypy-agentfield.<module>] with ignore_errors = True) for modules that are not yet clean, so the gate can be turned on immediately and the allowlist shrunk module by module.
- No
# type: ignore sprinkling to get to green — fix the type or allowlist the module.
Suggested order
- Land the CI step with everything allowlisted (zero behaviour change, proves the wiring).
- Clean the async-heavy modules first, since that is the reporter's concern:
run_async.py, lock_utils.py, async_lifecycle.py, result_cache.py, async_execution_manager.py, http_connection_manager.py, memory_events.py, logger.py.
- Then
client.py and agent.py, which carry most of the remaining count.
Validation contract
- CI fails if a non-allowlisted module gains a new mypy error.
- Removing a module from the allowlist while it still has errors fails CI.
pip install .[dev] provides the pinned mypy version used in CI.
Refs #620.
Split out of #620, where the reporter asked for "mypy and ruff for strict checks of async / blocking code". The ruff half shipped in #812 (
ASYNCruleset, enforced in CI on 3.10/3.11/3.12). The mypy half was never adopted:sdk/python/mypy.iniexists but nothing in.github/workflows/sdk-python.ymlruns it, andmypy --config-file mypy.ini agentfield/currently reports ~194 errors across ~28 files.What "done" looks like
mypystep insdk/pythonCI that is required to pass.[mypy-agentfield.<module>]withignore_errors = True) for modules that are not yet clean, so the gate can be turned on immediately and the allowlist shrunk module by module.# type: ignoresprinkling to get to green — fix the type or allowlist the module.Suggested order
run_async.py,lock_utils.py,async_lifecycle.py,result_cache.py,async_execution_manager.py,http_connection_manager.py,memory_events.py,logger.py.client.pyandagent.py, which carry most of the remaining count.Validation contract
pip install .[dev]provides the pinned mypy version used in CI.Refs #620.