Skip to content

Commit e63fd56

Browse files
committed
refactor: remove agent service initialization and related endpoints
Signed-off-by: Andre Bossard <anbossar@microsoft.com>
1 parent 7c22b97 commit e63fd56

1 file changed

Lines changed: 0 additions & 56 deletions

File tree

backend/app.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
load_dotenv()
2828

29-
# Import agent service and models
30-
from agents import AgentRequest, AgentResponse, AgentService
3129

3230
# Import unified operation system
3331
from api_decorators import operation
@@ -51,15 +49,6 @@
5149
task_service = TaskService()
5250
ollama_service = OllamaService()
5351

54-
# Initialize agent service (may fail if Azure OpenAI not configured)
55-
try:
56-
agent_service = AgentService()
57-
print("✓ Agent service initialized with Azure OpenAI")
58-
except ValueError as e:
59-
agent_service = None
60-
print(f"⚠ Agent service disabled: {e}")
61-
print(" To enable agents, configure Azure OpenAI in .env file")
62-
6352

6453
# ============================================================================
6554
# UTILITY FUNCTIONS
@@ -209,37 +198,6 @@ async def op_list_ollama_models() -> ModelListResponse:
209198
"""
210199
return await ollama_service.list_models()
211200

212-
@operation(
213-
name="run_agent",
214-
description="Execute an AI agent with access to task management tools",
215-
http_method="POST",
216-
http_path="/api/agents/run"
217-
)
218-
async def op_run_agent(request: AgentRequest) -> AgentResponse:
219-
"""
220-
Run a LangGraph ReAct agent with task management capabilities.
221-
222-
The agent has access to all @operation decorated functions as tools,
223-
including create_task, update_task, delete_task, list_tasks, etc.
224-
225-
Requires Azure OpenAI to be configured in .env file.
226-
227-
Args:
228-
request: AgentRequest with prompt and agent_type
229-
230-
Returns:
231-
AgentResponse with agent output and metadata
232-
233-
Raises:
234-
ValueError: If agent service is not initialized (missing Azure config)
235-
"""
236-
if agent_service is None:
237-
raise ValueError(
238-
"Agent service is not available. "
239-
"Please configure Azure OpenAI credentials in .env file. "
240-
"See .env.example for required variables."
241-
)
242-
return await agent_service.run_agent(request)
243201

244202
# ============================================================================
245203
# REST API WRAPPERS
@@ -341,20 +299,6 @@ async def rest_list_ollama_models():
341299
return jsonify({"error": str(e)}), 500
342300

343301

344-
@app.route("/api/agents/run", methods=["POST"])
345-
async def rest_run_agent():
346-
"""REST wrapper: run AI agent with task management tools."""
347-
try:
348-
data = await request.get_json()
349-
agent_request = AgentRequest(**data)
350-
response = await op_run_agent(agent_request)
351-
return jsonify(response.model_dump()), 200
352-
except ValidationError as e:
353-
return jsonify({"error": str(e)}), 400
354-
except ValueError as e:
355-
return jsonify({"error": str(e)}), 503
356-
except Exception as e:
357-
return jsonify({"error": str(e)}), 500
358302

359303

360304
# ============================================================================

0 commit comments

Comments
 (0)