Skip to main content

GraphGPT

GraphGPT 是一个 Python 优先、面向 LangGraph 1.x / LangChain 1.x 的声明式状态图编译器。 它把版本化 YAML 编译为原生 StateGraph / CompiledStateGraph,不引入第二套运行时。

当前版本:v0.1.0。GraphGPT 支持循环、条件路由和持久化,因此它并不把图限制为 DAG。

v0.1 能力

  • 严格的 graphgpt.dev/v1alpha1 YAML DSL 与 JSON Schema;
  • YAML → 纯领域 IR → 语义诊断 → 原生 LangGraph 编译;
  • 普通边、条件边、循环、messages state、Reducer、interrupt 和内存持久化;
  • 显式注册、受 allowlist 保护的 Python callable、LangChain Runnable、model/agent 和 ToolNode;
  • validateinspectruninitexportschemadoctordev CLI;
  • 标准 langgraph.json 生成,适配 LangGraph CLI、Agent Server 与 LangSmith Studio;
  • LangSmith 环境变量透传,以及可选 Langfuse callback;
  • Chat、Branch、Loop、Tool-use、RAG 五个离线可运行模板。

快速开始

uv sync --extra dev --extra langchain
uv run graphgpt init ./my-agent --template branch
cd my-agent
uv run graphgpt validate workflow.yaml
uv run graphgpt run workflow.yaml --input '{"approved": true}'
uv run graphgpt dev --config langgraph.json

若要使用 graphgpt dev 的官方 CLI 委托,可安装 uv sync --extra cli。Langfuse 追踪使用 --extra langfuse,LangSmith SDK 已随核心 LangGraph 生态安装并通过标准环境变量启用。

在 Python 中也可以只采用编译器核心:

from graphgpt import BindingRegistry, compile_workflow

registry = BindingRegistry({"step": lambda state: {"result": "ok"}})
graph = compile_workflow("workflow.yaml", registry=registry)
print(graph.invoke({}))

最小 DSL

apiVersion: graphgpt.dev/v1alpha1
kind: Workflow
metadata:
  name: hello
spec:
  state:
    fields:
      result: {type: string}
  security:
    allowedModules: [my_agent]
  nodes:
    hello:
      use: python:my_agent.nodes.hello
  edges:
    - {from: $start, to: hello}
    - {from: hello, to: $end}

graphgpt validate 不导入节点代码或访问网络。只有 compile / run 阶段才解析绑定, 且 python: 引用必须位于 security.allowedModules 中。

架构

核心依赖方向固定为:domain <- application <- adapters/CLI。DSL 模型不会直接泄漏到 LangGraph 编译器,LangSmith 和 Langfuse 也只是外层观测适配器。详见 docs/ARCHITECTURE.mddocs/RESEARCH.md。长期路线见 docs/PROJECT_PLAN.md

开发

uv run ruff check .
uv run mypy
uv run pytest --cov=graphgpt
uv build

许可证:Apache-2.0。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphgpt_builder-0.2.1.tar.gz (204.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphgpt_builder-0.2.1-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file graphgpt_builder-0.2.1.tar.gz.

File metadata

  • Download URL: graphgpt_builder-0.2.1.tar.gz
  • Upload date:
  • Size: 204.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for graphgpt_builder-0.2.1.tar.gz
Algorithm Hash digest
SHA256 dbcbb1116e5876f1f54a3858226df208cf0a19bfc4629a4cba66a1b9ffab5388
MD5 6b5d267ba9dbe44a2962a8f3f6e2631c
BLAKE2b-256 2820c03eaecb17604f68139345100931dca073ef443df2e639a860a9714a3cab

See more details on using hashes here.

File details

Details for the file graphgpt_builder-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: graphgpt_builder-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for graphgpt_builder-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b18cb5115a38b4165b6123716b0b3a2b23aeee7e51bcec0e46eb5f5dba9f6775
MD5 e15d779f8c74aa7b467a4239b8f7f8e7
BLAKE2b-256 cd833dcab98324220a83c91bf5e4a2483a3ea0d66f6b262362fc1decc8ea7fd6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page