You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The agent runtime in lib/src/holiday_peak_lib/agents was built on a custom abstraction (BaseRetailAgent, AgentBuilder, ModelTarget / ModelInvoker). Microsoft Agent Framework (MAF, agent-framework>=1.0.1) and Microsoft Foundry now provide a stable, supported runtime that overlaps the same surface — agent loop, tool invocation, memory binding, model routing, telemetry — with first-party support and ongoing investment.
R1 (Microsoft Agent Framework backend cutover) starts with a new internal seam in lib/. This issue introduces lib/src/holiday_peak_lib/maf/runtime.py as the MAF-backed implementation that BaseRetailAgent will delegate to, leaving the public surface (BaseRetailAgent, AgentBuilder, FoundryAgentConfig) unchanged so service-side migrations in subsequent issues are mechanical.
Required change
Add lib/src/holiday_peak_lib/maf/__init__.py and lib/src/holiday_peak_lib/maf/runtime.py implementing MafRuntime — an internal class that wraps the MAF agent loop and is delegated to from BaseRetailAgent defined in lib/src/holiday_peak_lib/agents/base_agent.py.
Public API of BaseRetailAgent (in base_agent.py), AgentBuilder (in builder.py), and FoundryAgentConfig (in foundry.py) MUST remain unchanged. No app code should need to learn MAF idioms unless it explicitly opts in.
Three-tier memory bound per ADR-032: MemoryFacade exposes Hot/Warm/Cold stores; bindings are injected by AgentBuilder.
Contract tests in lib/tests/test_maf_runtime.py proving parity with the legacy surface for at least: handle() request flow, model routing (SLM→LLM upgrade per ADR-010), MCP tool registration, span emission, memory read/write.
Test coverage ≥ 90 % for lib/src/holiday_peak_lib/maf/.
lib/README.md updated with the new internal seam and a "no public API change" call-out.
Risks and dependencies
Risk
Mitigation
MAF 1.0.1 introduces a breaking change before R1 completes.
Pin agent-framework==1.0.1 (or the latest minor at R1 start). Upgrades are a separate PR after R1 completes.
The custom runtime had behaviors MAF doesn't expose.
Inventory of custom behaviors completed in this issue's design phase. Each is mapped to either MAF native, MAF extension point, or a lib/ adapter.
Reach-throughs into BaseRetailAgent internals exist in app code.
Pre-flight grep across apps/ for direct use of internal modules. Block per-context cutover until refactored.
OTEL / canary / memory ADRs not yet merged.
Acceptance criteria reference the ADR contracts loosely until PR #978 (ADRs 029–033) and PR #974 (ADR-028 continuous eval) merge; final span attribute names and eval keys are advisory and will be locked once those PRs land.
%%{init: {'theme':'base', 'themeVariables': {
'primaryColor':'#FFB3BA',
'primaryTextColor':'#000',
'primaryBorderColor':'#FF8B94',
'lineColor':'#BAE1FF',
'secondaryColor':'#BAE1FF',
'tertiaryColor':'#FFFFFF'
}}}%%
flowchart LR
A[Analyze Current Code] --> B[Design Change]
B --> C[Implement on Issue Branch]
C --> D[Open PR]
D --> E[Validation and Fixes]
E --> F[Merge to Main]
F --> G[Monitor Workflows]
G --> H[Close Issue and Cleanup]
Problem statement
The agent runtime in lib/src/holiday_peak_lib/agents was built on a custom abstraction (
BaseRetailAgent,AgentBuilder,ModelTarget/ModelInvoker). Microsoft Agent Framework (MAF,agent-framework>=1.0.1) and Microsoft Foundry now provide a stable, supported runtime that overlaps the same surface — agent loop, tool invocation, memory binding, model routing, telemetry — with first-party support and ongoing investment.R1 (Microsoft Agent Framework backend cutover) starts with a new internal seam in
lib/. This issue introduceslib/src/holiday_peak_lib/maf/runtime.pyas the MAF-backed implementation thatBaseRetailAgentwill delegate to, leaving the public surface (BaseRetailAgent,AgentBuilder,FoundryAgentConfig) unchanged so service-side migrations in subsequent issues are mechanical.Required change
lib/src/holiday_peak_lib/maf/__init__.pyandlib/src/holiday_peak_lib/maf/runtime.pyimplementingMafRuntime— an internal class that wraps the MAF agent loop and is delegated to fromBaseRetailAgentdefined in lib/src/holiday_peak_lib/agents/base_agent.py.BaseRetailAgent(in base_agent.py),AgentBuilder(in builder.py), andFoundryAgentConfig(in foundry.py) MUST remain unchanged. No app code should need to learn MAF idioms unless it explicitly opts in.mcp.hopcounter and refuses non-MCP A2A egress.retail_span()helper colocated with the runtime that sets the canonical span attributes (agent.name,agent.context,model.target,mcp.hop, etc.).HotStore/WarmStore/ColdStore/MemoryFacadeinterfaces into the runtime so per-context memory bindings are pluggable.agent-framework==1.0.1(or the latest minor at R1 start) in pyproject.toml. Upgrades are a separate PR after R1 completes.Affected components
lib/src/holiday_peak_lib/maf/runtime.py.lib/tests/test_maf_runtime.py.Acceptance criteria
lib/src/holiday_peak_lib/maf/runtime.pyshipped withMafRuntimeand aretail_span()helper.BaseRetailAgent,AgentBuilder,FoundryAgentConfigpublic surfaces are byte-identical (signatures, return types, public attributes).mcp.hopcounter increments per hop.MemoryFacadeexposes Hot/Warm/Cold stores; bindings are injected byAgentBuilder.lib/tests/test_maf_runtime.pyproving parity with the legacy surface for at least:handle()request flow, model routing (SLM→LLM upgrade per ADR-010), MCP tool registration, span emission, memory read/write.lib/src/holiday_peak_lib/maf/.python -m pylint lib/src apps/**/srcclean (no new findings; truth-* baseline assumes PR chore(lint): clear pylint baseline in truth-* services #979 has merged).python -m pytest lib/testsgreen.lib/README.mdupdated with the new internal seam and a "no public API change" call-out.Risks and dependencies
1.0.1introduces a breaking change before R1 completes.agent-framework==1.0.1(or the latest minor at R1 start). Upgrades are a separate PR after R1 completes.lib/adapter.BaseRetailAgentinternals exist in app code.apps/for direct use of internal modules. Block per-context cutover until refactored.Soft prerequisite (advisory): PR #978 (ADRs 029–033) — span attribute, MCP-only A2A, AGC canary, three-tier memory contracts.
Soft prerequisite (advisory): PR #974 (ADR-028 continuous evaluation) — eval baselines used downstream are advisory until #974 merges.
Blocks: all 8 per-bounded-context cutover issues (this issue is the seam every context cutover depends on).
Evidence links
ADR impact
BaseRetailAgentbecomes a thin re-export over MAF.Branch convention
feature/<issue-id>-maf-runtime-adapter(per ADR-018).BPMN process
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#FFB3BA', 'primaryTextColor':'#000', 'primaryBorderColor':'#FF8B94', 'lineColor':'#BAE1FF', 'secondaryColor':'#BAE1FF', 'tertiaryColor':'#FFFFFF' }}}%% flowchart LR A[Analyze Current Code] --> B[Design Change] B --> C[Implement on Issue Branch] C --> D[Open PR] D --> E[Validation and Fixes] E --> F[Merge to Main] F --> G[Monitor Workflows] G --> H[Close Issue and Cleanup]