Python: move Foundry eval serialization out of core - #8031
Conversation
Keep provider-neutral EvalItem construction in core while moving the Foundry Evals wire conversion into agent-framework-foundry. Remove the accidental experimental converter export and migrate its tests, sample, and current package documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the EVALS feature-stage warning and metadata on the private EvalItem construction helper after removing AgentEvalConverter. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply the standard tool normalization path when constructing EvalItems so callable tools become FunctionTool instances. Simplify the Foundry tool-call sample to use @tool-decorated functions directly. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The linked accepted ADR contradicts the newly established serialization ownership boundary.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Moves Foundry-specific evaluation serialization from core into the Foundry provider package.
Changes:
- Replaces
AgentEvalConverterwith private provider-neutral construction helpers. - Moves wire conversion and tests into Foundry.
- Updates samples, exports, and boundary documentation.
File summaries
| File | Description |
|---|---|
python/samples/05-end-to-end/evaluation/foundry_evals/README.md |
Documents explicit EvalItem usage. |
python/samples/05-end-to-end/evaluation/foundry_evals/evaluate_tool_calls_sample.py |
Constructs typed tools and eval items directly. |
python/packages/foundry/tests/test_foundry_evals.py |
Tests provider-owned wire conversion. |
python/packages/foundry/README.md |
Documents evaluation ownership boundaries. |
python/packages/foundry/agent_framework_foundry/_foundry_evals.py |
Adds Foundry wire serialization helpers. |
python/packages/core/tests/core/test_evaluation.py |
Moves provider-neutral evaluation tests into core. |
python/packages/core/AGENTS.md |
Records evaluation ownership guidance. |
python/packages/core/agent_framework/_evaluation.py |
Replaces the converter with _to_eval_item. |
python/packages/core/agent_framework/__init__.pyi |
Removes the converter type export. |
python/packages/core/agent_framework/__init__.py |
Removes the converter runtime export. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (2 commit(s)): db135abfe85a, 64de3c82b505
Model: gpt-5.6-sol-fast
Overview
This PR moves Foundry-specific wire serialization into the Foundry package and replaces the mixed core converter with a private provider-neutral EvalItem builder. The changed behavior is guarded by focused tests for item construction, conversation splitting, content serialization, tool handling, and submitted dataset payloads. The removed converter was explicitly part of the experimental EVALS surface, whose lifecycle contract permits removal without notice, so no Critical, High, or Medium defect remains.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
# Conflicts: # python/packages/foundry/README.md
Remove the stale accepted-ADR link from the Foundry Evals module and keep the tool-call sample's decorated tools directly in the agent and eval item definitions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
MAF Automated Review — Iteration 2
Result: No findings
Scope: 19 net-new commit(s): baf0ea5252eb, cb8800aa0b47, c3a8aec098c6, 1802dfb3dc61, b21954571bcf, a727aaf111f4, 95b6b4874547, 4e0c230d0aa2, 164719453c4a, ad0d6a992a71, ed8fc04f665c, 5ae2ab39c022, c79718f4db3e, 1a51fdd3eb4c, 1f7f4b3bd080, 4507512f95ef, cbf67b72ebec, 2394401d96c5, 977ebfcbe386
Model: gpt-5.6-sol-fast
Overview
The PR keeps provider-neutral EvalItem construction in core while moving Foundry wire serialization behind private provider helpers. Callable-tool normalization, MCP-tool deduplication, serializer edge-case coverage, and end-to-end payload tests provide concrete guardrails against behavior drift. No Critical, High, or Medium defect was established on a changed line in the authoritative incremental range.
Reviewed the supplied incremental change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Keep the experimental converter import and static methods available so released Foundry packages remain compatible with their declared core 1.x range. Warn on legacy method use while modern Foundry continues to own active wire serialization. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Motivation & Context
Foundry evaluator dataset serialization currently lives in
agent-framework-core, even though it emits the Foundry/OpenAI Evals message schema and is consumed only byFoundryEvals. This blurs the provider boundary and makes the conversion look related to provider-neutral evaluation orchestration or the Responses API.This cleanup keeps core evaluation data and orchestration provider-neutral while making
agent-framework-foundryresponsible for its service wire format.Description & Review Guide
agent-framework-foundry.AgentEvalConverterclass with a private core helper for provider-neutralEvalItemconstruction.AgentEvalConverteras a deprecated compatibility shim so released Foundry packages remain importable across their declared core dependency range.EvalItemexplicitly, and documented the package boundary without changing accepted ADRs.FoundryEvalskeeps the same public API and wire payload behavior, and core retainsEvalItem, local evaluation,evaluate_agent, andevaluate_workflow.AgentEvalConverterremains importable for compatibility but emitsDeprecationWarningwhen its static methods are used. New callers should construct the publicEvalItemdirectly.agent-framework-responsespackage is introduced.Related Issue
N/A — ownership cleanup identified during Responses conversion analysis
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.