mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-07 06:42:39 +02:00
Add multi_agent_chat supervisor agent graph and supervisor prompt.
This commit is contained in:
parent
5a0a265b2b
commit
0fcb2acfdc
3 changed files with 36 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
||||||
|
"""Supervisor agent graph only; supply routing ``tools`` from ``build_supervisor_routing_tools``."""
|
||||||
|
|
||||||
|
from app.agents.multi_agent_chat.supervisor.graph import build_supervisor_agent
|
||||||
|
|
||||||
|
__all__ = ["build_supervisor_agent"]
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
"""Compile the supervisor agent graph (supervisor prompt + caller-supplied routing tools)."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
import app.agents.multi_agent_chat.supervisor as supervisor_pkg
|
||||||
|
|
||||||
|
from langchain.agents import create_agent
|
||||||
|
from langchain_core.language_models import BaseChatModel
|
||||||
|
from langchain_core.tools import BaseTool
|
||||||
|
from langgraph.types import Checkpointer
|
||||||
|
|
||||||
|
from app.agents.multi_agent_chat.shared.prompt_loader import read_prompt_md
|
||||||
|
|
||||||
|
|
||||||
|
def build_supervisor_agent(
|
||||||
|
llm: BaseChatModel,
|
||||||
|
*,
|
||||||
|
tools: Sequence[BaseTool],
|
||||||
|
checkpointer: Checkpointer | None = None,
|
||||||
|
):
|
||||||
|
"""Compile the supervisor **agent** (graph). ``tools`` = output of ``build_supervisor_routing_tools``."""
|
||||||
|
system_prompt = read_prompt_md(supervisor_pkg.__name__, "supervisor_prompt")
|
||||||
|
return create_agent(
|
||||||
|
llm,
|
||||||
|
system_prompt=system_prompt,
|
||||||
|
tools=list(tools),
|
||||||
|
checkpointer=checkpointer,
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
You are the supervisor agent. Route Gmail-related requests through the **gmail** tool and Google Calendar requests through the **calendar** tool, each with a clear task description. Answer directly when no sub-agent is needed. When sub-agents return results, combine them into one coherent reply for the user.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue