Skip to content

Commit b5328b5

Browse files
committed
Added exception checking / logging for agent creation.
1 parent 8850267 commit b5328b5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/backend/v3/magentic_agents/foundry_agent.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,15 @@ async def _after_open(self) -> None:
133133
# Add MCP plugins if available
134134
plugins = [self.mcp_plugin] if self.mcp_plugin else []
135135

136-
self._agent = AzureAIAgent(
137-
client=self.client,
138-
definition=definition,
139-
plugins=plugins,
140-
)
136+
try:
137+
self._agent = AzureAIAgent(
138+
client=self.client,
139+
definition=definition,
140+
plugins=plugins,
141+
)
142+
except Exception as ex:
143+
self.logger.error("Failed to create AzureAIAgent: %s", ex)
144+
raise
141145

142146
self.logger.info("%s initialized with %d tools and %d plugins", self.agent_name, len(tools), len(plugins))
143147

0 commit comments

Comments
 (0)