refactor: Agent framework v2 changes.#796
Merged
Merged
Conversation
… scripts and configuration
…emove unused agent factory classes, streamline ChatService and HistoryService, and enhance SQLTool for better database interaction. Update API routes and configuration management for improved clarity and performance. Upgrade dependencies in requirements.txt for compatibility with new Azure SDK versions.
…gin, ChatService, HistoryService, and App - Removed test cases for deprecated agent factories in test_app.py. - Updated test cases in test_chat_with_data_plugin.py to reflect changes in the ChatWithDataPlugin implementation. - Refactored test cases in test_chat_service.py to remove dependencies on mock requests and streamline the setup. - Enhanced test_generate_title in test_history_service.py to utilize the new v2 agent framework. - Improved error handling tests in test_chat_service.py for rate limits and general exceptions. - Consolidated mock setups and assertions for clarity and maintainability.
…lation and access
…security in ChatService and HistoryService
…edge-Mining-Solution-Accelerator into km-agentframework-v2
…edge-Mining-Solution-Accelerator into km-agentframework-v2
…steps in Deployment Guide
…edge-Mining-Solution-Accelerator into km-agentframework-v2
…edge-Mining-Solution-Accelerator into km-agentframework-v2
…edge-Mining-Solution-Accelerator into km-agentframework-v2
…edge-Mining-Solution-Accelerator into km-agentframework-v2
…edge-Mining-Solution-Accelerator into km-agentframework-v2
- Updated 00_create_sample_data_files.py to improve CSV and JSON export functions, ensuring better error handling and code readability. - Modified 01_create_search_index.py to include additional whitespace for consistency. - Enhanced 03_cu_process_data_text.py by implementing asynchronous processing for embeddings and agent creation, improving performance and scalability. - Updated 04_cu_process_custom_data.py to streamline the search index creation process and improve error handling. - Adjusted requirements.txt to include new agent framework dependencies and ensure compatibility. - Enhanced process_sample_data.sh and run_create_index_scripts.sh to support new solution_name parameter for better configuration management.
…processing scripts
…d parameter files
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the solution to align with the Azure AI Agent Framework v2 workflow by removing the v1 agent-factory lifecycle, shifting agent usage to per-request AI Project clients/providers, and updating infra scripts/docs to create/configure agents post-deployment.
Changes:
- Removed Semantic Kernel-based agent factories and FastAPI lifespan initialization; updated
ChatService/HistoryServiceto useazure.ai.projects.aio+agent_framework.azureproviders. - Added/updated deployment & post-deployment scripts to create agents and propagate agent names into App Service /
azdenv, plus updated infra outputs and docs. - Updated tests and dependencies to reflect the v2 SDK and revised request/response behavior (including citation content/title handling).
Reviewed changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/test_app.py | Simplifies app fixture now that lifespan agent factories were removed. |
| src/tests/api/services/test_history_service.py | Updates title-generation tests to mock Agent Framework v2 components. |
| src/tests/api/services/test_chat_service.py | Reworks ChatService/ExpCache tests for v2 agent/provider flow and thread deletion. |
| src/tests/api/plugins/test_chat_with_data_plugin.py | Removes plugin tests tied to deleted v1 plugin/factories. |
| src/tests/api/agents/test_sql_agent_factory.py | Removes v1 SQL agent factory tests (factory deleted). |
| src/tests/api/agents/test_search_agent_factory.py | Removes v1 search agent factory tests (factory deleted). |
| src/tests/api/agents/test_conversation_agent_factory.py | Removes v1 conversation agent factory tests (factory deleted). |
| src/tests/api/agents/test_chart_agent_factory.py | Removes v1 chart agent factory tests (factory deleted). |
| src/tests/api/agents/test_base_agent_factory.py | Removes v1 base factory singleton/thread-safety tests (base deleted). |
| src/api/services/history_service.py | Uses async AIProjectClient + AzureAIProjectAgentProvider to generate titles via a configured title agent. |
| src/api/services/chat_service.py | Replaces SK streaming/thread model with v2 project client + provider, conversation_id caching, and citation extraction. |
| src/api/requirements.txt | Updates Azure SDKs and adds agent-framework packages; removes Semantic Kernel dependency. |
| src/api/plugins/chat_with_data_plugin.py | Deletes SK plugin that depended on removed v1 agent factories. |
| src/api/common/database/sqldb_service.py | Adds SQLTool wrapper for tool-calling; enforces Entra auth-only DB connectivity. |
| src/api/common/config/config.py | Adds agent name env vars used by v2 provider-based agent retrieval. |
| src/api/app.py | Removes lifespan-based agent initialization/cleanup. |
| src/api/api/api_routes.py | Instantiates ChatService without Request state; adjusts citation fetch endpoint response shape. |
| src/api/agents/sql_agent_factory.py | Deletes v1 SQL agent factory implementation. |
| src/api/agents/search_agent_factory.py | Deletes v1 search agent factory implementation. |
| src/api/agents/conversation_agent_factory.py | Deletes v1 conversation agent factory implementation. |
| src/api/agents/chart_agent_factory.py | Deletes v1 chart agent factory implementation. |
| src/api/agents/agent_factory_base.py | Deletes v1 base factory singleton helper. |
| src/api/.env.sample | Adds new env vars for v2 agent naming and foundry/app metadata. |
| src/App/src/components/Citations/Citations.tsx | Stores fetched citation title in UI state along with content. |
| infra/scripts/run_create_index_scripts.sh | Passes solution name through to processing script. |
| infra/scripts/run_create_agents_scripts.sh | New script: creates agents, toggles Foundry public access if needed, updates App Service and azd env. |
| infra/scripts/process_sample_data.sh | Adds solution name to required values and passes it into index script runner. |
| infra/scripts/process_custom_data.sh | Adjusts arg ordering and adds solution name; passes into custom processing script. |
| infra/scripts/index_scripts/requirements.txt | Aligns index scripts with v2 projects/agents + agent-framework packages. |
| infra/scripts/index_scripts/04_cu_process_custom_data.py | Migrates embedding + topic mining/mapping logic to async clients and temporary agents (v2). |
| infra/scripts/index_scripts/03_cu_process_data_text.py | Migrates embedding + topic mining/mapping logic to async clients and temporary agents (v2). |
| infra/scripts/index_scripts/01_create_search_index.py | Minor formatting/whitespace update. |
| infra/scripts/index_scripts/00_create_sample_data_files.py | Refactors imports/formatting; removes timestamped filenames. |
| infra/scripts/agent_scripts/requirements.txt | New minimal requirements for agent creation scripts. |
| infra/scripts/agent_scripts/01_create_agents.py | New script to create conversation + title agents (and output their names). |
| infra/main.waf.parameters.json | Updates default image tag to latest_afv2. |
| infra/main.parameters.json | Updates default image tag to latest_afv2. |
| infra/main.json | Updates generated template metadata; introduces AI Search connection name var and new outputs/appsettings. |
| infra/main.bicep | Adds AI Search connection name, emits new outputs/appsettings for agent creation workflow. |
| documents/LocalDevelopmentSetup.md | Documents new v2 environment variables and agent-creation step. |
| documents/DeploymentGuide.md | Adds explicit agent creation step prior to sample data processing. |
| documents/CustomizingAzdParameters.md | Updates default image tag documentation to latest_afv2. |
| documents/CustomizeData.md | Updates custom data script parameter ordering and adds solution name. |
| documents/AVMPostDeploymentGuide.md | Reorders post-deploy steps: create agents, then process sample/custom data. |
| azure.yaml | Updates post-provision messaging to include agent creation script. |
| README.md | Updates solution description/security guidance to reflect Agent Framework and MI-centric setup. |
| .github/workflows/job-azure-deploy.yml | Switches main/default image tag from latest_waf to latest_afv2. |
| .github/workflows/docker-build.yml | Switches main image tag to latest_afv2. |
| .github/workflows/deploy-KMGeneric.yml | Switches main/default image tag to latest_afv2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ss Bicep, JSON, and script files
…ved async handling
…ctivating Python virtual environment
Avijit-Microsoft
approved these changes
Mar 5, 2026
Contributor
|
🎉 This PR is included in version 3.18.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
This pull request introduces several updates to the documentation and infrastructure configuration to support the new agent creation workflow, improve parameter clarity, and enhance integration with the Azure AI Agent Framework. The changes affect deployment scripts, environment variable management, and instructional guides, making it easier for users to set up and customize the solution with agents and other AI components.
Documentation and Workflow Updates:
AVMPostDeploymentGuide.md,DeploymentGuide.md, andazure.yaml, and clarified the order of setup steps. [1] [2] [3] [4] [5]LocalDevelopmentSetup.md). [1] [2]Infrastructure and Parameter Improvements:
infra/main.bicep, and updated related outputs for agent and API app names. [1] [2] [3] [4] [5] [6]DeploymentGuide.md,CustomizeData.md,AVMPostDeploymentGuide.md). [1] [2] [3] [4]Security and Architecture Documentation:
Miscellaneous:
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation