Cline rules
.clinerules/subgraphs.mdLanggraph Subgraphs & Workflow Orchestration
Cline rules
Quality
48/100
Scores the file, not the repository.Length
537 words
6 headings · 0 code blocksRepository
0
— · pushed 392 days agoLast changed
3 days ago
First indexed 3 days ago.12345# Subgraphs and Workflow Orchestration67## LangGraph Core Concept89* This project heavily utilizes LangGraph's `StateGraph` to define and manage complex, multi-step AI agent workflows.10* A "graph" represents the flow of control and data between different nodes (which are typically agents or tool calls).11* Subgraphs allow you to reuse an existing graph as a node within another graph, promoting modularity and hierarchical organization.1213## Key Components1415* **Nodes:** Represent individual steps or agents in the workflow (e.g., `entryNode`, `supervisor`, `reactAgent`, `research_collectNode`). Each node takes the current `AgentState` as input and returns an updated state.16* **Edges:** Define the transitions between nodes.17 * **Normal Edges:** Unconditionally move from one node to another (e.g., `START` to `entry`, `chat` to `END`).18 * **Conditional Edges:** Route to different nodes based on a decision function (e.g., `routeMessages` from `supervisor` to various agents). The routing function takes the `AgentState` and returns the name of the next node(s) or `END`.19* **`AgentState`:** The central data structure that is passed and modified across all nodes in the graph, maintaining the conversation context and agent-specific data. Defined using `Annotation`.20* **Supervisor:** A critical node responsible for intelligently routing the `AgentState` to the appropriate specialized agent or action based on the current context and goal.21* **`Command` Primitive:** Allows combining state updates and control flow (routing) within a single node, useful for dynamic handoffs between agents.2223## Designing Subgraphs2425* **Modularity:** Complex workflows should be broken down into smaller, manageable subgraphs or sequences of nodes.26* **Clear Responsibilities:** Each node and subgraph should have a clear, single responsibility.27* **State Flow:** Pay close attention to how data flows through the `AgentState` between nodes to ensure necessary information is available at each step.28* **Error Handling:** Design subgraphs to handle errors gracefully, potentially returning control to a supervisor for re-routing or error reporting.29* **Routing Logic:** The `routeMessages` function (or similar conditional routing) is crucial for dynamic and intelligent workflow execution. Ensure its logic covers all necessary transitions and fallback scenarios.30* **Communication:**31 * If the parent graph and subgraph share schema keys (channels), the compiled subgraph can be added directly as a node.32 * If schemas are different, define a node function that explicitly invokes the subgraph, transforming input state and output results to match the parent's schema. This prevents errors due to non-overlapping channels.33* **Nesting:** Subgraphs can be nested to any level, allowing for highly complex hierarchical agent systems.3435## Example Flows3637* **General Conversation:** `entry` -> `supervisor` -> `chat` -> `END`38* **Research Task:** `entry` -> `supervisor` -> `research_collect` -> `research_summarize` -> `research_report` -> `supervisor` (for final response)39* **Documentation Task:** `entry` -> `supervisor` -> `draft_documentation` -> `finalize_documentation` -> `supervisor` (for final response)40* **React Agent Task:** `entry` -> `supervisor` -> `react` -> `supervisor` (for tool execution or further action)41* **Multi-agent Network:** Agents can communicate with each other in a many-to-many fashion, making decisions on which agent to call next (e.g., `travel_advisor` -> `sightseeing_advisor` -> `hotel_advisor`).4243## Persistence with Subgraphs4445* Checkpointers should be passed only when compiling the *parent* graph. LangGraph automatically propagates the checkpointer to child subgraphs, enabling persistence across nested levels.46* State of subgraphs can be viewed and updated, facilitating human-in-the-loop interactions and debugging within nested workflows.47
Also in ssdeanx/langgraph-dm
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ssdeanx/langgraph-dm.clinerules/memory.md · 0 | Cline rules | styleperformance | 43/100 | 3 days ago | |
| ssdeanx/langgraph-dm.clinerules/agents.md · 0 | Cline rules | typesagent-behaviour | 44/100 | 3 days ago | |
| ssdeanx/langgraph-dm.clinerules/development_guidelines.md · 0 | Cline rules | setupbuildtestlint-format+3 | 83/100 | 3 days ago | |
| ssdeanx/langgraph-dm.clinerules/docs-technical-style.md · 0 | Cline rules | setuplint-formatstyledocs | 53/100 | 3 days ago | |
| ssdeanx/langgraph-dm.clinerules/langgraphjs.md · 0 | Cline rules | arch | 52/100 | 3 days ago | |
| ssdeanx/langgraph-dm.clinerules/project_overview.md · 0 | Cline rules | testlint-formatstylearch | 75/100 | 3 days ago | |
| ssdeanx/langgraph-dm.github/copilot-instructions.md · 0 | Copilot instructions | setupsecuritydeploymentdo-not+2 | 57/100 | 3 days ago | |
| ssdeanx/langgraph-dm.windsurf/rules/graphs.md · 0 | Windsurf rules | do-not | 55/100 | 3 days ago | |
| ssdeanx/langgraph-dm.windsurf/rules/langsmith.md · 0 | Windsurf rules | do-notagent-behaviour | 55/100 | 3 days ago |
Diff against .clinerules/memory.md Diff against .clinerules/agents.md Diff against .clinerules/development_guidelines.md Diff against .clinerules/docs-technical-style.md Diff against .clinerules/langgraphjs.md Diff against .clinerules/project_overview.md Diff against .github/copilot-instructions.md Diff against .windsurf/rules/graphs.md Diff against .windsurf/rules/langsmith.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago | |
| cline/cline.clinerules/general.md · 66k | Cline rules | setupbuildstylearch+2 | 86/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/60-pubmed-python.md · 6 | Cline rules | setuptestlint-formatstyle+2 | 86/100 | 3 days ago |
