22
33import logging
44import os
5- from contextlib import AsyncExitStack
65import secrets
76import string
7+ from contextlib import AsyncExitStack
88from typing import Any , Optional
99
10- from agent_framework import (
11- AggregateContextProvider ,
12- ChatAgent ,
13- ChatClientProtocol ,
14- ChatMessage ,
15- ChatMessageStoreProtocol ,
16- ChatOptions ,
17- ContextProvider ,
18- HostedMCPTool ,
19- MCPStreamableHTTPTool ,
20- Middleware ,
21- Role ,
22- ToolMode ,
23- ToolProtocol ,
24- )
25-
10+ from agent_framework import (AggregateContextProvider , ChatAgent ,
11+ ChatClientProtocol , ChatMessage ,
12+ ChatMessageStoreProtocol , ChatOptions ,
13+ ContextProvider , HostedMCPTool ,
14+ MCPStreamableHTTPTool , Middleware , Role , ToolMode ,
15+ ToolProtocol )
2616# from agent_framework.azure import AzureAIAgentClient
2717from agent_framework_azure_ai import AzureAIAgentClient
2818from azure .ai .agents .aio import AgentsClient
2919from azure .identity .aio import DefaultAzureCredential
30- from common .models .messages_af import CurrentTeamAgent , TeamConfiguration
3120from common .database .database_base import DatabaseBase
21+ from common .models .messages_af import CurrentTeamAgent , TeamConfiguration
3222from v4 .common .services .team_service import TeamService
3323from v4 .config .agent_registry import agent_registry
3424from v4 .magentic_agents .models .agent_models import MCPConfig
@@ -196,10 +186,10 @@ async def get_database_team_agent(self) -> Optional[AzureAIAgentClient]:
196186 agent = await self .client .get_agent (
197187 agent_id = currentAgent .agent_foundry_id
198188 )
199- if agent and agent .agent_id is not None :
189+ if agent and agent .id is not None :
200190 chat_client = AzureAIAgentClient (
201191 project_endpoint = self .project_endpoint ,
202- agent_id = agent .agent_id ,
192+ agent_id = agent .id ,
203193 model_deployment_name = self .model_deployment_name ,
204194 async_credential = self .creds ,
205195 )
@@ -213,15 +203,15 @@ async def get_database_team_agent(self) -> Optional[AzureAIAgentClient]:
213203 async def save_database_team_agent (self ) -> None :
214204 """Save current team agent to database."""
215205 try :
216- if self ._agent .chat_client . agent_id is None :
206+ if self ._agent .id is None :
217207 self .logger .error ("Cannot save database team agent: agent_id is None" )
218208 return
219209
220210 currentAgent = CurrentTeamAgent (
221211 team_id = self .team_config .team_id ,
222212 team_name = self .team_config .name ,
223213 agent_name = self .agent_name ,
224- agent_foundry_id = self ._agent .chat_client . agent_id ,
214+ agent_foundry_id = self ._agent .id ,
225215 agent_description = self .agent_description ,
226216 agent_instructions = self .agent_instructions ,
227217 )
0 commit comments