mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-06 14:22:47 +02:00
Add multi_agent_chat gmail slice with connector tools, agent, and domain prompt.
This commit is contained in:
parent
5ff2678253
commit
09a46a282a
4 changed files with 68 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
"""Gmail vertical slice: connector tools, domain agent, ``domain_prompt.md``."""
|
||||
|
||||
from app.agents.multi_agent_chat.gmail.agent import build_gmail_domain_agent
|
||||
from app.agents.multi_agent_chat.gmail.connector_tools import build_gmail_connector_tools
|
||||
|
||||
__all__ = [
|
||||
"build_gmail_connector_tools",
|
||||
"build_gmail_domain_agent",
|
||||
]
|
||||
21
surfsense_backend/app/agents/multi_agent_chat/gmail/agent.py
Normal file
21
surfsense_backend/app/agents/multi_agent_chat/gmail/agent.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"""Gmail domain agent graph."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import app.agents.multi_agent_chat.gmail as gmail_pkg
|
||||
from langchain_core.language_models import BaseChatModel
|
||||
from langchain_core.tools import BaseTool
|
||||
|
||||
from app.agents.multi_agent_chat.shared.domain_agent_factory import build_domain_agent
|
||||
|
||||
|
||||
def build_gmail_domain_agent(llm: BaseChatModel, tools: Sequence[BaseTool]):
|
||||
"""Compiled Gmail domain-agent graph (prompt + tools co-located under ``gmail``)."""
|
||||
return build_domain_agent(
|
||||
llm,
|
||||
tools,
|
||||
prompt_package=gmail_pkg.__name__,
|
||||
prompt_stem="domain_prompt",
|
||||
)
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
"""Gmail connector LangChain tools (``new_chat`` factories; order matches registry)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from langchain_core.tools import BaseTool
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.agents.multi_agent_chat.shared.deps import connector_binding
|
||||
from app.agents.new_chat.tools.gmail import (
|
||||
create_create_gmail_draft_tool,
|
||||
create_read_gmail_email_tool,
|
||||
create_search_gmail_tool,
|
||||
create_send_gmail_email_tool,
|
||||
create_trash_gmail_email_tool,
|
||||
create_update_gmail_draft_tool,
|
||||
)
|
||||
|
||||
|
||||
def build_gmail_connector_tools(
|
||||
*,
|
||||
db_session: AsyncSession,
|
||||
search_space_id: int,
|
||||
user_id: str,
|
||||
) -> list[BaseTool]:
|
||||
d = connector_binding(
|
||||
db_session=db_session,
|
||||
search_space_id=search_space_id,
|
||||
user_id=user_id,
|
||||
)
|
||||
return [
|
||||
create_search_gmail_tool(**d),
|
||||
create_read_gmail_email_tool(**d),
|
||||
create_create_gmail_draft_tool(**d),
|
||||
create_send_gmail_email_tool(**d),
|
||||
create_trash_gmail_email_tool(**d),
|
||||
create_update_gmail_draft_tool(**d),
|
||||
]
|
||||
|
|
@ -0,0 +1 @@
|
|||
You are the Gmail domain agent. Use only the tools provided to complete Gmail-related tasks. Stay focused on email operations and respond concisely.
|
||||
Loading…
Add table
Add a link
Reference in a new issue