diff --git a/README.md b/README.md index 2e2136d..a5a35b4 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,28 @@ docker compose up --build ```shell slack_socket_mode ``` + +## Flow Architecture + +```mermaid +flowchart LR + A((Request)) --> B(Supervisor) + B --> C{Select Agent} + C --> D1[DatetimeProvider] + D1 --> B + C --> D2[GenericSearch] + D2 --> B + C --> D3[RandomNumber] + D3 --> B + C --> D4[RandomSelect] + D4 --> B + C --> D5[SlackSearcher] + D5 --> B + C --> D6[SlackToolkit] + D6 --> B + C --> D7[ThreadSummary] + D7 --> B + C --> D8[WebrcaCreate] + D8 --> B + C --> |FINISH| E((Response)) +``` diff --git a/app/graph.py b/app/graph.py index a23f0cf..ececf40 100644 --- a/app/graph.py +++ b/app/graph.py @@ -1,6 +1,5 @@ import functools import operator -from collections.abc import Mapping from typing import Annotated, Sequence, TypedDict from langchain.agents import create_openai_tools_agent, AgentExecutor @@ -15,12 +14,12 @@ from app.chains.supervisor import build_supervisor_chain from app.dependencies.openai_chat_model import openai_chat_model from app.tools.datetime_provider import datetime_provider +from app.tools.duckduckgo_search import duckduckgo_search from app.tools.random_number import random_number from app.tools.random_select import random_select +from app.tools.slack_searcher import slack_searcher from app.tools.slack_toolkit import slack_toolkit from app.tools.webrca_create import webrca_create -from app.tools.duckduckgo_search import duckduckgo_search -from app.tools.slack_searcher import slack_searcher # https://github.com/langchain-ai/langgraph/blob/main/examples/multi_agent/agent_supervisor.ipynb @@ -54,6 +53,14 @@ class AgentState(TypedDict): SUPERVISOR_NAME = "Supervisor" GRAPH = { + "DatetimeProvider": { + "tools": [datetime_provider], + "system_prompt": "You are a datetime provider.", + }, + "GenericSearch": { + "tools": [duckduckgo_search], + "system_prompt": "You are a search engine for generic questions.", + }, "RandomNumber": { "tools": [random_number], "system_prompt": "You are a random number generator.", @@ -62,25 +69,17 @@ class AgentState(TypedDict): "tools": [random_select], "system_prompt": "You are a random selector.", }, - "WebrcaCreate": { - "tools": [webrca_create], - "system_prompt": "You are a webrca incident creator.", - }, - "GenericSearch": { - "tools": [duckduckgo_search], - "system_prompt": "You are a search engine for generic questions.", + "SlackSearcher": { + "tools": [slack_searcher], + "system_prompt": "You are a slack searcher.", }, "SlackToolkit": { "tools": slack_toolkit.get_tools(), "system_prompt": "You are a slack toolkit.", }, - "SlackSearcher": { - "tools": [slack_searcher], - "system_prompt": "You are a slack searcher.", - }, - "DatetimeProvider": { - "tools": [datetime_provider], - "system_prompt": "You are a datetime provider.", + "WebrcaCreate": { + "tools": [webrca_create], + "system_prompt": "You are a webrca incident creator.", }, }