Skip to content

Commit 797aa9a

Browse files
committed
Remove ReasoningSearch integration from agent
Eliminates the ReasoningSearch module and all related search augmentation logic from ReasoningAgentTemplate. This simplifies the agent by removing Azure AI Search dependencies and associated resource management.
1 parent d7ca6fc commit 797aa9a

File tree

2 files changed

+0
-324
lines changed

2 files changed

+0
-324
lines changed

src/backend/v4/magentic_agents/reasoning_agent.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from v4.magentic_agents.common.lifecycle import MCPEnabledBase
2121
from v4.magentic_agents.models.agent_models import MCPConfig, SearchConfig
22-
from v4.magentic_agents.reasoning_search import ReasoningSearch, create_reasoning_search
2322
from v4.config.agent_registry import agent_registry
2423

2524

@@ -73,8 +72,6 @@ def __init__(
7372
self._credential: Optional[DefaultAzureCredential] = None
7473
self._client: Optional[AzureAIAgentClient] = None
7574

76-
# Search integration
77-
self.reasoning_search: Optional[ReasoningSearch] = None
7875

7976
self.logger = logging.getLogger(__name__)
8077

@@ -100,16 +97,6 @@ async def _after_open(self) -> None:
10097
self.model_deployment_name
10198
)
10299

103-
# Initialize search capabilities if configured
104-
if self.search_config:
105-
self.reasoning_search = await create_reasoning_search(self.search_config)
106-
if self.reasoning_search.is_available():
107-
self.logger.info(
108-
"Initialized Azure AI Search with index '%s'",
109-
self.search_config.index_name
110-
)
111-
else:
112-
self.logger.warning("Azure AI Search initialization failed or incomplete config")
113100

114101
# Initialize MCP tools (called after stack is ready)
115102
await self._prepare_mcp_tool()
@@ -153,10 +140,6 @@ async def _after_open(self) -> None:
153140
async def close(self) -> None:
154141
"""Close all resources."""
155142
try:
156-
# Close reasoning search
157-
if self.reasoning_search:
158-
await self.reasoning_search.close()
159-
self.reasoning_search = None
160143

161144
# Unregister from registry
162145
try:
@@ -169,55 +152,6 @@ async def close(self) -> None:
169152
self._client = None
170153
self._credential = None
171154

172-
async def _augment_with_search(self, prompt: str) -> str:
173-
"""
174-
Augment the prompt with relevant search results.
175-
176-
Args:
177-
prompt: Original user prompt
178-
179-
Returns:
180-
Augmented instructions including search results
181-
"""
182-
instructions = self.base_instructions
183-
184-
if not self.reasoning_search or not self.reasoning_search.is_available():
185-
return instructions
186-
187-
if not prompt.strip():
188-
return instructions
189-
190-
try:
191-
# Fetch relevant documents
192-
docs = await self.reasoning_search.search_documents(
193-
query=prompt,
194-
limit=self.max_search_docs
195-
)
196-
197-
if docs:
198-
# Format documents for inclusion
199-
doc_context = "\n\n".join(
200-
f"[Document {i+1}]\n{doc}"
201-
for i, doc in enumerate(docs)
202-
)
203-
204-
# Append to instructions
205-
instructions = (
206-
f"{instructions}\n\n"
207-
f"**Relevant Reference Documents:**\n{doc_context}\n\n"
208-
f"Use the above documents only if they help answer the user's question. "
209-
f"Do not mention the documents unless directly relevant."
210-
)
211-
212-
self.logger.debug(
213-
"Augmented prompt with %d search documents",
214-
len(docs)
215-
)
216-
except Exception as ex:
217-
self.logger.warning("Search augmentation failed: %s", ex)
218-
219-
return instructions
220-
221155
def _prepare_tools(self) -> list:
222156
"""
223157
Prepare tools for reasoning model invocation.

src/backend/v4/magentic_agents/reasoning_search.py

Lines changed: 0 additions & 258 deletions
This file was deleted.

0 commit comments

Comments
 (0)