Skip to content

Commit e26ce50

Browse files
committed
Remove ReasoningAgentTemplate and related logic
Deleted reasoning_agent.py and removed all references to ReasoningAgentTemplate in the agent factory and orchestration manager. The agent creation flow now exclusively uses FoundryAgentTemplate, and related comments and error messages have been updated accordingly. Also updated temperature setting in FoundryAgentTemplate to 1.0.
1 parent f9c6616 commit e26ce50

File tree

5 files changed

+69
-314
lines changed

5 files changed

+69
-314
lines changed

src/backend/v4/magentic_agents/common/lifecycle.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async def save_database_team_agent(self) -> None:
189189
await self.memory_store.add_team_agent(currentAgent)
190190

191191
except Exception as ex:
192-
self.logger.error("Failed to save ReasoningAgentTemplate: %s", ex)
192+
self.logger.error("Failed to save save database: %s", ex)
193193

194194

195195
async def _prepare_mcp_tool(self) -> None:
@@ -247,35 +247,35 @@ def __init__(
247247

248248

249249

250-
async def open(self) -> "AzureAgentBase":
251-
if self._stack is not None:
252-
return self
253-
self._stack = AsyncExitStack()
254-
255-
# Acquire credential
256-
self.creds = DefaultAzureCredential()
257-
if self._stack:
258-
await self._stack.enter_async_context(self.creds)
259-
# Create AgentsClient
260-
self.client = AgentsClient(
261-
endpoint=self.project_endpoint,
262-
credential=self.creds,
263-
)
264-
if self._stack:
265-
await self._stack.enter_async_context(self.client)
266-
# Prepare MCP
267-
await self._prepare_mcp_tool()
268-
269-
# Let subclass build agent client
270-
await self._after_open()
271-
272-
# Register agent (best effort)
273-
try:
274-
agent_registry.register_agent(self)
275-
except Exception:
276-
pass
277-
278-
return self
250+
# async def open(self) -> "AzureAgentBase":
251+
# if self._stack is not None:
252+
# return self
253+
# self._stack = AsyncExitStack()
254+
255+
# # Acquire credential
256+
# self.creds = DefaultAzureCredential()
257+
# if self._stack:
258+
# await self._stack.enter_async_context(self.creds)
259+
# # Create AgentsClient
260+
# self.client = AgentsClient(
261+
# endpoint=self.project_endpoint,
262+
# credential=self.creds,
263+
# )
264+
# if self._stack:
265+
# await self._stack.enter_async_context(self.client)
266+
# # Prepare MCP
267+
# await self._prepare_mcp_tool()
268+
269+
# # Let subclass build agent client
270+
# await self._after_open()
271+
272+
# # Register agent (best effort)
273+
# try:
274+
# agent_registry.register_agent(self)
275+
# except Exception:
276+
# pass
277+
278+
# return self
279279

280280
async def close(self) -> None:
281281
"""

src/backend/v4/magentic_agents/foundry_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ async def _after_open(self) -> None:
254254
description=self.agent_description,
255255
tools=tools if tools else None,
256256
tool_choice="auto" if tools else "none",
257-
temperature=0.7,
257+
temperature=1.0,
258258
model_id=self.model_deployment_name,
259259
)
260260

src/backend/v4/magentic_agents/magentic_agent_factory.py

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# from v4.magentic_agents.models.agent_models import (BingConfig, MCPConfig,
1717
# SearchConfig)
1818
from v4.magentic_agents.proxy_agent import ProxyAgent
19-
from v4.magentic_agents.reasoning_agent import ReasoningAgentTemplate
2019

2120

2221
class UnsupportedModelError(Exception):
@@ -41,7 +40,7 @@ def __init__(self, team_service: Optional[TeamService] = None):
4140
# with open(file_path, 'r') as f:
4241
# data = json.load(f)
4342
# return json.loads(json.dumps(data), object_hook=lambda d: SimpleNamespace(**d))
44-
43+
4544
# Ensure only an explicit boolean True in the source sets this flag.
4645
def extract_use_reasoning(self, agent_obj):
4746
# Support both dict and attribute-style objects
@@ -59,7 +58,7 @@ async def create_agent_from_config(
5958
agent_obj: SimpleNamespace,
6059
team_config: TeamConfiguration,
6160
memory_store: DatabaseBase,
62-
) -> Union[FoundryAgentTemplate, ReasoningAgentTemplate, ProxyAgent]:
61+
) -> Union[FoundryAgentTemplate, ProxyAgent]:
6362
"""
6463
Create an agent from configuration object.
6564
@@ -91,16 +90,16 @@ async def create_agent_from_config(
9190
)
9291

9392
# Determine which template to use
94-
# Usage
93+
# Usage
9594
use_reasoning = self.extract_use_reasoning(agent_obj)
9695

97-
# Validate reasoning template constraints
96+
# Validate reasoning constraints
9897
if use_reasoning:
9998
if getattr(agent_obj, "use_bing", False) or getattr(
10099
agent_obj, "coding_tools", False
101100
):
102101
raise InvalidConfigurationError(
103-
f"ReasoningAgentTemplate cannot use Bing search or coding tools. "
102+
f"Agent cannot use Bing search or coding tools. "
104103
f"Agent '{agent_obj.name}' has use_bing={getattr(agent_obj, 'use_bing', False)}, "
105104
f"coding_tools={getattr(agent_obj, 'coding_tools', False)}"
106105
)
@@ -118,44 +117,30 @@ async def create_agent_from_config(
118117
# bing_config = BingConfig.from_env() if getattr(agent_obj, 'use_bing', False) else None
119118

120119
self.logger.info(
121-
f"Creating agent '{agent_obj.name}' with model '{deployment_name}' {index_name} "
122-
f"(Template: {'Reasoning' if use_reasoning else 'Foundry'})"
120+
"Creating agent '%s' with model '%s' %s (Template: %s)",
121+
agent_obj.name,
122+
deployment_name,
123+
index_name,
124+
"Reasoning" if use_reasoning else "Foundry",
123125
)
124126

125-
# Create appropriate agent
126-
if use_reasoning:
127-
# Get reasoning specific configuration
128-
project_endpoint = config.AZURE_AI_PROJECT_ENDPOINT
129-
agent = ReasoningAgentTemplate(
130-
agent_name=agent_obj.name,
131-
agent_description=getattr(agent_obj, "description", ""),
132-
agent_instructions=getattr(agent_obj, "system_message", ""),
133-
model_deployment_name=deployment_name,
134-
project_endpoint=project_endpoint, # type: ignore
135-
search_config=search_config,
136-
mcp_config=mcp_config,
137-
team_service=self.team_service,
138-
team_config=team_config,
139-
memory_store=memory_store,
140-
)
141-
else:
142-
agent = FoundryAgentTemplate(
143-
agent_name=agent_obj.name,
144-
agent_description=getattr(agent_obj, "description", ""),
145-
agent_instructions=getattr(agent_obj, "system_message", ""),
146-
model_deployment_name=deployment_name,
147-
enable_code_interpreter=getattr(agent_obj, "coding_tools", False),
148-
project_endpoint=config.AZURE_AI_PROJECT_ENDPOINT,
149-
mcp_config=mcp_config,
150-
search_config=search_config,
151-
team_service=self.team_service,
152-
team_config=team_config,
153-
memory_store=memory_store,
154-
)
127+
agent = FoundryAgentTemplate(
128+
agent_name=agent_obj.name,
129+
agent_description=getattr(agent_obj, "description", ""),
130+
agent_instructions=getattr(agent_obj, "system_message", ""),
131+
model_deployment_name=deployment_name,
132+
enable_code_interpreter=getattr(agent_obj, "coding_tools", False),
133+
project_endpoint=config.AZURE_AI_PROJECT_ENDPOINT,
134+
mcp_config=mcp_config,
135+
search_config=search_config,
136+
team_service=self.team_service,
137+
team_config=team_config,
138+
memory_store=memory_store,
139+
)
155140

156141
await agent.open()
157142
self.logger.info(
158-
f"Successfully created and initialized agent '{agent_obj.name}'"
143+
"Successfully created and initialized agent '%s'", agent_obj.name
159144
)
160145
return agent
161146

@@ -184,7 +169,10 @@ async def get_agents(
184169
for i, agent_cfg in enumerate(team_config_input.agents, 1):
185170
try:
186171
self.logger.info(
187-
f"Creating agent {i}/{len(team_config_input.agents)}: {agent_cfg.name}"
172+
"Creating agent %d/%d: %s",
173+
i,
174+
len(team_config_input.agents),
175+
agent_cfg.name
188176
)
189177

190178
agent = await self.create_agent_from_config(
@@ -194,7 +182,10 @@ async def get_agents(
194182
self._agent_list.append(agent) # Keep track for cleanup
195183

196184
self.logger.info(
197-
f"✅ Agent {i}/{len(team_config_input.agents)} created: {agent_cfg.name}"
185+
"✅ Agent %d/%d created: %s",
186+
i,
187+
len(team_config_input.agents),
188+
agent_cfg.name
198189
)
199190

200191
except (UnsupportedModelError, InvalidConfigurationError) as e:
@@ -207,7 +198,10 @@ async def get_agents(
207198
continue
208199

209200
self.logger.info(
210-
f"Successfully created {len(initalized_agents)}/{len(team_config_input.agents)} agents for team '{team_config_input.name}'"
201+
"Successfully created %d/%d agents for team '%s'",
202+
len(initalized_agents),
203+
len(team_config_input.agents),
204+
team_config_input.name
211205
)
212206
return initalized_agents
213207

0 commit comments

Comments
 (0)