展示HN:可扩展的LangGraph架构(六边形模式,110个测试)
Show HN: LangGraph architecture that scales (hexagonal pattern, 110 tests)

原始链接: https://github.com/cleverhoods/sagecompass

SageCompass 是一种增强决策系统,旨在在开发开始*之前*确定是否真正需要人工智能解决方案,从而节省时间和资源。它充当“虚拟顾问”,系统地评估人工智能想法,并对其价值进行数据驱动的评估。 该流程模仿人类咨询流程:定义问题、明确可衡量的目标和关键绩效指标 (KPI)、评估数据可行性,并最终做出是否继续的决策。SageCompass 利用各种“代理”——本质上是专业角色,如业务分析师、数据科学家和高管——来执行这些步骤。 SageCompass 使用 Python、DDEV 和 uv 构建,具有 Gradio 用户界面进行交互,以及 LangGraph 后端进行处理。它与 Drupal 集成,以实现潜在的应用。安装涉及设置虚拟环境和配置 API 密钥(目前为 OpenAI)。已知 Docker/LangStudio 连接存在问题,可能需要调整本地主机地址以确保正常功能。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 展示 HN:可扩展的 LangGraph 架构(六边形模式,110 个测试) (github.com/cleverhoods) 3 分,由 cleverhoods 1 小时前发布 | 隐藏 | 过去 | 收藏 | 讨论 我一直遇到 LangGraph 的同一个问题:教程展示如何构建图,而不是如何维护一个拥有 8 个节点、3 个代理和子图之间共享状态的图。 所以我构建了一个参考架构,包含: - 平台层分离(框架无关的核心) - 每次状态变更时的合约验证 - 110 个测试,包括架构边界强制执行 - AI 编码代理不会意外破坏的模式 仓库:https://github.com/cleverhoods/sagecompass 关于这些模式的说明:https://dev.to/cleverhoods/from-prompt-to-platform-architect... 采用 MIT 许可。 欢迎大家提供反馈,特别是那些已经将 LangGraph 扩展到教程阶段的人。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

SageCompass is an augmented decision system that checks whether a business idea actually needs AI before anyone spends time and money building it.

“It's a virtual consultant that applies consistent logic to every AI idea and tells you - with numbers - if it’s worth doing or not.”

Human equivalent SagePass equivalent
Consultant asking "What problem are we solving?" Stage 1 – Problem framing & information gathering
Analyst turning that into measurable goals Stage 2 – Goals & KPIs
Data scientist checking "Do we have data for this?" Stage 3 – Feasibility
Executive deciding "Is this worth doing?" Stage 4 – Decision synthesis

Encompassing roles/Agents (v4)

Agent Simple metaphor Stage
Problem Framing Agent Business analysis Stage 1
Business Information Agent Business analysis Stage 1
Business Goal Agent Strategy translator Stage 2
KPI Agent Performance analysis Stage 2
Eligibility Agent Eligibility specialist Stage 3
Solution Design Agent Senior Engineer Stage 4
Cost estimation Agent Operation Manager Stage 4
Decision Agent Executive summarizer Stage 4

  • Python 3 (>=v3.13)
  • uv (>=v0.9.13)
  • ddev (>=v1.24.10)
.
├── docs/                     # Documentation assets
│   ├── mermaids/             # Mermaid exports/diagrams
│   └── assets/               # Images, htmls
├── drupal/                   # Drupal site root/
│   ├── .ddev/                # DDEV orchestration
│   └── README.md             
├── gradio-ui/                # Runnable Gradio UI surface (uv-managed)
│   └── README.md         
├── langgraph/                # Runnable LangGraph backend (uv-managed)
│   └── README.md         
├── AGENTS.md                 # Top level AGENTS directives (Codex mirror)
├── CLAUDE.md                 # Top level CLAUDE directives
├── CHANGELOG.md              # Required changelog (update under [Unreleased])
├── README.md                 # This file
└── LICENSE                   # MIT

  1. Install tooling

    • Install DDEV
    • Install uv and Python 3.12+.
  2. Create the virtual environments for the different layouts

    # Installing Drupal
    ddev start
    ddev drush site:install --existing-config -y
    ddev drush uli #to get the login url.

    IMPORTANT:

    • Remember to copy the langgraph/.env.example file to langgraph/.env
    • The current implementation was created for OPENAI_API_KEY only
    # Installing Langgraph
    cd langgraph
    uv sync
    # Installing Gradio UI
    cd gradio-ui
    uv sync
  3. Run LangGraph

    uv run langgraph dev
    # or with host IF you want to play around the Drupal - LangGraph integration. See Known errors.
    uv run langgraph dev --host 0.0.0.0
  4. Run Gradio UI

  5. Run tests

    cd langgraph
    uv run pytest -v

Docker - LangStudio network issue

On Local, Drupal is running inside a ddev initiated docker container, and it cannot connect to LangGraph Studio, unless the Studio is started via uv run langgraph dev --host 0.0.0.0.

This enables LangSmith endpoint config like this http://host.docker.internal:2024, BUT! it disables the default LangSmith because it doesn't see the http://0.0.0.0:2024 path.

The issue can be mitigated if you replace the 0.0.0.0 address manually to 127.0.0.1. https://eu.smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

联系我们 contact @ memedata.com