Phase 1 / §31: agent-core typed contracts + adapters (additive, no behavior change)#1
Conversation
Shared typed pydantic contracts + test-only adapters for the engineering, NOC, and knowledge loops, plus descriptive draft GraphSpecs. Additive and behavior-preserving: no existing loop is modified or imported at runtime. Contracts: TaskEnvelope, AgentState, RunContext/RuntimeContext, TraceEvent, AuditEvent, CostUsage, ModelPolicy, RoutingDecision, ToolContract/ToolResult, EvidencePacket/SourceRef, DecisionPacket, HumanApprovalRequest/Decision, PolicyGateResult, FeedbackEvent, ErrorEnvelope, GraphSpec/NodeSpec/EdgeSpec. Adapters: engineering_loop, noc_agent, knowledge. Tests: 25 passing; ruff + mypy clean; CI added. Refs: docs/migration/first-safe-milestone.md, docs/migration/file-level-change-plan.md Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17f6f7ea6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dev = ["pytest>=8", "pyyaml>=6", "ruff>=0.5", "mypy>=1.8", "types-PyYAML"] | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["agent_core"] |
There was a problem hiding this comment.
Add a PEP 561 marker to the typed package
When agent-core is installed as a dependency instead of checked out as source, type checkers only trust inline annotations from third-party packages that ship a py.typed marker. This package is advertised as shared typed contracts, but the wheel package here contains no agent_core/py.typed, so downstream mypy/pyright users will see the contracts as untyped or skipped despite the annotations.
Useful? React with 👍 / 👎.
| OUT_DIR.mkdir(parents=True, exist_ok=True) | ||
| for model in model_classes(): |
There was a problem hiding this comment.
Remove stale schema files during export
If a contract is renamed or removed, this exporter writes the current models but leaves the old *.schema.json file in place; the existing schema test only iterates current models and CI's git diff will not flag an unchanged stale file. That can publish schemas for contracts that no longer exist, so the export should clear or compare the exact schema file set before writing.
Useful? React with 👍 / 👎.
What
First safe milestone of the Agent Runtime Framework consolidation: a new, dependency-light
agent-corepackage of shared typed contracts plus test-only adapters for the threepriority loops. Spec:
../docs/migration/first-safe-milestone.md+file-level-change-plan.md.Contents
agent_core/contracts/— 22 pydantic v2 models (TaskEnvelope, AgentState,RunContext/RuntimeContext, TraceEvent, AuditEvent, CostUsage, ModelPolicy,
RoutingDecision, ToolContract/ToolResult, EvidencePacket/SourceRef, DecisionPacket,
HumanApproval{Request,Decision}, PolicyGateResult, FeedbackEvent, ErrorEnvelope,
GraphSpec/NodeSpec/EdgeSpec). Importing them pulls in pydantic only (enforced by test).
agent_core/adapters/—engineering_loop,noc_agent,knowledge: puredict→contract mappers. Imported by tests only; not wired into any loop's runtime.
agent_core/contracts/graphs/— descriptive draft GraphSpecs (eng 20 nodes, NOC 13,knowledge pipeline) that parse into
GraphSpec.schema-export check).
Verification
ruffclean,mypyclean (19 files), 25 tests pass, schema export reproducible.Safety / scope
registries, memory store, learning substrate, judges, policy gates, control-plane API/GUI.
🤖 Generated with Claude Code