diff --git a/surfsense_backend/app/tasks/chat/stream_new_chat.py b/surfsense_backend/app/tasks/chat/stream_new_chat.py index 727f1f9ad..cec13204f 100644 --- a/surfsense_backend/app/tasks/chat/stream_new_chat.py +++ b/surfsense_backend/app/tasks/chat/stream_new_chat.py @@ -27,7 +27,6 @@ from langchain_core.messages import HumanMessage from sqlalchemy.future import select from app.agents.multi_agent_chat import create_multi_agent_chat_deep_agent -from app.agents.new_chat.chat_deepagent import create_surfsense_deep_agent from app.agents.shared.checkpointer import get_checkpointer from app.agents.shared.context import SurfSenseContextSchema from app.agents.shared.errors import BusyError @@ -1181,19 +1180,12 @@ async def stream_new_chat( ) visibility = thread_visibility or ChatVisibility.PRIVATE - from app.config import config as _app_config - - use_multi_agent = bool(_app_config.MULTI_AGENT_CHAT_ENABLED) - chat_agent_mode = "multi" if use_multi_agent else "single" + chat_agent_mode = "multi" with contextlib.suppress(Exception): chat_span.set_attribute("agent.mode", chat_agent_mode) _t0 = time.perf_counter() - agent_factory = ( - create_multi_agent_chat_deep_agent - if use_multi_agent - else create_surfsense_deep_agent - ) + agent_factory = create_multi_agent_chat_deep_agent # Build the agent inline. Provider 429s surface through the # in-stream recovery loop below (``_is_provider_rate_limited``), # which repins the thread to an eligible alternative config and @@ -2512,17 +2504,11 @@ async def stream_resume_chat( ) visibility = thread_visibility or ChatVisibility.PRIVATE - from app.config import config as _app_config - - chat_agent_mode = "multi" if _app_config.MULTI_AGENT_CHAT_ENABLED else "single" + chat_agent_mode = "multi" with contextlib.suppress(Exception): chat_span.set_attribute("agent.mode", chat_agent_mode) _t0 = time.perf_counter() - agent_factory = ( - create_multi_agent_chat_deep_agent - if _app_config.MULTI_AGENT_CHAT_ENABLED - else create_surfsense_deep_agent - ) + agent_factory = create_multi_agent_chat_deep_agent # Build the agent inline. Provider 429s are handled by the # in-stream recovery loop, which repins to an eligible # alternative config and rebuilds the agent before the user sees diff --git a/surfsense_backend/app/tasks/chat/streaming/flows/new_chat/orchestrator.py b/surfsense_backend/app/tasks/chat/streaming/flows/new_chat/orchestrator.py index f71e18770..e6803f5a1 100644 --- a/surfsense_backend/app/tasks/chat/streaming/flows/new_chat/orchestrator.py +++ b/surfsense_backend/app/tasks/chat/streaming/flows/new_chat/orchestrator.py @@ -30,10 +30,8 @@ from typing import Any, Literal import anyio from app.agents.multi_agent_chat import create_multi_agent_chat_deep_agent -from app.agents.new_chat.chat_deepagent import create_surfsense_deep_agent from app.agents.shared.filesystem_selection import FilesystemMode, FilesystemSelection from app.agents.shared.middleware.busy_mutex import end_turn -from app.config import config as _app_config from app.db import ChatVisibility, async_session_maker from app.observability import otel as ot from app.services.new_streaming_service import VercelStreamingService @@ -387,16 +385,11 @@ async def stream_new_chat( ) visibility = thread_visibility or ChatVisibility.PRIVATE - use_multi_agent = bool(_app_config.MULTI_AGENT_CHAT_ENABLED) - chat_agent_mode = "multi" if use_multi_agent else "single" + chat_agent_mode = "multi" set_agent_mode(chat_span, chat_agent_mode) _t0 = time.perf_counter() - agent_factory = ( - create_multi_agent_chat_deep_agent - if use_multi_agent - else create_surfsense_deep_agent - ) + agent_factory = create_multi_agent_chat_deep_agent # Build the agent inline. Provider 429s surface through the in-stream # recovery loop below, which repins the thread to an eligible # alternative config and rebuilds the agent before the user sees any diff --git a/surfsense_backend/app/tasks/chat/streaming/flows/resume_chat/orchestrator.py b/surfsense_backend/app/tasks/chat/streaming/flows/resume_chat/orchestrator.py index 6ed6fa166..aba603ce6 100644 --- a/surfsense_backend/app/tasks/chat/streaming/flows/resume_chat/orchestrator.py +++ b/surfsense_backend/app/tasks/chat/streaming/flows/resume_chat/orchestrator.py @@ -24,10 +24,8 @@ from uuid import UUID import anyio from app.agents.multi_agent_chat import create_multi_agent_chat_deep_agent -from app.agents.new_chat.chat_deepagent import create_surfsense_deep_agent from app.agents.shared.filesystem_selection import FilesystemMode, FilesystemSelection from app.agents.shared.middleware.busy_mutex import end_turn -from app.config import config as _app_config from app.db import ChatVisibility, async_session_maker from app.observability import otel as ot from app.services.chat_session_state_service import set_ai_responding @@ -326,16 +324,11 @@ async def stream_resume_chat( ) visibility = thread_visibility or ChatVisibility.PRIVATE - use_multi_agent = bool(_app_config.MULTI_AGENT_CHAT_ENABLED) - chat_agent_mode = "multi" if use_multi_agent else "single" + chat_agent_mode = "multi" set_agent_mode(chat_span, chat_agent_mode) _t0 = time.perf_counter() - agent_factory = ( - create_multi_agent_chat_deep_agent - if use_multi_agent - else create_surfsense_deep_agent - ) + agent_factory = create_multi_agent_chat_deep_agent agent = await build_main_agent_for_thread( agent_factory, llm=llm,