Skip to content

Commit 78fe2c2

Browse files
authored
Merge pull request #154 from Fr4nc3/main
fix: agents loading
2 parents 9e590f8 + 5cb8a48 commit 78fe2c2

15 files changed

+183
-368
lines changed

src/backend/app_config.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,14 @@ def get_ai_project_client(self):
183183
self._ai_project_client = AIProjectClient.from_connection_string(
184184
credential=credential, conn_str=connection_string
185185
)
186-
logging.info("Successfully created AIProjectClient using connection string")
186+
187187
return self._ai_project_client
188188
except Exception as exc:
189189
logging.error("Failed to create AIProjectClient: %s", exc)
190190
raise
191191

192192
async def create_azure_ai_agent(
193193
self,
194-
kernel: Kernel,
195194
agent_name: str,
196195
instructions: str,
197196
tools: Optional[List[KernelFunction]] = None,
@@ -221,21 +220,15 @@ async def create_azure_ai_agent(
221220

222221
# First try to get an existing agent with this name as assistant_id
223222
try:
224-
logging.info(f"Trying to retrieve existing agent with ID: {agent_name}")
225-
existing_definition = await project_client.agents.get_agent(agent_name)
226-
logging.info(f"Found existing agent with ID: {agent_name}")
227223

224+
existing_definition = await project_client.agents.get_agent(agent_name)
228225
# Create the agent instance directly with project_client and existing definition
229226
agent = AzureAIAgent(
230227
client=project_client,
231228
definition=existing_definition,
232-
kernel=kernel,
233229
plugins=tools,
234230
)
235231

236-
logging.info(
237-
f"Successfully loaded existing Azure AI Agent for {agent_name}"
238-
)
239232
return agent
240233
except Exception as e:
241234
# The Azure AI Projects SDK throws an exception when the agent doesn't exist
@@ -263,7 +256,6 @@ async def create_azure_ai_agent(
263256
agent = AzureAIAgent(
264257
client=project_client,
265258
definition=agent_definition,
266-
kernel=kernel,
267259
plugins=tools,
268260
)
269261

src/backend/app_kernel.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,13 @@ async def input_task_endpoint(input_task: InputTask, request: Request):
127127
agents = await AgentFactory.create_all_agents(
128128
session_id=input_task.session_id,
129129
user_id=user_id,
130-
kernel=kernel,
131130
memory_store=memory_store,
132131
)
133132

134133
group_chat_manager = agents[AgentType.GROUP_CHAT_MANAGER.value]
135134

136135
# Convert input task to JSON for the kernel function, add user_id here
137136

138-
logging.info(f"Input task: {input_task}")
139137
# Use the planner to handle the task
140138
result = await group_chat_manager.handle_input_task(input_task)
141139

@@ -252,10 +250,7 @@ async def human_feedback_endpoint(human_feedback: HumanFeedback, request: Reques
252250
human_feedback.session_id, user_id
253251
)
254252
agents = await AgentFactory.create_all_agents(
255-
session_id=human_feedback.session_id,
256-
user_id=user_id,
257-
memory_store=memory_store,
258-
kernel=kernel,
253+
session_id=human_feedback.session_id, user_id=user_id, memory_store=memory_store
259254
)
260255

261256
# Send the feedback to the human agent
@@ -342,7 +337,6 @@ async def human_clarification_endpoint(
342337
session_id=human_clarification.session_id,
343338
user_id=user_id,
344339
memory_store=memory_store,
345-
kernel=kernel,
346340
)
347341

348342
# Send the feedback to the human agent
@@ -436,7 +430,6 @@ async def approve_step_endpoint(
436430
agents = await AgentFactory.create_all_agents(
437431
session_id=human_feedback.session_id,
438432
user_id=user_id,
439-
kernel=kernel,
440433
memory_store=memory_store,
441434
)
442435

0 commit comments

Comments
 (0)