fix: Fixes for RAI agent path (rai_success) fails to reuse existing Foundry agents #718
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.
Fix: RAI Agent Reuse Bug (#28329)
Problem
RAI agents were creating new instances on every validation call instead of reusing existing agents from the database.
Root Cause
asst_xyz123...) without creating actual Azure resourcesChanges
lifecycle.pyresolve_agent_id(): Dual-client fallback (Projects SDK → AgentsClient)get_database_team_agent(): Usesresolve_agent_id()for proper retrievalget_agent_id(): Fail-fast for RAI agents without valid IDssave_database_team_agent()guards: Prevents duplicate savesproject_client: Projects SDK for RAI agent operationsfoundry_agent.py_create_mcp_agent_on_server(): Key fix - Creates real Azure agents via Projects SDK_after_open(): Calls server creation for RAI agents in MCP pathproject_client: Ensures Projects SDK availabilityExpected Outcome
Additional fix
In Select a Team, the “Legal Contract Review Team” was incorrectly treated as a non-default team. Since it is a default team, the Delete button should be disabled, similar to other default teams. A fix has been added in the TeamSelector.tsx file.
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information