Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion backend/app/agent/factory/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
attach_remote_sub_agent_if_enabled,
)
from app.agent.listen_chat_agent import logger
from app.agent.prompt import BROWSER_SYS_PROMPT
from app.agent.prompt import (
BROWSER_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.toolkit.human_toolkit import HumanToolkit
from app.agent.toolkit.hybrid_browser_toolkit import HybridBrowserToolkit

Expand Down Expand Up @@ -382,6 +385,7 @@ def browser_agent(
now_str=NOW_STR,
external_browser_notice=external_browser_notice,
)
system_message = append_connected_app_mcp_notice(system_message)
system_message = attach_remote_sub_agent_if_enabled(
options=options,
agent_name=Agents.browser_agent,
Expand Down
6 changes: 5 additions & 1 deletion backend/app/agent/factory/developer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
attach_remote_sub_agent_if_enabled,
)
from app.agent.listen_chat_agent import logger
from app.agent.prompt import DEVELOPER_SYS_PROMPT
from app.agent.prompt import (
DEVELOPER_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.toolkit.human_toolkit import HumanToolkit

# TODO: Remove NoteTakingToolkit and use TerminalToolkit instead
Expand Down Expand Up @@ -128,6 +131,7 @@ async def developer_agent(
working_directory=working_directory,
now_str=NOW_STR,
)
system_message = append_connected_app_mcp_notice(system_message)
system_message = attach_remote_sub_agent_if_enabled(
options=options,
agent_name=Agents.developer_agent,
Expand Down
6 changes: 5 additions & 1 deletion backend/app/agent/factory/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
attach_remote_sub_agent_if_enabled,
)
from app.agent.listen_chat_agent import logger
from app.agent.prompt import DOCUMENT_SYS_PROMPT
from app.agent.prompt import (
DOCUMENT_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.toolkit.excel_toolkit import ExcelToolkit
from app.agent.toolkit.file_write_toolkit import FileToolkit
from app.agent.toolkit.google_drive_mcp_toolkit import GoogleDriveMCPToolkit
Expand Down Expand Up @@ -154,6 +157,7 @@ async def document_agent(
working_directory=working_directory,
now_str=NOW_STR,
)
system_message = append_connected_app_mcp_notice(system_message)
system_message = attach_remote_sub_agent_if_enabled(
options=options,
agent_name=Agents.document_agent,
Expand Down
4 changes: 2 additions & 2 deletions backend/app/agent/factory/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
remote_sub_agent_enabled,
)
from app.agent.listen_chat_agent import logger
from app.agent.prompt import MCP_SYS_PROMPT
from app.agent.prompt import MCP_SYS_PROMPT, append_connected_app_mcp_notice
from app.agent.toolkit.human_toolkit import HumanToolkit
from app.agent.toolkit.mcp_search_toolkit import McpSearchToolkit
from app.agent.tools import get_mcp_tools
Expand Down Expand Up @@ -73,7 +73,7 @@ async def mcp_agent(options: Chat):
working_directory=working_directory,
tools=tools,
tool_names=tool_names,
system_message=MCP_SYS_PROMPT,
system_message=append_connected_app_mcp_notice(MCP_SYS_PROMPT),
local_tool_description="local MCP or search tools",
message_integration=message_integration,
)
Expand Down
6 changes: 5 additions & 1 deletion backend/app/agent/factory/multi_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
attach_remote_sub_agent_if_enabled,
)
from app.agent.listen_chat_agent import logger
from app.agent.prompt import MULTI_MODAL_SYS_PROMPT
from app.agent.prompt import (
MULTI_MODAL_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.toolkit.audio_analysis_toolkit import AudioAnalysisToolkit
from app.agent.toolkit.human_toolkit import HumanToolkit

Expand Down Expand Up @@ -202,6 +205,7 @@ def multi_modal_agent(
working_directory=working_directory,
now_str=NOW_STR,
)
system_message = append_connected_app_mcp_notice(system_message)
system_message = attach_remote_sub_agent_if_enabled(
options=options,
agent_name=Agents.multi_modal_agent,
Expand Down
9 changes: 7 additions & 2 deletions backend/app/agent/factory/question_confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@
# ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========

from app.agent.agent_model import agent_model
from app.agent.prompt import QUESTION_CONFIRM_SYS_PROMPT
from app.agent.prompt import (
QUESTION_CONFIRM_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.utils import NOW_STR
from app.model.chat import Chat


def question_confirm_agent(options: Chat):
return agent_model(
"question_confirm_agent",
QUESTION_CONFIRM_SYS_PROMPT.format(now_str=NOW_STR),
append_connected_app_mcp_notice(
QUESTION_CONFIRM_SYS_PROMPT.format(now_str=NOW_STR)
),
options,
)
6 changes: 5 additions & 1 deletion backend/app/agent/factory/single_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

from app.agent.agent_model import agent_model
from app.agent.factory.toolkit_assembler import assemble_single_agent_toolkits
from app.agent.prompt import SINGLE_AGENT_SYS_PROMPT
from app.agent.prompt import (
SINGLE_AGENT_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.utils import NOW_STR
from app.hands.interface import IHands
from app.model.chat import Chat
Expand Down Expand Up @@ -70,6 +73,7 @@ async def single_agent(
working_directory=working_directory,
now_str=NOW_STR,
)
system_message = append_connected_app_mcp_notice(system_message)

agent = agent_model(
Agents.single_agent,
Expand Down
6 changes: 5 additions & 1 deletion backend/app/agent/factory/social_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
attach_remote_sub_agent_if_enabled,
)
from app.agent.listen_chat_agent import logger
from app.agent.prompt import SOCIAL_MEDIA_SYS_PROMPT
from app.agent.prompt import (
SOCIAL_MEDIA_SYS_PROMPT,
append_connected_app_mcp_notice,
)
from app.agent.toolkit.google_calendar_toolkit import GoogleCalendarToolkit
from app.agent.toolkit.google_gmail_mcp_toolkit import GoogleGmailMCPToolkit
from app.agent.toolkit.human_toolkit import HumanToolkit
Expand Down Expand Up @@ -110,6 +113,7 @@ async def social_media_agent(options: Chat):
system_message = SOCIAL_MEDIA_SYS_PROMPT.format(
working_directory=working_directory, now_str=NOW_STR
)
system_message = append_connected_app_mcp_notice(system_message)
system_message = attach_remote_sub_agent_if_enabled(
options=options,
agent_name=Agents.social_media_agent,
Expand Down
23 changes: 23 additions & 0 deletions backend/app/agent/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ def build_remote_sub_agent_planning_notice() -> str:
return REMOTE_SUB_AGENT_PLANNING_NOTICE


CONNECTED_APP_MCP_NOTICE = """\
<connected_app_tools>
When the user asks to query or operate a third-party app that may already be
connected, use available MCP or connector tools before browser/manual-login
flows. Examples include Clerk, Slack, Gmail, Notion, GitHub, Google Calendar,
Google Drive, Jira, Linear, Lark, Airtable, HubSpot, and similar SaaS apps.

- Search or list the app's available actions first.
- Execute read/list/search/count actions directly when the user's intent is
clear and all required input is available or optional.
- Execute write/send/update/delete/admin actions only when the user explicitly
asked for that change and the target details are clear.
- Ask for dashboard links, API keys, or manual browser login only after the
connector tools show the app/account/action is unavailable or required input
is missing.
</connected_app_tools>
"""


def append_connected_app_mcp_notice(system_message: str) -> str:
return f"{system_message.rstrip()}\n\n{CONNECTED_APP_MCP_NOTICE}"


SOCIAL_MEDIA_SYS_PROMPT = """\
You are a Social Media Management Assistant with comprehensive capabilities
across multiple platforms. You MUST use the `send_message_to_user` tool to
Expand Down
8 changes: 7 additions & 1 deletion backend/app/service/chat_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
remote_sub_agent_enabled,
)
from app.agent.listen_chat_agent import ListenChatAgent
from app.agent.prompt import build_remote_sub_agent_planning_notice
from app.agent.prompt import (
append_connected_app_mcp_notice,
build_remote_sub_agent_planning_notice,
)
from app.agent.toolkit.human_toolkit import HumanToolkit
from app.agent.toolkit.note_taking_toolkit import NoteTakingToolkit
from app.agent.toolkit.skill_toolkit import SkillToolkit
Expand Down Expand Up @@ -2867,6 +2870,9 @@ async def new_agent_model(
For any date-related tasks, you MUST use this as \
the current date.
"""
enhanced_description = append_connected_app_mcp_notice(
enhanced_description
)
message_integration = ToolkitMessageIntegration(
message_handler=HumanToolkit(
options.project_id, data.name
Expand Down
Loading
Loading