| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 7 | 6 | 0% |
| Commands | 0 | 0 | 12 | 0% |
| Section tags | 0 | 1 | 7 | 0% |
What each file covers
Sections
0 shared · 7 only in A · 6 only in B- − LangGraph.js
- − Overview
- − Core Concepts
- − Key Features
- − Development Practices
- − Deployment
- − Relevant Files in this Project
- + Development Guidelines
- + Coding Standards
- + Best Practices
- + Tooling and Environment
- + Collaboration and Workflow
- + Testing Philosophy
Commands
0 shared · 0 only in A · 12 only in B- + prettier
- + eslint.config.ts
- + eslint
- + npm run lint
- + npm run format:check
- + npm
- + jest
- + tsc
- + npm run build
- + npm run test
- + npm run test:int
- + npm run test:all
Section tags
0 shared · 1 only in A · 7 only in B- − architecture
- + setup
- + build
- + test
- + lint-format
- + code-style
- + security
- + agent-behaviour
Line diff
ssdeanx/langgraph-dm · .clinerules/langgraphjs.md
@@ −1 @@
1---
2glob: "**/*.ts"
3description: "Langgraphjs Architecture"
4---
5# LangGraph.js
6
7## Overview
8
9LangGraph.js is a powerful library for building stateful, multi-actor AI applications with Large Language Models (LLMs). It allows you to model complex agent workflows as graphs, where nodes represent individual steps or agents and edges define the flow of information and control.
10
11## Core Concepts
12
13* **StateGraph:** The primary class for defining graph-based workflows. It manages the shared state that is passed between nodes.
14* **Nodes:** Functions or runnable components that perform specific tasks and update the graph's state.
15* **Edges:** Define transitions between nodes, which can be unconditional or conditional based on the current state.
16* **State:** A shared data structure (`AgentState`) that represents the current context of the application, updated by nodes and passed along edges.
17* **Checkpoints:** Snapshots of the graph's state saved at various points, enabling persistence, debugging, and human-in-the-loop interactions.
18* **Subgraphs:** The ability to embed one graph as a node within another, promoting modularity and hierarchical design.
19* **Command Primitive:** A mechanism for combining state updates and dynamic control flow within a single node.
20* **Streaming:** First-class support for streaming intermediate results and LLM tokens, enhancing user experience.
21* **Human-in-the-Loop (HIL):** Features like `interrupt()` and breakpoints allow human intervention for approvals, state editing, and dynamic input.
22
23## Key Features
24
25* **Controllability:** Fine-grained control over the application's flow through explicit node and edge definitions.
26* **Persistence:** Built-in mechanisms for saving and restoring graph state, supporting long-running conversations and fault tolerance.
27* **Modularity:** Encourages breaking down complex problems into smaller, reusable components (nodes and subgraphs).
28* **Tool Integration:** Seamlessly integrates with LangChain tools, allowing agents to interact with external systems.
29* **Observability:** Integrates with LangSmith for tracing, debugging, and monitoring of LLM applications.
30
31## Development Practices
32
33* **TypeScript:** Strongly typed development for improved code quality and maintainability.
34* **Testing:** Encourages comprehensive unit and integration testing of nodes, agents, and overall graph workflows.
35* **Error Handling:** Robust error handling for tool calls and model invocations.
36
37## Deployment
38
39LangGraph.js applications can be deployed in various ways, including self-hosted solutions or through the LangGraph Platform (Cloud, BYOC). The LangGraph CLI and SDK provide tools for building, running, and interacting with deployed applications.
40
41## Relevant Files in this Project
42
43* `src/agent/graph.ts`: Defines the main `StateGraph` and its nodes/edges, orchestrating the agent workflow.
44* `src/agent/state.ts`: Defines the `AgentState` interface and `AgentAnnotation` for managing the application's state.
45* `src/agent/supervisor.ts`: Implements the supervisor agent for routing between specialized agents.
46* `src/agent/react_agent.ts`: Implements the ReAct (Reasoning and Acting) agent.
47* `src/memory/`: Contains implementations for memory management, including MongoDB integration for checkpoints and vector stores.
48* `src/tools/`: Houses various tools used by the agents (e.g., `calculator`, `document_processing`, `exa`, `github`, `local_git`, `tavily`, `web_scraping`).
49* `package.json`: Lists LangGraph and LangChain related dependencies.
50
ssdeanx/langgraph-dm · .clinerules/development_guidelines.md
@@ +1 @@
1---
2glob: "**/*.ts"
3description: "Langgraph Development Guidelines"
4---
5
6# Development Guidelines
7
8## Coding Standards
9
10* **Language:** TypeScript. Adhere to strict type-checking and leverage TypeScript's features for robust code.
11* **Formatting:** Use Prettier (`prettier`) for consistent code formatting across the project. Ensure consistent indentation (likely 2 spaces), line endings, and brace style as configured in `eslint.config.ts`.
12* **Linting:** Follow ESLint (`eslint`) rules defined in `eslint.config.ts`. Address all linting warnings and errors before committing code. Use `npm run lint` and `npm run format:check`.
13* **Naming Conventions:** Adhere to conventional naming (camelCase for variables/functions, PascalCase for classes/interfaces) as enforced by ESLint.
14* **Modularity:** Keep functions, modules, and especially agent nodes, small and focused on a single responsibility. This promotes reusability and easier debugging.
15
16## Best Practices
17
18* **Error Handling:** Implement robust error handling, particularly for external tool calls and API interactions. Utilize custom error classes (e.g., `ToolExecutionError`, `ModelInvocationError`) and centralized error handling (e.g., `handleGlobalError` in `src/config/errors.ts`).
19* **Logging:** Utilize the `winston` logger (`src/config/logger.ts`) for consistent and informative logging across the application. Use appropriate log levels (`debug`, `info`, `error`) for different environments.
20* **Asynchronous Operations:** Use `async/await` for all asynchronous operations to maintain readability and manage control flow effectively.
21* **Configuration Management:** Manage sensitive information and API keys using environment variables (e.g., `MONGODB_ATLAS_URI`, `GOOGLE_API_KEY`, `EXA_API_KEY`, `GITHUB_TOKEN`) via `.env` files for local development. Ensure proper environment variable setup (e.g., `process.env[name]`).
22* **Tool Usage:** Ensure proper schema validation for tool inputs using `zod`. Design tools to be idempotent where possible.
23* **Graph Design:** Follow LangGraph's principles: nodes do the work, edges define the flow. Use `StateGraph` for complex state management.
24* **State Management:** Pay close attention to how state is passed and modified between nodes, leveraging `Annotation` and reducer functions for clear, predictable updates.
25* **Dependency Management:** Manage dependencies using `npm` and ensure `@langchain/core` is resolved to a single version to prevent conflicts.
26
27## Tooling and Environment
28
29* **IDE:** VS Code is the recommended development environment.
30* **Package Manager:** npm.
31* **Testing Framework:** Jest (`jest`) for unit and integration tests.
32* **Build System:** TypeScript compiler (`tsc`) for transpilation (`npm run build`).
33* **Version Control:** Git. Follow a clear branching strategy (e.g., `main` for stable code, feature branches for new development).
34* **LangSmith:** Integrate LangSmith for best-in-class observability, debugging, testing, and monitoring of LLM applications. Set `LANGSMITH_API_KEY`, `LANGCHAIN_TRACING_V2`, and `LANGCHAIN_CALLBACKS_BACKGROUND` environment variables.
35
36## Collaboration and Workflow
37
38* **Version Control:** Utilize Git for all code changes. Adhere to a branching model that supports collaborative development and code reviews.
39* **Code Reviews:** All significant code changes must undergo a thorough code review process to ensure quality, adherence to standards, and identification of potential issues.
40* **Task Management:** Consider using a `cline_todo.md` file (as suggested in `.clinerules` best practices) to track tasks and subtasks within the project, ensuring clear summaries, timestamps, and status updates.
41
42## Testing Philosophy
43
44* **Unit Tests:** Write comprehensive unit tests for individual functions, modules, and especially for agent logic and tool implementations.
45* **Integration Tests:** Develop integration tests to verify the interactions between different agents and external services within the LangGraph workflow.
46* **Test Commands:** Use `npm run test` for unit tests, `npm run test:int` for integration tests, and `npm run test:all` for running all tests and linting checks.
47* **Test-Driven Development (TDD):** Encourage a TDD approach where tests are written before the corresponding code to guide development and ensure testability.
48
@@ −1 +1 @@
11 ---
22 glob: "**/*.ts"
3−description: "Langgraphjs Architecture"
3+description: "Langgraph Development Guidelines"
44 ---
5−# LangGraph.js
65
7−## Overview
6+# Development Guidelines
87
9−LangGraph.js is a powerful library for building stateful, multi-actor AI applications with Large Language Models (LLMs). It allows you to model complex agent workflows as graphs, where nodes represent individual steps or agents and edges define the flow of information and control.
8+## Coding Standards
109
11−## Core Concepts
10+* **Language:** TypeScript. Adhere to strict type-checking and leverage TypeScript's features for robust code.
11+* **Formatting:** Use Prettier (`prettier`) for consistent code formatting across the project. Ensure consistent indentation (likely 2 spaces), line endings, and brace style as configured in `eslint.config.ts`.
12+* **Linting:** Follow ESLint (`eslint`) rules defined in `eslint.config.ts`. Address all linting warnings and errors before committing code. Use `npm run lint` and `npm run format:check`.
13+* **Naming Conventions:** Adhere to conventional naming (camelCase for variables/functions, PascalCase for classes/interfaces) as enforced by ESLint.
14+* **Modularity:** Keep functions, modules, and especially agent nodes, small and focused on a single responsibility. This promotes reusability and easier debugging.
1215
13−* **StateGraph:** The primary class for defining graph-based workflows. It manages the shared state that is passed between nodes.
14−* **Nodes:** Functions or runnable components that perform specific tasks and update the graph's state.
15−* **Edges:** Define transitions between nodes, which can be unconditional or conditional based on the current state.
16−* **State:** A shared data structure (`AgentState`) that represents the current context of the application, updated by nodes and passed along edges.
17−* **Checkpoints:** Snapshots of the graph's state saved at various points, enabling persistence, debugging, and human-in-the-loop interactions.
18−* **Subgraphs:** The ability to embed one graph as a node within another, promoting modularity and hierarchical design.
19−* **Command Primitive:** A mechanism for combining state updates and dynamic control flow within a single node.
20−* **Streaming:** First-class support for streaming intermediate results and LLM tokens, enhancing user experience.
21−* **Human-in-the-Loop (HIL):** Features like `interrupt()` and breakpoints allow human intervention for approvals, state editing, and dynamic input.
16+## Best Practices
2217
23−## Key Features
18+* **Error Handling:** Implement robust error handling, particularly for external tool calls and API interactions. Utilize custom error classes (e.g., `ToolExecutionError`, `ModelInvocationError`) and centralized error handling (e.g., `handleGlobalError` in `src/config/errors.ts`).
19+* **Logging:** Utilize the `winston` logger (`src/config/logger.ts`) for consistent and informative logging across the application. Use appropriate log levels (`debug`, `info`, `error`) for different environments.
20+* **Asynchronous Operations:** Use `async/await` for all asynchronous operations to maintain readability and manage control flow effectively.
21+* **Configuration Management:** Manage sensitive information and API keys using environment variables (e.g., `MONGODB_ATLAS_URI`, `GOOGLE_API_KEY`, `EXA_API_KEY`, `GITHUB_TOKEN`) via `.env` files for local development. Ensure proper environment variable setup (e.g., `process.env[name]`).
22+* **Tool Usage:** Ensure proper schema validation for tool inputs using `zod`. Design tools to be idempotent where possible.
23+* **Graph Design:** Follow LangGraph's principles: nodes do the work, edges define the flow. Use `StateGraph` for complex state management.
24+* **State Management:** Pay close attention to how state is passed and modified between nodes, leveraging `Annotation` and reducer functions for clear, predictable updates.
25+* **Dependency Management:** Manage dependencies using `npm` and ensure `@langchain/core` is resolved to a single version to prevent conflicts.
2426
25−* **Controllability:** Fine-grained control over the application's flow through explicit node and edge definitions.
26−* **Persistence:** Built-in mechanisms for saving and restoring graph state, supporting long-running conversations and fault tolerance.
27−* **Modularity:** Encourages breaking down complex problems into smaller, reusable components (nodes and subgraphs).
28−* **Tool Integration:** Seamlessly integrates with LangChain tools, allowing agents to interact with external systems.
29−* **Observability:** Integrates with LangSmith for tracing, debugging, and monitoring of LLM applications.
27+## Tooling and Environment
3028
31−## Development Practices
29+* **IDE:** VS Code is the recommended development environment.
30+* **Package Manager:** npm.
31+* **Testing Framework:** Jest (`jest`) for unit and integration tests.
32+* **Build System:** TypeScript compiler (`tsc`) for transpilation (`npm run build`).
33+* **Version Control:** Git. Follow a clear branching strategy (e.g., `main` for stable code, feature branches for new development).
34+* **LangSmith:** Integrate LangSmith for best-in-class observability, debugging, testing, and monitoring of LLM applications. Set `LANGSMITH_API_KEY`, `LANGCHAIN_TRACING_V2`, and `LANGCHAIN_CALLBACKS_BACKGROUND` environment variables.
3235
33−* **TypeScript:** Strongly typed development for improved code quality and maintainability.
34−* **Testing:** Encourages comprehensive unit and integration testing of nodes, agents, and overall graph workflows.
35−* **Error Handling:** Robust error handling for tool calls and model invocations.
36+## Collaboration and Workflow
3637
37−## Deployment
38+* **Version Control:** Utilize Git for all code changes. Adhere to a branching model that supports collaborative development and code reviews.
39+* **Code Reviews:** All significant code changes must undergo a thorough code review process to ensure quality, adherence to standards, and identification of potential issues.
40+* **Task Management:** Consider using a `cline_todo.md` file (as suggested in `.clinerules` best practices) to track tasks and subtasks within the project, ensuring clear summaries, timestamps, and status updates.
3841
39−LangGraph.js applications can be deployed in various ways, including self-hosted solutions or through the LangGraph Platform (Cloud, BYOC). The LangGraph CLI and SDK provide tools for building, running, and interacting with deployed applications.
42+## Testing Philosophy
4043
41−## Relevant Files in this Project
42−
43−* `src/agent/graph.ts`: Defines the main `StateGraph` and its nodes/edges, orchestrating the agent workflow.
44−* `src/agent/state.ts`: Defines the `AgentState` interface and `AgentAnnotation` for managing the application's state.
45−* `src/agent/supervisor.ts`: Implements the supervisor agent for routing between specialized agents.
46−* `src/agent/react_agent.ts`: Implements the ReAct (Reasoning and Acting) agent.
47−* `src/memory/`: Contains implementations for memory management, including MongoDB integration for checkpoints and vector stores.
48−* `src/tools/`: Houses various tools used by the agents (e.g., `calculator`, `document_processing`, `exa`, `github`, `local_git`, `tavily`, `web_scraping`).
49−* `package.json`: Lists LangGraph and LangChain related dependencies.
44+* **Unit Tests:** Write comprehensive unit tests for individual functions, modules, and especially for agent logic and tool implementations.
45+* **Integration Tests:** Develop integration tests to verify the interactions between different agents and external services within the LangGraph workflow.
46+* **Test Commands:** Use `npm run test` for unit tests, `npm run test:int` for integration tests, and `npm run test:all` for running all tests and linting checks.
47+* **Test-Driven Development (TDD):** Encourage a TDD approach where tests are written before the corresponding code to guide development and ensure testability.
5048
