Skip to content

fix: Dynamic Resource Naming and Agent Management#511

Merged
Avijit-Microsoft merged 9 commits into
mainfrom
dev
Jul 2, 2025
Merged

fix: Dynamic Resource Naming and Agent Management#511
Avijit-Microsoft merged 9 commits into
mainfrom
dev

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces changes to integrate a configurable solution_name variable across the backend infrastructure and agent factories, enhancing flexibility and enabling better identification of resources. The key updates involve adding solution_name to configuration, modifying agent and index naming conventions, and ensuring thread safety in agent deletion methods.

Infrastructure Updates:

  • Added SOLUTION_NAME as an environment variable in infra/main.bicep and infra/main.json to allow dynamic configuration of the solution name. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-7ef659fc9cf6968e718894d300490b14ea7a52091e7d4bcffae3a5029ac721d4R255), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-0504f5a35afecd5c8c2a1dc8cac5bb558cc1456c557d8edcb7f9bac1c0dc36e4L2697-R2698))

Agent Factory Enhancements:

  • Updated ConversationAgentFactory to include solution_name in agent naming for better resource identification. ([src/api/agents/conversation_agent_factory.pyR21-R27](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-85b7cc756f7c10f72d7c42fec8f25994e01841a2c743a3fdd063188ba22aed04R21-R27))
  • Updated SearchAgentFactory to use solution_name in both agent and index naming conventions, improving clarity and uniqueness. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-296fd5db8f53b31f77b2166ae6f6c5e0aeaeea381455c5d721b4be0294ab7ff6L38-R39), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-296fd5db8f53b31f77b2166ae6f6c5e0aeaeea381455c5d721b4be0294ab7ff6L59-R60))

Configuration and Thread Safety:

  • Introduced solution_name in the Config class to fetch the value from environment variables. ([src/api/common/config/config.pyR44-R45](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-1a3191ab9957502c87dc45d9d511a75defad29b60e5f5c872c2a9d6a44ab8c85R44-R45))
  • Ensured thread safety by adding locks in the delete_agent methods of ConversationAgentFactory and SearchAgentFactory. ([[1]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-85b7cc756f7c10f72d7c42fec8f25994e01841a2c743a3fdd063188ba22aed04R55), [[2]](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-296fd5db8f53b31f77b2166ae6f6c5e0aeaeea381455c5d721b4be0294ab7ff6R74))

Test Adjustments:

  • Updated test cases in test_search_agent_factory.py to reflect the new naming convention for project indexes. ([src/tests/api/agents/test_search_agent_factory.pyL59-R59](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/pull/511/files#diff-a85cf3e5eb63ca91383d7e80161b754838e88494b727683039f430e2eafff69eL59-R59))

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify citation links.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables a configurable solution_name for resource and agent naming, improves thread safety in agent deletion, and updates infrastructure templates to include the new environment variable.

  • Introduce solution_name in Config and propagate it in Bicep/ARM templates
  • Update agent factories to include solution_name in resource names and add locks for delete_agent
  • Adjust existing test to reflect the new search index naming convention

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tests/api/agents/test_search_agent_factory.py Updated expected index name to include connection name
src/api/common/config/config.py Added solution_name property to pull SOLUTION_NAME from env
src/api/agents/search_agent_factory.py Prefixed project index and agent names with solution_name; added delete lock
src/api/agents/conversation_agent_factory.py Imported Config, added solution_name to agent name; added delete lock
infra/main.json Added SOLUTION_NAME app setting and updated template hash
infra/main.bicep Passed SOLUTION_NAME parameter into backend module
Comments suppressed due to low confidence (1)

src/api/agents/conversation_agent_factory.py:27

  • Add a unit test for ConversationAgentFactory.get_agent to verify that the generated agent name includes the configured solution_name.
                agent_name = f"KM-ConversationKnowledgeAgent-{solution_name}"

Comment thread src/api/agents/search_agent_factory.py
Comment thread src/api/agents/conversation_agent_factory.py
@Pavan-Microsoft
Pavan-Microsoft marked this pull request as ready for review July 2, 2025 13:12
@Avijit-Microsoft
Avijit-Microsoft merged commit e4a7bc0 into main Jul 2, 2025
11 checks passed
@github-actions

github-actions Bot commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.9.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants