goal-flow

作者 wanmol已验证

Graph-Orchestrated Agent Loop — a production-grade framework on LangGraph. Combine workflow graphs and agent loops, transpile Dify DSL to runnable code, swap wire protocols (Dify/OpenAI).

132
Stars
2
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/wanmol/goal-flow

快速入门

使用 goal-flow 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

goalflow

English | 简体中文

Python FastAPI LangGraph Workflow License: MIT

Graph-Orchestrated Agent Loop — a production-grade framework for building LLM applications on top of LangGraph. It gives you two complementary ways to build:

  • Visual-first workflows — design a flow in Dify's drag-and-drop editor, then transpile the exported DSL into a runnable, version-controllable LangGraph Python file with one command. No lock-in to Dify's runtime.
  • Code-first agents — build ReAct / Deep / custom agent loops with the bundled agent_kit SDK (vendored under src/agent_kit/), complete with middleware, model routing, failover, skills, and observability.

Because plain workflow graphs and plain agent loops each have limits, the framework is designed so you can combine them: a graph node can host an agent loop, and an agent can call sub-workflows as tools.

[!NOTE] Lean footprint, real concurrency. In load testing, a two-replica deployment on just 2 vCPU / 4 GB RAM per replica sustained 100 concurrent conversations with no measurable regression in time-to-first-token. The streaming pipeline is async and I/O-bound end to end, so throughput scales with replicas rather than demanding heavier boxes.

[!WARNING] Before you publish this repository publicly, read docs/security-and-open-sourcing.md. The .env* files are no longer tracked (a .env.example template ships in their place), but real credentials still live in git history — they must be scrubbed (git filter-repo) and rotated before the first public push. Internal service URLs are also still hard-coded in a few places.


Why this framework

NeedWhat it gives you
Design flows visually, run them yourselfDify DSL → LangGraph .py transpiler (docs/dify-transformer.md)
Rich built-in node library20+ nodes: LLM, code, HTTP, if/else, classifier, iteration, loop, tool, agent, doc-extractor … (docs/nodes.md)
Swap the wire protocolPluggable DataAdapter — Dify protocol by default, OpenAI-compatible included, bring your own (docs/protocols-and-adapters.md)
Reusable, LLM-matched capabilitiesMarkdown SKILL.md skills, matched to queries and injected into prompts (docs/skills.md)
Knowledge retrieval + ingestionPluggable retriever (none/HTTP/Milvus) plus a document ingestion CLI: extract → chunk → embed → Milvus (docs/knowledge-retrieval.md)
Real agent loopsvendored agent_kit package: Agent + middleware + harness (docs/agent-kit.md)
Conversation persistenceRedis (hot) + MySQL (durable), ES planned (docs/storage-and-config.md)
Streaming, SSE, HITLBranch-aware token streaming — tokens stream only from nodes that provably reach an answer/end, so output from untaken branches never leaks to the client; plus human-in-the-loop interrupts (docs/streaming-and-hitl.md)
ObservabilityLangfuse tracing + memory-leak monitoring
Run cheap, scale horizontallyAsync I/O-bound pipeline — 100 concurrent conversations on 2 vCPU / 4 GB × 2 replicas with no first-token regression

Documentation map

Start here, then follow the links into the topic files under docs/.

  1. Getting Started — install, configure, run the server, register your first workflow.
  2. End-to-End Tutorials — transpile a Dify flow, build an agent node, implement a custom data adapter.
  3. Architecture — the big picture: request lifecycle, the three-layer streaming pipeline, how the pieces fit.
  4. Nodes Reference — every built-in node, its purpose, config, and Dify mapping.
  5. Dify Transformer — convert a Dify DSL export into a runnable workflow file.
  6. Protocols & Data Adapters — the interaction-protocol abstraction and how to implement a custom one.
  7. Streaming & HITL — the streaming/SSE model and human-in-the-loop interrupts.
  8. Skills — authoring SKILL.md, matching, and prompt injection.
  9. Knowledge Retrieval & Ingestion — pluggable retrieval backends and the document ingestion tool.
  10. Agent Kit — the vendored agent_kit SDK: Agent, graph builders, middleware, harness.
  11. Storage & Config — Redis/MySQL persistence, config files, environment variables.
  12. API Reference — HTTP endpoints (chat, workflow, HITL, report, suggested questions).
  13. Security & Open-Sourcing Checklistread before publishing.
  14. Design Notes & Improvement Suggestions — honest assessment and concrete refactors.

