feat: Modularity change#1068
Draft
Dhruvkumar1-Microsoft wants to merge 284 commits into
Draft
Conversation
- Add thread-isolated integration tests for FoundryAgentTemplate covering MCP, RAG search, code interpreter, and multi-capability scenarios - Fix singleton event-loop issue via _reset_cached_clients() helper - Fix load_dotenv override to handle stale Windows user-level env vars - Fix test_event_utils: mock config directly instead of env var check - Fix test_health_check: use patch.object instead of string-based patching
Reasoning models (gpt-5*, o1, o3, o4) reject the temperature parameter with a 400 error. Passing temperature=None is also rejected because it serializes as null. Build a kwargs dict and spread into ChatAgent so temperature is fully omitted for these models, while gpt-4* models still get temperature=0.1.
Adds two new model deployments to the AI Foundry account: gpt-5-mini (reasoning + image-capable chat) and gpt-image-1 (image generation, required for ImageAgent in Use Case 6 / Ad Copy / Content Gen). New parameters: gpt5MiniModelName/Version/DeploymentType/Capacity and gptImageModelName/Version/DeploymentType/Capacity. Wired into both the existing-Foundry and new-Foundry deployment paths.
…ent-fixes Feature/tas27 gpt5mini imageagent fixes
Co-authored-by: Copilot <copilot@github.com>
Task 1+2: Replace print() with structured logging; remove logging.basicConfig - cosmosdb.py, router.py, team_utils.py: all print() -> logger.* - team_utils.py: logging.basicConfig() -> logger = logging.getLogger(__name__) Task 3: Remove stale commented-out imports - magentic_agent_factory.py, lifecycle.py, response_handlers.py, settings.py, foundry_service.py, team_utils.py Task 4: Rename common/models/messages_af.py -> messages.py - Update all 29 import sites across src/backend and src/tests Task 5: Rename utils_af.py -> team_utils.py, utils_agents.py -> agent_utils.py - Update all import sites; rename matching test files Task 8: Remove emoji from logger calls - app.py, agent_registry.py, settings.py, router.py, magentic_agent_factory.py - Fix matching test assertion in test_agent_registry.py
Migrate v4/magentic_agents to a new top-level agents/ package targeting the GA agent_framework 1.2.2 + agent_framework_foundry 1.2.2 SDK. New production modules: - agents/agent_factory.py – AgentFactory replaces MagenticAgentFactory - agents/agent_template.py – AgentTemplate replaces FoundryAgentTemplate - agents/proxy_agent.py – ProxyAgent ported to GA BaseAgent/AgentSession API - agents/image_agent.py – image agent carry-forward - config/mcp_config.py – MCPConfig / SearchConfig dataclasses - config/agent_registry.py – agent registry helper - config/azure_config.py – Azure config helpers - orchestration/connection_config.py – connection/orchestration config Key SDK changes from v4: - MagneticOneGroupChat removed; orchestration handled by caller - AgentThread -> AgentSession, ChatMessage -> Message - TextContent/UsageContent -> Content.from_text/from_usage - run_stream() -> run(stream=True) via ResponseStream - FoundryAgentTemplate open() inlines _collect_tools and azure-search paths - Reasoning + Bing guard-rail removed (platform constraint no longer applies) New tests (69 passing, 0 failing): - tests/backend/agents/test_agent_factory.py (30 tests) - tests/backend/agents/test_agent_template.py (15 tests) - tests/backend/agents/test_proxy_agent.py (24 tests)
- Remove InvalidConfigurationError from agent_factory.py (class, docstring, raise, and except clause) — platform constraint no longer applies - Delete test_agent_factory.py tests for reasoning+bing/coding_tools guard-rail - Delete test_sample_user.py — tested static fixture constants, not behavior - Remove TestDatabaseBaseAbstractClass, TestDatabaseBaseMethodSignatures, and TestDatabaseBaseInheritance from test_database_base.py — tested Python's ABC machinery, not app logic Net: 381 to 355 tests (-26)
- Add src/backend/models/__init__.py and plan_models.py (Phase 4.1 early, required by orchestration layer): PlanStatus, MStep, MPlan, AgentDefinition, PlannerResponseStep, PlannerResponsePlan - Add src/backend/orchestration/human_approval_manager.py with plan_to_obj method and full exception handling in _wait_for_user_approval - Add src/backend/orchestration/orchestration_manager.py - Add src/backend/orchestration/helper/plan_to_mplan_converter.py - Port 3 orchestration test suites (88 tests, all passing) - Remove unnecessary parent sys.modules mocks from agent tests that caused full-suite collection contamination (test_proxy_agent, test_agent_factory, test_agent_template)
…p without credentials)
… kwargs assertion - test_orchestration_manager.py: change unconditional sys.modules['agents'] = Mock() to setdefault so the real test package is not replaced during collection; this prevented pytest's Package.setup() from calling consider_module() on a Mock, which raised UsageError on pytest_plugins for all 73 agents/* setup steps - test_app_config.py: add connection_timeout=30, read_timeout=180, retry_total=5 to assert_called_once_with in test_get_ai_project_client_success; production code now passes these timeout kwargs to AIProjectClient All 666 backend unit tests now pass (0 errors, 0 failures).
…p import errors - Replace ChatMessage/AgentRunResponseUpdate/internal _magentic imports with MAF 1.2.2 GA types: Message, AgentResponseUpdate, AgentResponse, WorkflowEvent - Rewrite orchestration_manager.py: MagenticBuilder keyword-args constructor, Agent() wrapper for FoundryChatClient, workflow.run(stream=True) event loop with WorkflowEvent type discriminator (magentic_orchestrator / data / output) - Fix human_approval_manager.py: import MagenticContext/StandardMagenticManager from agent_framework.orchestrations; ORCHESTRATOR_* from agent_framework_orchestrations - Fix callbacks/response_handlers.py: use Message and AgentResponseUpdate - Add AgentMessageResponse and WebsocketMessageType to models/messages.py - Remove stale executor state-clearing block (obsolete internal MAF 1.x API) - Remove v4 router include from app.py and v4 import from team_utils.py
- Enable intermediate_outputs on MagenticBuilder for per-agent events - Inject agent name markdown headers on executor_invoked events - Stream all AgentResponseUpdate chunks to thinking buffer - Use executor_completed for clean final results (agents + orchestrator) - Fix PlanPage streaming handler to safely access content and scroll - Fix vite.config.ts leaking full process.env into build - Prior: AzureAISearchTool serialization, query_type default, SDK 2.1.0
- Only show agent name header when agent actually produces streaming output - Remove robot emoji from agent headers - Add search tool usage instructions to RFP team agent system messages - Accumulate orchestrator streaming chunks as final result fallback
- Display agent names with 'Agent' suffix in plan steps (StreamingPlanResponse) - Add agent names to Plan Overview left pane (PlanPanelRight) - Strengthen plan prompt to require agent names on every step - Remove party emoji prefix from final result message - Revert basic logging level default back to WARNING
…proxy MCP server and proxy are working well in the HR onboarding scenario. The full workflow now completes end-to-end: pre-orchestration clarification, HR agent tasks, and Tech Support agent tasks all execute as expected. Fixes: - hr.json: Add COMPLETION RULE to HR agent system message so it no longer declares the entire onboarding complete — only its own HR portion. Previously the orchestrator interpreted HR's closing language as workflow completion and never invoked TechnicalSupportAgent. - plan_review_helpers.py: Add progress-ledger guard instructing the orchestrator to ignore agent-level completion language when deciding whether all plan steps are done. - orchestration_manager.py: Add explicit MCP cleanup in a finally block at the end of run_orchestration to close UserInteractionAgent's streamable-HTTP async generators, preventing noisy cross-task RuntimeError from anyio on GC. Validated: HR scenario runs to completion with both HR and Tech Support agents invoked. MCP ask_user clarification round-trip works reliably (an intermittent hang on the WebSocket/async-event chain was observed once but resolved on retry — timing issue, not a logic bug).
…re integration - Add VectorStoreConfig to mcp_config.py for vector store name resolution - Add FileSearchTool support in agent_template.py (resolves name -> ID, adds to toolbox) - Update agent_factory.py to pass vector_store_config from team JSON - Update retail.json with use_file_search and vector_store_name fields - Refactor orchestration_manager.py to reuse agents across tasks (Option 3) - Fix executor access: use get_executors_list() with .agent property - Add unit tests for FileSearchTool and VectorStoreConfig integration - Add ADR documenting FileSearchTool choice over AzureAISearchTool
- Bootstrap MCPTool into portal agent definition.tools on first run so KB appears in Foundry portal UI - Read MCPTool server_url from portal definition on subsequent runs to dynamically create AzureAISearchContextProvider (portal as source of truth) - Fall back to team JSON kb_config when portal has no MCPTool - Add reload_excludes=['.venv'] to uvicorn to fix file-watcher restart loop - Add KnowledgeBaseConfig with search_endpoint, knowledge_base_name, connection_name - Wire retail.json agents with use_knowledge_base + knowledge_base_name
…mplate - CustomerDataAgent → macae-retail-customer-kb - OrderDataAgent → macae-retail-orders-kb - agent_template.py detects portal MCPTool with stale KB name and updates the agent definition to match team JSON config - Removed obsolete bugs/ investigation files (moved to localspec)
- Add ORCHESTRATOR_MODEL_NAME config (default: o4-mini) for the MagenticManager agent, separate from participant model - Create dedicated FoundryChatClient for manager with fallback to participant model on failure - Add debug logging to plan conversion for diagnosis - Fix test assertion to match current clarification policy header - Update agent team configs and template for KB detection
- Switch plan prompt to emit JSON array [{agent, action}] instead of bullets
- Add _try_parse_json_plan() with JSON-first parsing, bullet fallback
- Fix f-string/format brace escaping in plan_append (use concatenation)
- Preserve backward-compatible bullet regex parsing for non-reasoning models
- Add ADR-003 documenting reasoning model choice for orchestrator manager
Resolves: empty steps[] regression when o4-mini produces non-bullet plans
Status: all teams working except HR (blocked by framework tool-history-leak bug)
…larification - Add patches.py: two-layer monkey-patch filters tool call/result content types (function_call, function_call_output, function_result) and role=tool messages from being broadcast to other participants - Strengthen progress_ledger_prompt: agent requesting user clarification is progress (not stalling), route to UserInteractionAgent - Increase max_stall_count to 5 for user-interaction-heavy workflows - TechnicalSupportAgent: must call get_workflow_blueprint first, only ask about actual tool parameters (QUESTION RULE)
Frontend:
- Scroll viewport to START of final result message instead of page bottom
- Use React.Fragment wrapper with ref anchor before last agent message
- scrollIntoView({ block: 'start' }) positions final answer at viewport top
Backend (hr.json):
- Add WORKFLOW RULE: agents must call get_workflow_blueprint first, execute
only blueprint steps, never invent extras
- Add QUESTION RULE: one consolidated upfront ask for all blueprint-specified
info (required params, optional steps, defaults), no invented questions
- Prevents LLM from fabricating extra HR/tech-support steps and extraneous
user questioning
Bump default GPT-5-mini quota from 150k to 250k tokens in deployment docs and quota check. Update model name examples and validation bypass list to reference gpt-5-mini/gpt-5 instead of legacy gpt-4o/gpt-4 models. Also removes obsolete .copilot-tracking WAF private-networking research notes.
Reverts the deployment stack from the AVM/gpt-5-mini configuration back to the previous gpt-4o vanilla Bicep setup: - Rework `infra/main.bicep` from a deployment router (bicep/avm/avm-waf flavors) back to an inlined single-flavor template deploying AI Foundry, Cosmos DB, Container Apps, App Service, and optional WAF/private-networking resources. - Re-add `infra/modules/virtualNetwork.bicep` with NSGs, VNet, and subnets. - Update GitHub workflows (`azure-dev.yml`, `deploy.yml`, `deploy-waf.yml`) to use service-principal login, older action versions, `checkquota.sh` paths, and gpt-4o parameters; convert `azure-dev.yml` to template validation. - Simplify `azure.yaml` by removing post-deploy hooks. - Revert `README.md` and `docs/DeploymentGuide.md`/`TroubleShootingSteps.md` to the prior Azure OpenAI / Semantic Kernel wording and structure.
Bump the default GPT model from gpt-5-mini (and gpt-4o in the base infra template) to gpt-5.4-mini with version 2026-03-17. Updates deployment workflow, all content pack agent teams, Bicep infrastructure templates, quota check scripts, knowledge base seeding, backend env sample, and app config defaults.
Broad update aligning the accelerator with GPT-5.4/GPT-5.4-mini models and a refactored deployment pipeline: - Update all Bicep/ARM templates, params, docs, and quota scripts to deploy `gpt-5.4` and `gpt-5.4-mini` (replacing gpt-4.1/o4-mini), with capacities 150/100. - Add Azure Container Registry provisioning/reuse to AVM and vanilla Bicep, with ACR pull role assignments and managed-identity image pulls; add `Build-And-Push-Images` post-provision scripts (PS1/sh) and `azure.yaml` postdeploy hooks. - Rework CI workflows (azure-dev, deploy, deploy-waf, docker-build) to use OIDC login, new capacity vars, owner tags; remove create-release workflow. - Rewrite DeploymentGuide with step-by-step environment options. - Backend: add ImageAgent, markdown table normalization, human-readable agent display names, mandatory-agent plan enforcement, auto-approve replans, and elapsed-time UI indicators. - Frontend: resolve API asset URLs for images, persist/restore selected team, add ProcessingStatusIndicator and elapsed timers. - Update tests accordingly.
Add human anatomy and pose guidance to the content_gen agent prompts to reduce malformed limbs/hands in generated marketing images, and instruct depicting 1-3 people with natural poses. Also set AZURE_OPENAI_IMAGE_QUALITY to 'high' for the MCP container app in both the AVM and Bicep infrastructure definitions.
Add AZURE_STORAGE_IMAGES_CONTAINER environment variable to the MCP container app in both AVM and Bicep infrastructure definitions. Remove the unused src/backend/agents/image_agent.py.
feat: bug fix image mismatch behavior
| @@ -13,7 +13,7 @@ | |||
| import pytest | |||
| import sys | |||
| import os | |||
| from unittest.mock import Mock, AsyncMock, patch, NonCallableMock | |||
| from unittest.mock import Mock, AsyncMock, MagicMock, patch, NonCallableMock | |||
fix: Intermittent UI freeze and infinite reasoning
| heartbeat_task.cancel() | ||
| try: | ||
| await heartbeat_task | ||
| except (asyncio.CancelledError, Exception): |
fix: Resolve intermittent app settings environment value skipping
fix: fix the WAF issue and updated the docs
fix: Updated the AvailabilityZone to -1 to resolve the quota issue
…ated the azure.yaml
fix: fix the HR scenario issue by implementing the tools filtering and updated azure.yaml
chore: Update azure.yaml file to show github isue URL before provisioning.
chore: UI Changes to add pop-up when session time out on approval page
docs: updated the deployment Guid.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information