Architecture at a glance

flowchart TB
    subgraph design["Design time"]
        dify["Dify Studio<br/>(visual editor)"]
        transpiler["Dify Transformer<br/>goalflow/tool/dify_transformer/"]
        gen["Generated workflow<br/>class YourWorkflow(BaseWorkflow)"]
        dify -- "export DSL (.yml)" --> transpiler -- "emit .py" --> gen
    end

    client(["Client"])

    subgraph runtime["Run time"]
        direction TB
        http["HTTP layer — goalflow/app.py (FastAPI)<br/>/v1/chat-messages · /v1/workflows/run · /v1/*/suggested · /stop<br/>auth: goalflow/api/auth_validator.py (Bearer token → Workflow)"]
        svc["Generate services — goalflow/workflow/services/<br/>Chatflow / Workflow GenerateService<br/>RunnableConfig · lifecycle chunks · Redis stop-flag poll"]
        engine["Engine — goalflow/workflow/base_workflow.py<br/>BaseWorkflow wraps a LangGraph StateGraph<br/>execute() · stream() · resume() (HITL)"]
        nodes["Node library — goalflow/node/<br/>llm · code · http · if/else · classifier<br/>iteration · loop · tool · agent · doc-extractor …"]
        proc["Chunk processors — goalflow/workflow/chunk_processor/<br/>raw LangGraph stream → semantic events<br/>branch-aware token routing"]
        adapter["Data adapter — goalflow/workflow/services/data_adapter/<br/>AbstractDataAdapter → Dify / OpenAI / custom"]

        http -- "initial_state (BaseState)" --> svc
        svc -- "drives" --> engine
        engine <-- "__call__ / Command / Send" --> nodes
        engine -- "(stream_mode, event) tuples" --> proc
        proc -- "semantic events" --> adapter
    end

    subgraph stores["Side stores"]
        redis[("Redis — cache/<br/>hot messages · conv vars · stop flags")]
        mysql[("MySQL — db/<br/>durable messages · HITL reviews · conv vars")]
    end

    subgraph cross["Cross-cutting"]
        agentkit["agent_kit (src/agent_kit/)<br/>agent loops via goalflow/node/agent_base.py"]
        trace["goalflow/trace/ — Langfuse"]
        monitor["goalflow/monitor/ — memory"]
        llm["goalflow/llm/ — LLM factory"]
    end

    gen -. "registered as" .-> http
    client -- "POST + Bearer" --> http
    adapter -- "SSE  data: {...}" --> client

    svc <--> redis
    engine <--> mysql
    nodes -. "embed / call" .-> agentkit
    engine -.-> trace
    nodes -.-> llm

See docs/architecture.md for the annotated walkthrough of each layer and the full request lifecycle.


Quick glance at the flow

Dify Studio (visual design)
        │  export DSL (.yml)
        ▼
goalflow/tool/dify_transformer/wf_code_generator.py  ──►  your_workflow.py
        │                                              (class YourWorkflow(BaseWorkflow[BaseState]))
        ▼
FastAPI (goalflow/app.py)
  POST /v1/chat-messages ── Bearer token ──► auth_validator maps token → Workflow instance
        │
        ▼
ChatflowGenerateService.generate(state)
        │  drives  BaseWorkflow.stream()  (LangGraph)
        ▼
StreamProcessor (semantic events) ──► DataAdapter (Dify / OpenAI / custom) ──► SSE to client
        │
        ├─ Redis  (message cache, conversation variables, stop flags)
        └─ MySQL  (durable messages, HITL reviews, conversation variables)

See docs/architecture.md for the annotated version.


Requirements

git clone <your-repo-url>
cd goalflow
cp .env.example .env          # then fill in real values

# editable install — puts the `goalflow` package on your path
pip install -e .

goalflow-server                   # serves on http://localhost:8000
# or, without installing:  python start_server.py

The project uses a src/ layout: the framework lives under src/goalflow/ (imports as goalflow.*, e.g. from goalflow.node import LLMNode) and the vendored agent SDK under src/agent_kit/ (imports as agent_kit.*). No git submodules — everything is self-contained. Full setup and environment configuration is in docs/getting-started.md.


Project layout

goalflow/
├── pyproject.toml             # packaging, deps, console script (goalflow-server)
├── start_server.py            # uvicorn launcher (dev, no install needed)
├── bootstrap_paths.py         # sys.path shim so `src/` is importable without install
├── config.yaml                # server/logging config
├── .env.example               # environment template (copy to .env)
├── Dockerfile
├── src/
│   ├── goalflow/                    # the framework package — imports as `goalflow.*`
│   │   ├── app.py               # FastAPI app + all HTTP endpoints
│   │   ├── config.py            # settings, structlog logging, contextvars
│   │   ├── constants.py         # WfNodeType and framework-wide enums
│   │   ├── workflow_types.py    # shared config/type models
│   │   ├── errors.py
│   │   ├── state/               # BaseState (the shared LangGraph state) + reducers
│   │   ├── node/                # built-in node library (+ node/custom/, agent_base.py)
│   │   ├── visitor/             # turns Dify graph nodes into code/objects
│   │   ├── workflow/
│   │   │   ├── base_workflow.py # BaseWorkflow: wraps a LangGraph StateGraph
│   │   │   ├── services/        # generate services + data_adapter/ (protocol layer)
│   │   │   ├── chunk_processor/ # raw LangGraph stream → semantic events
│   │   │   ├── stream/          # answer/end stream routing + template parsers
│   │   │   └── utils/           # checkpointer + connection wrappers
│   │   ├── dify_parser/         # Dify DSL YAML → internal graph model
│   │   ├── tool/                # transpiler, HTTP/SSE clients, OSS, MCP, metrics
│   │   ├── skill/               # skills engine
│   │   ├── llm/                 # LLM factory
│   │   ├── cache/ db/ service/  # Redis + MySQL persistence
│   │   ├── api/                 # auth, HITL, report endpoints
│   │   ├── trace/ monitor/      # Langfuse tracing + memory monitoring
│   │   └── prompts/             # prompt templates
│   └── agent_kit/               # vendored agent SDK — imports as `agent_kit.*`
├── skills/                      # example SKILL.md skills (data, not code)
├── test/                        # unit + integration tests
└── docs/                        # documentation

Status & roadmap

This framework is extracted from an internal production system, so some pieces are opinionated toward that origin (Alibaba Cloud OSS, Qwen/DashScope defaults). The generalizable core — the node library, the Dify transpiler, the adapter abstraction, and the agent kit — stands on its own.

Planned / suggested directions (details in docs/design-notes.md):

  • Migrate durable message storage from MySQL to Elasticsearch.
  • Support visual tools beyond Dify (one-click transpile from other builders).

License

Released under the MIT License. The vendored agent_kit package (src/agent_kit/) is relicensed under MIT as part of this project — see src/agent_kit/NOTICE.md.

常见问题

What is goal-flow?

goal-flow is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by wanmol. Graph-Orchestrated Agent Loop — a production-grade framework on LangGraph. Combine workflow graphs and agent loops, transpile Dify DSL to runnable code, swap wire protocols (Dify/OpenAI). It has 132 GitHub stars.

Is goal-flow safe to use?

Yes. goal-flow passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install goal-flow?

Clone the repository with "git clone https://github.com/wanmol/goal-flow" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is goal-flow written in?

goal-flow is primarily written in Python. It is open-source under wanmol on GitHub, so you can review or fork the full source.

Are there alternatives to goal-flow?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh goal-flow against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情