guohanghui commited on
Commit
fcaff22
·
verified ·
1 Parent(s): 97967e6

Upload 459 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. Dockerfile +18 -0
  3. README.md +27 -5
  4. app.py +45 -0
  5. langgraph/mcp_output/README_MCP.md +57 -0
  6. langgraph/mcp_output/analysis.json +0 -0
  7. langgraph/mcp_output/diff_report.md +61 -0
  8. langgraph/mcp_output/mcp_plugin/__init__.py +0 -0
  9. langgraph/mcp_output/mcp_plugin/adapter.py +215 -0
  10. langgraph/mcp_output/mcp_plugin/main.py +13 -0
  11. langgraph/mcp_output/mcp_plugin/mcp_service.py +87 -0
  12. langgraph/mcp_output/requirements.txt +6 -0
  13. langgraph/mcp_output/start_mcp.py +30 -0
  14. langgraph/mcp_output/workflow_summary.json +183 -0
  15. langgraph/source/AGENTS.md +57 -0
  16. langgraph/source/CLAUDE.md +57 -0
  17. langgraph/source/LICENSE +21 -0
  18. langgraph/source/Makefile +68 -0
  19. langgraph/source/README.md +91 -0
  20. langgraph/source/__init__.py +4 -0
  21. langgraph/source/examples/README.md +3 -0
  22. langgraph/source/examples/__init__.py +1 -0
  23. langgraph/source/examples/chatbot-simulation-evaluation/__init__.py +1 -0
  24. langgraph/source/examples/chatbot-simulation-evaluation/agent-simulation-evaluation.ipynb +41 -0
  25. langgraph/source/examples/chatbot-simulation-evaluation/langsmith-agent-simulation-evaluation.ipynb +41 -0
  26. langgraph/source/examples/chatbot-simulation-evaluation/simulation_utils.py +203 -0
  27. langgraph/source/examples/chatbots/information-gather-prompting.ipynb +41 -0
  28. langgraph/source/examples/code_assistant/langgraph_code_assistant.ipynb +41 -0
  29. langgraph/source/examples/code_assistant/langgraph_code_assistant_mistral.ipynb +0 -0
  30. langgraph/source/examples/customer-support/customer-support.ipynb +41 -0
  31. langgraph/source/examples/extraction/retries.ipynb +41 -0
  32. langgraph/source/examples/human_in_the_loop/wait-user-input.ipynb +41 -0
  33. langgraph/source/examples/lats/lats.ipynb +41 -0
  34. langgraph/source/examples/llm-compiler/LLMCompiler.ipynb +41 -0
  35. langgraph/source/examples/multi_agent/hierarchical_agent_teams.ipynb +41 -0
  36. langgraph/source/examples/multi_agent/multi-agent-collaboration.ipynb +41 -0
  37. langgraph/source/examples/plan-and-execute/plan-and-execute.ipynb +41 -0
  38. langgraph/source/examples/rag/langgraph_adaptive_rag.ipynb +0 -0
  39. langgraph/source/examples/rag/langgraph_adaptive_rag_cohere.ipynb +0 -0
  40. langgraph/source/examples/rag/langgraph_adaptive_rag_local.ipynb +0 -0
  41. langgraph/source/examples/rag/langgraph_agentic_rag.ipynb +0 -0
  42. langgraph/source/examples/rag/langgraph_crag.ipynb +0 -0
  43. langgraph/source/examples/rag/langgraph_crag_local.ipynb +0 -0
  44. langgraph/source/examples/rag/langgraph_self_rag.ipynb +0 -0
  45. langgraph/source/examples/rag/langgraph_self_rag_local.ipynb +0 -0
  46. langgraph/source/examples/rag/langgraph_self_rag_pinecone_movies.ipynb +0 -0
  47. langgraph/source/examples/react-agent-from-scratch.ipynb +40 -0
  48. langgraph/source/examples/react-agent-structured-output.ipynb +40 -0
  49. langgraph/source/examples/reflection/reflection.ipynb +41 -0
  50. langgraph/source/examples/reflexion/reflexion.ipynb +41 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ langgraph/source/libs/cli/js-examples/static/studio.png filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ RUN useradd -m -u 1000 user && python -m pip install --upgrade pip
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ WORKDIR /app
8
+
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+ ENV MCP_TRANSPORT=http
14
+ ENV MCP_PORT=7860
15
+
16
+ EXPOSE 7860
17
+
18
+ CMD ["python", "langgraph/mcp_output/start_mcp.py"]
README.md CHANGED
@@ -1,10 +1,32 @@
1
  ---
2
- title: Langgraph
3
- emoji:
4
- colorFrom: green
5
- colorTo: green
6
  sdk: docker
 
 
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Langgraph MCP
3
+ emoji: 🤖
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: docker
7
+ sdk_version: "4.26.0"
8
+ app_file: app.py
9
  pinned: false
10
  ---
11
 
12
+ # Langgraph MCP Service
13
+
14
+ Auto-generated MCP service for langgraph.
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ https://None-langgraph-mcp.hf.space/mcp
20
+ ```
21
+
22
+ ## Connect with Cursor
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "langgraph": {
28
+ "url": "https://None-langgraph-mcp.hf.space/mcp"
29
+ }
30
+ }
31
+ }
32
+ ```
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import os
3
+ import sys
4
+
5
+ mcp_plugin_path = os.path.join(os.path.dirname(__file__), "langgraph", "mcp_output", "mcp_plugin")
6
+ sys.path.insert(0, mcp_plugin_path)
7
+
8
+ app = FastAPI(
9
+ title="Langgraph MCP Service",
10
+ description="Auto-generated MCP service for langgraph",
11
+ version="1.0.0"
12
+ )
13
+
14
+ @app.get("/")
15
+ def root():
16
+ return {
17
+ "service": "Langgraph MCP Service",
18
+ "version": "1.0.0",
19
+ "status": "running",
20
+ "transport": os.environ.get("MCP_TRANSPORT", "http")
21
+ }
22
+
23
+ @app.get("/health")
24
+ def health_check():
25
+ return {"status": "healthy", "service": "langgraph MCP"}
26
+
27
+ @app.get("/tools")
28
+ def list_tools():
29
+ try:
30
+ from mcp_service import create_app
31
+ mcp_app = create_app()
32
+ tools = []
33
+ for tool_name, tool_func in mcp_app.tools.items():
34
+ tools.append({
35
+ "name": tool_name,
36
+ "description": tool_func.__doc__ or "No description available"
37
+ })
38
+ return {"tools": tools}
39
+ except Exception as e:
40
+ return {"error": f"Failed to load tools: {str(e)}"}
41
+
42
+ if __name__ == "__main__":
43
+ import uvicorn
44
+ port = int(os.environ.get("PORT", 7860))
45
+ uvicorn.run(app, host="0.0.0.0", port=port)
langgraph/mcp_output/README_MCP.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LangGraph MCP (Model Context Protocol) Service
2
+
3
+ ## Project Introduction
4
+
5
+ LangGraph is a framework designed for building stateful, multi-actor applications with Large Language Models (LLMs). It provides a low-level orchestration infrastructure for long-running, durable workflows without abstracting prompts or architecture. The core components include a Bulk Synchronous Parallel (BSP) execution model, state management, and checkpointing architecture, enabling developers to create complex, stateful applications efficiently.
6
+
7
+ ## Installation Method
8
+
9
+ To install LangGraph and its dependencies, use the following pip command:
10
+
11
+ pip install langgraph
12
+
13
+ ### Dependencies
14
+
15
+ - Required: `pydantic`, `aiohttp`, `sqlalchemy`
16
+ - Optional: `redis`, `pytest`
17
+
18
+ ## Quick Start
19
+
20
+ To quickly get started with LangGraph, you can use the following example to create a simple graph:
21
+
22
+ 1. Define your graph using the `StateGraph` API or the `@entrypoint` and `@task` decorators.
23
+ 2. Compile and invoke your graph using the `Pregel` execution engine.
24
+ 3. Use the `InMemoryCheckpointSaver` for local development and testing.
25
+
26
+ Example:
27
+
28
+ from langgraph import StateGraph, Pregel
29
+
30
+ graph = StateGraph()
31
+ graph.add_node(...)
32
+ graph.compile()
33
+
34
+ pregel = Pregel(graph)
35
+ pregel.invoke(...)
36
+
37
+ ## Available Tools and Endpoints List
38
+
39
+ - **StateGraph API**: Provides methods like `add_node()`, `add_edge()`, and `compile()` to build graphs.
40
+ - **Pregel Execution Engine**: Orchestrates execution in discrete steps, persisting checkpoints for durability.
41
+ - **LangGraph CLI**: Offers commands like `dev`, `build`, and `up` for local development and Docker image generation.
42
+ - **LangGraphClient (Python SDK)**: Enables interaction with remote LangGraph deployments.
43
+ - **LangGraph Studio**: A visual debugging interface for graph execution.
44
+
45
+ ## Common Issues and Notes
46
+
47
+ - Ensure all required dependencies are installed to avoid runtime errors.
48
+ - For local development, use the `InMemoryCheckpointSaver` to avoid external dependencies.
49
+ - When deploying to production, consider using `PostgresCheckpointSaver` for robust persistence.
50
+ - Performance may vary based on the complexity of the graph and the execution environment.
51
+
52
+ ## Reference Links or Documentation
53
+
54
+ - [LangGraph GitHub Repository](https://github.com/langchain-ai/langgraph)
55
+ - [LangGraph Documentation](https://github.com/langchain-ai/langgraph/blob/main/README.md)
56
+
57
+ For more detailed information on specific subsystems, refer to the documentation sections on package structure, graph building, state persistence, remote deployment, and development tools.
langgraph/mcp_output/analysis.json ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/mcp_output/diff_report.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Langgraph Project Difference Report
2
+
3
+ **Date:** February 7, 2026
4
+ **Time:** 14:44:29
5
+ **Repository:** langgraph
6
+ **Project Type:** Python Library
7
+ **Intrusiveness:** None
8
+ **Workflow Status:** Success
9
+ **Test Status:** Failed
10
+
11
+ ## Project Overview
12
+
13
+ The Langgraph project is a Python library designed to provide basic functionality for language graph operations. It aims to facilitate the manipulation and analysis of language data structures in a graph format. The project is currently under development and has recently undergone changes that include the addition of new files.
14
+
15
+ ## Difference Analysis
16
+
17
+ ### New Files Added
18
+
19
+ A total of 8 new files have been introduced to the repository. These files are likely to contain new features or enhancements to the existing functionality. However, no existing files were modified during this update, indicating that the changes were additive rather than altering existing code.
20
+
21
+ ### Modified Files
22
+
23
+ There were no modifications to existing files in this update. This suggests that the new features or functionalities were implemented in isolation, potentially minimizing the risk of introducing bugs into the existing codebase.
24
+
25
+ ## Technical Analysis
26
+
27
+ ### Workflow Status
28
+
29
+ The workflow status is marked as "success," indicating that the automated processes for building and deploying the project were executed without errors. This suggests that the integration of new files did not disrupt the build process.
30
+
31
+ ### Test Status
32
+
33
+ The test status is marked as "failed," which is a critical issue that needs immediate attention. This failure indicates that one or more tests did not pass, which could be due to the newly added files or existing issues that were not previously detected.
34
+
35
+ ## Recommendations and Improvements
36
+
37
+ 1. **Investigate Test Failures:** Conduct a thorough investigation into the test failures to identify the root cause. This may involve reviewing the new files for potential issues or ensuring that the tests themselves are correctly configured.
38
+
39
+ 2. **Enhance Test Coverage:** Ensure that the new files are covered by unit tests. This will help in identifying any issues early in the development process and improve the overall reliability of the library.
40
+
41
+ 3. **Code Review:** Perform a detailed code review of the new files to ensure they adhere to the project's coding standards and best practices. This can help in identifying potential issues that automated tests might miss.
42
+
43
+ 4. **Documentation Update:** Update the project documentation to reflect the new features and functionalities introduced by the new files. This will aid users in understanding and utilizing the new capabilities of the library.
44
+
45
+ ## Deployment Information
46
+
47
+ Given the workflow status is successful, the deployment process for the new changes was executed without errors. However, due to the test failures, it is advisable to hold off on any production deployment until the issues are resolved.
48
+
49
+ ## Future Planning
50
+
51
+ 1. **Resolve Current Issues:** Prioritize resolving the test failures and any issues identified during the code review process.
52
+
53
+ 2. **Feature Expansion:** Plan for future enhancements and features that can be added to the library, keeping in mind the feedback from users and the current roadmap.
54
+
55
+ 3. **Community Engagement:** Engage with the community to gather feedback on the new features and identify areas for improvement.
56
+
57
+ 4. **Regular Updates:** Schedule regular updates and maintenance releases to ensure the library remains robust and up-to-date with the latest developments in the field.
58
+
59
+ ## Conclusion
60
+
61
+ The recent update to the Langgraph project has introduced new files and features, but it has also resulted in test failures that need to be addressed. By following the recommendations outlined in this report, the project can improve its stability and continue to provide valuable functionality to its users.
langgraph/mcp_output/mcp_plugin/__init__.py ADDED
File without changes
langgraph/mcp_output/mcp_plugin/adapter.py ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ # Path settings
5
+ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "source")
6
+ sys.path.insert(0, source_path)
7
+
8
+ # Import statements
9
+ try:
10
+ from examples.chatbot_simulation_evaluation.simulation_utils import add_messages, create_chat_simulator, create_simulated_user, SimulationState
11
+ from libs.cli.generate_schema import add_descriptions_to_schema, generate_schema, main as generate_schema_main
12
+ from libs.cli.examples.my_app import MyContextMiddleware
13
+ from libs.cli.examples.graph_prerelease_reqs.agent import call_model, should_continue, AgentState, ContextSchema
14
+ except ImportError as e:
15
+ print(f"Import error: {e}. Please ensure all dependencies are correctly installed.")
16
+
17
+ # Adapter class
18
+ class Adapter:
19
+ """
20
+ Adapter class to interface with the MCP plugin, utilizing functions and classes from the analysis result.
21
+ """
22
+
23
+ def __init__(self):
24
+ self.mode = "import"
25
+
26
+ # -------------------- Simulation Utilities --------------------
27
+
28
+ def create_simulation_state(self):
29
+ """
30
+ Create an instance of SimulationState.
31
+
32
+ Returns:
33
+ dict: Status and instance of SimulationState.
34
+ """
35
+ try:
36
+ instance = SimulationState()
37
+ return {"status": "success", "instance": instance}
38
+ except Exception as e:
39
+ return {"status": "error", "message": f"Failed to create SimulationState: {str(e)}"}
40
+
41
+ def call_add_messages(self, messages):
42
+ """
43
+ Call the add_messages function.
44
+
45
+ Args:
46
+ messages (list): List of messages to add.
47
+
48
+ Returns:
49
+ dict: Status and result of add_messages.
50
+ """
51
+ try:
52
+ result = add_messages(messages)
53
+ return {"status": "success", "result": result}
54
+ except Exception as e:
55
+ return {"status": "error", "message": f"Failed to add messages: {str(e)}"}
56
+
57
+ def call_create_chat_simulator(self, config):
58
+ """
59
+ Call the create_chat_simulator function.
60
+
61
+ Args:
62
+ config (dict): Configuration for the chat simulator.
63
+
64
+ Returns:
65
+ dict: Status and chat simulator instance.
66
+ """
67
+ try:
68
+ simulator = create_chat_simulator(config)
69
+ return {"status": "success", "simulator": simulator}
70
+ except Exception as e:
71
+ return {"status": "error", "message": f"Failed to create chat simulator: {str(e)}"}
72
+
73
+ def call_create_simulated_user(self, user_config):
74
+ """
75
+ Call the create_simulated_user function.
76
+
77
+ Args:
78
+ user_config (dict): Configuration for the simulated user.
79
+
80
+ Returns:
81
+ dict: Status and simulated user instance.
82
+ """
83
+ try:
84
+ user = create_simulated_user(user_config)
85
+ return {"status": "success", "user": user}
86
+ except Exception as e:
87
+ return {"status": "error", "message": f"Failed to create simulated user: {str(e)}"}
88
+
89
+ # -------------------- Schema Generation --------------------
90
+
91
+ def call_add_descriptions_to_schema(self, schema, descriptions):
92
+ """
93
+ Call the add_descriptions_to_schema function.
94
+
95
+ Args:
96
+ schema (dict): Schema to add descriptions to.
97
+ descriptions (dict): Descriptions to add.
98
+
99
+ Returns:
100
+ dict: Status and updated schema.
101
+ """
102
+ try:
103
+ updated_schema = add_descriptions_to_schema(schema, descriptions)
104
+ return {"status": "success", "updated_schema": updated_schema}
105
+ except Exception as e:
106
+ return {"status": "error", "message": f"Failed to add descriptions to schema: {str(e)}"}
107
+
108
+ def call_generate_schema(self, config):
109
+ """
110
+ Call the generate_schema function.
111
+
112
+ Args:
113
+ config (dict): Configuration for schema generation.
114
+
115
+ Returns:
116
+ dict: Status and generated schema.
117
+ """
118
+ try:
119
+ schema = generate_schema(config)
120
+ return {"status": "success", "schema": schema}
121
+ except Exception as e:
122
+ return {"status": "error", "message": f"Failed to generate schema: {str(e)}"}
123
+
124
+ def call_generate_schema_main(self, args):
125
+ """
126
+ Call the main function of generate_schema module.
127
+
128
+ Args:
129
+ args (list): Arguments for the main function.
130
+
131
+ Returns:
132
+ dict: Status of the operation.
133
+ """
134
+ try:
135
+ generate_schema_main(args)
136
+ return {"status": "success"}
137
+ except Exception as e:
138
+ return {"status": "error", "message": f"Failed to execute generate_schema main: {str(e)}"}
139
+
140
+ # -------------------- My App Utilities --------------------
141
+
142
+ def create_my_context_middleware(self):
143
+ """
144
+ Create an instance of MyContextMiddleware.
145
+
146
+ Returns:
147
+ dict: Status and instance of MyContextMiddleware.
148
+ """
149
+ try:
150
+ instance = MyContextMiddleware()
151
+ return {"status": "success", "instance": instance}
152
+ except Exception as e:
153
+ return {"status": "error", "message": f"Failed to create MyContextMiddleware: {str(e)}"}
154
+
155
+ # -------------------- Agent Utilities --------------------
156
+
157
+ def create_agent_state(self):
158
+ """
159
+ Create an instance of AgentState.
160
+
161
+ Returns:
162
+ dict: Status and instance of AgentState.
163
+ """
164
+ try:
165
+ instance = AgentState()
166
+ return {"status": "success", "instance": instance}
167
+ except Exception as e:
168
+ return {"status": "error", "message": f"Failed to create AgentState: {str(e)}"}
169
+
170
+ def create_context_schema(self):
171
+ """
172
+ Create an instance of ContextSchema.
173
+
174
+ Returns:
175
+ dict: Status and instance of ContextSchema.
176
+ """
177
+ try:
178
+ instance = ContextSchema()
179
+ return {"status": "success", "instance": instance}
180
+ except Exception as e:
181
+ return {"status": "error", "message": f"Failed to create ContextSchema: {str(e)}"}
182
+
183
+ def call_call_model(self, model_input):
184
+ """
185
+ Call the call_model function.
186
+
187
+ Args:
188
+ model_input (dict): Input for the model.
189
+
190
+ Returns:
191
+ dict: Status and model output.
192
+ """
193
+ try:
194
+ output = call_model(model_input)
195
+ return {"status": "success", "output": output}
196
+ except Exception as e:
197
+ return {"status": "error", "message": f"Failed to call model: {str(e)}"}
198
+
199
+ def call_should_continue(self, state):
200
+ """
201
+ Call the should_continue function.
202
+
203
+ Args:
204
+ state (AgentState): Current state of the agent.
205
+
206
+ Returns:
207
+ dict: Status and decision to continue.
208
+ """
209
+ try:
210
+ decision = should_continue(state)
211
+ return {"status": "success", "decision": decision}
212
+ except Exception as e:
213
+ return {"status": "error", "message": f"Failed to determine continuation: {str(e)}"}
214
+
215
+ # End of Adapter class definition
langgraph/mcp_output/mcp_plugin/main.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ MCP Service Auto-Wrapper - Auto-generated
3
+ """
4
+ from mcp_service import create_app
5
+
6
+ def main():
7
+ """Main entry point"""
8
+ app = create_app()
9
+ return app
10
+
11
+ if __name__ == "__main__":
12
+ app = main()
13
+ app.run()
langgraph/mcp_output/mcp_plugin/mcp_service.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastmcp import FastMCP, subprocess, ctypes
2
+
3
+ class CppServiceWrapper:
4
+ def __init__(self, executable_path):
5
+ self.executable_path = executable_path
6
+
7
+ def call_executable(self, *args):
8
+ try:
9
+ result = subprocess.run([self.executable_path] + list(args), capture_output=True, text=True)
10
+ if result.returncode != 0:
11
+ return {"success": False, "error": result.stderr}
12
+ return {"success": True, "result": result.stdout}
13
+ except Exception as e:
14
+ return {"success": False, "error": str(e)}
15
+
16
+ def load_dynamic_library(self, lib_path):
17
+ try:
18
+ return ctypes.CDLL(lib_path)
19
+ except OSError as e:
20
+ return None
21
+
22
+ def compile_project(build_system, source_dir):
23
+ try:
24
+ if build_system == "cmake":
25
+ subprocess.run(["cmake", source_dir], check=True)
26
+ subprocess.run(["make"], check=True)
27
+ elif build_system == "make":
28
+ subprocess.run(["make", "-C", source_dir], check=True)
29
+ elif build_system == "configure":
30
+ subprocess.run(["./configure"], cwd=source_dir, check=True)
31
+ subprocess.run(["make"], cwd=source_dir, check=True)
32
+ else:
33
+ return {"success": False, "error": "Unsupported build system"}
34
+ return {"success": True}
35
+ except subprocess.CalledProcessError as e:
36
+ return {"success": False, "error": str(e)}
37
+
38
+ mcp = FastMCP("cpp_service")
39
+
40
+ @ mcp.tool(name="compile_project", description="Compile the C/C++ project using the specified build system.")
41
+ def compile_project_tool(build_system: str, source_dir: str) -> dict:
42
+ """
43
+ Compile the C/C++ project using the specified build system.
44
+
45
+ Parameters:
46
+ - build_system (str): The build system to use (e.g., 'cmake', 'make', 'configure').
47
+ - source_dir (str): The directory containing the source code.
48
+
49
+ Returns:
50
+ - dict: A dictionary containing 'success' and 'error' fields.
51
+ """
52
+ return compile_project(build_system, source_dir)
53
+
54
+ @ mcp.tool(name="execute_cpp_function", description="Execute a C++ function via the compiled executable.")
55
+ def execute_cpp_function(executable_path: str, *args: str) -> dict:
56
+ """
57
+ Execute a C++ function via the compiled executable.
58
+
59
+ Parameters:
60
+ - executable_path (str): Path to the compiled executable.
61
+ - args (str): Arguments to pass to the executable.
62
+
63
+ Returns:
64
+ - dict: A dictionary containing 'success', 'result', and 'error' fields.
65
+ """
66
+ wrapper = CppServiceWrapper(executable_path)
67
+ return wrapper.call_executable(*args)
68
+
69
+ @ mcp.tool(name="load_cpp_library", description="Load a C++ dynamic library and return its handle.")
70
+ def load_cpp_library(lib_path: str) -> dict:
71
+ """
72
+ Load a C++ dynamic library and return its handle.
73
+
74
+ Parameters:
75
+ - lib_path (str): Path to the dynamic library.
76
+
77
+ Returns:
78
+ - dict: A dictionary containing 'success' and 'result' fields.
79
+ """
80
+ wrapper = CppServiceWrapper("")
81
+ lib = wrapper.load_dynamic_library(lib_path)
82
+ if lib is None:
83
+ return {"success": False, "error": "Failed to load library"}
84
+ return {"success": True, "result": "Library loaded successfully"}
85
+
86
+ def create_app():
87
+ return mcp
langgraph/mcp_output/requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastmcp
2
+ fastapi
3
+ uvicorn[standard]
4
+ pydantic>=2.0.0
5
+ aiohttp
6
+ sqlalchemy
langgraph/mcp_output/start_mcp.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ """
3
+ MCP Service Startup Entry
4
+ """
5
+ import sys
6
+ import os
7
+
8
+ project_root = os.path.dirname(os.path.abspath(__file__))
9
+ mcp_plugin_dir = os.path.join(project_root, "mcp_plugin")
10
+ if mcp_plugin_dir not in sys.path:
11
+ sys.path.insert(0, mcp_plugin_dir)
12
+
13
+ from mcp_service import create_app
14
+
15
+ def main():
16
+ """Start FastMCP service"""
17
+ app = create_app()
18
+ # Use environment variable to configure port, default 8000
19
+ port = int(os.environ.get("MCP_PORT", "8000"))
20
+
21
+ # Choose transport mode based on environment variable
22
+ transport = os.environ.get("MCP_TRANSPORT", "stdio")
23
+ if transport == "http":
24
+ app.run(transport="http", host="0.0.0.0", port=port)
25
+ else:
26
+ # Default to STDIO mode
27
+ app.run()
28
+
29
+ if __name__ == "__main__":
30
+ main()
langgraph/mcp_output/workflow_summary.json ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": {
3
+ "name": "langgraph",
4
+ "url": "https://github.com/langchain-ai/langgraph",
5
+ "local_path": "/export/zxcpu1/shiweijie/code/ghh/Code2MCP/workspace/langgraph",
6
+ "description": "Python library",
7
+ "features": "Basic functionality",
8
+ "tech_stack": "Python",
9
+ "stars": 0,
10
+ "forks": 0,
11
+ "language": "Python",
12
+ "last_updated": "",
13
+ "complexity": "complex",
14
+ "intrusiveness_risk": "medium"
15
+ },
16
+ "execution": {
17
+ "start_time": 1770446493.10833,
18
+ "end_time": 1770446615.1185443,
19
+ "duration": 122.01021456718445,
20
+ "status": "success",
21
+ "workflow_status": "success",
22
+ "nodes_executed": [
23
+ "download",
24
+ "analysis",
25
+ "env",
26
+ "generate",
27
+ "run",
28
+ "review",
29
+ "finalize"
30
+ ],
31
+ "total_files_processed": 0,
32
+ "environment_type": "unknown",
33
+ "llm_calls": 0,
34
+ "deepwiki_calls": 0
35
+ },
36
+ "tests": {
37
+ "original_project": {
38
+ "passed": false,
39
+ "details": {},
40
+ "test_coverage": "100%",
41
+ "execution_time": 0,
42
+ "test_files": []
43
+ },
44
+ "mcp_plugin": {
45
+ "passed": true,
46
+ "details": {},
47
+ "service_health": "healthy",
48
+ "startup_time": 0,
49
+ "transport_mode": "stdio",
50
+ "fastmcp_version": "unknown",
51
+ "mcp_version": "unknown"
52
+ }
53
+ },
54
+ "analysis": {
55
+ "structure": {
56
+ "packages": []
57
+ },
58
+ "dependencies": {
59
+ "has_environment_yml": false,
60
+ "has_requirements_txt": false,
61
+ "pyproject": false,
62
+ "setup_cfg": false,
63
+ "setup_py": false
64
+ },
65
+ "entry_points": {
66
+ "imports": [],
67
+ "cli": [],
68
+ "modules": []
69
+ },
70
+ "risk_assessment": {
71
+ "import_feasibility": 0.8,
72
+ "intrusiveness_risk": "medium",
73
+ "complexity": "complex"
74
+ },
75
+ "deepwiki_analysis": {
76
+ "repo_url": "https://github.com/langchain-ai/langgraph",
77
+ "repo_name": "langgraph",
78
+ "content": "langchain-ai/langgraph\nPackage Structure and Dependencies\nCore Execution System\nStateGraph API\nFunctional API (@task and @entrypoint)\nPregel Execution Engine\nState Management and Channels\nControl Flow Primitives\nGraph Composition and Nested Graphs\nHuman-in-the-Loop and Interrupts\nError Handling and Retry Policies\nCaching System\nPersistence and Memory\nCheckpointing Architecture\nCheckpoint Implementations\nStore System\nSerialization\nTime Travel and State Forking\nClient SDKs and Remote Execution\nJavaScript/TypeScript SDK\nHTTP Client and Streaming\nAuthentication and Authorization\nData Models and Schemas\nRemoteGraph\nCLI and Deployment\nCLI Commands\nConfiguration System (langgraph.json)\nDocker Image Generation\nMulti-Service Orchestration\nLocal Development Server\nLangGraph API Surface\nAssistants and Versioning\nThreads and State Management\nRuns and Execution\nStreaming and Events\nPrebuilt Components\nReAct Agent (create_react_agent)\nToolNode and Tool Execution\nUI Integration\nDevelopment Infrastructure\nMonorepo Structure and Build System\nTesting Infrastructure\nCI/CD Workflows\nRelease Process\nlibs/checkpoint-postgres/pyproject.toml\nlibs/checkpoint-postgres/uv.lock\nlibs/checkpoint-sqlite/pyproject.toml\nlibs/checkpoint-sqlite/uv.lock\nlibs/checkpoint/pyproject.toml\nlibs/checkpoint/uv.lock\nlibs/langgraph/README.md\nlibs/langgraph/pyproject.toml\nlibs/langgraph/uv.lock\nlibs/prebuilt/pyproject.toml\nlibs/prebuilt/uv.lock\nPurpose and Scope\nLangGraph is a framework for building stateful, multi-actor applications with Large Language Models (LLMs). It provides low-level orchestration infrastructure for long-running, durable workflows without abstracting prompts or architecture. This page provides a high-level overview of LangGraph's architecture, core components, and execution model.\nFor detailed information on specific subsystems:\nPackage organization and dependencies: seePackage Structure and Dependencies\nGraph building and execution: seeCore Execution System\nState persistence: seePersistence and Memory\nRemote deployment: seeClient SDKs and Remote Execution\nDevelopment tools: seeCLI and Deployment\nSources:README.md1-92libs/langgraph/README.md1-92libs/langgraph/pyproject.toml1-129\nCore Concepts\nLangGraph implements aBulk Synchronous Parallel (BSP)execution model inspired by Google's Pregel. The framework centers on three foundational abstractions:\nMessageGraph\nBaseCheckpointSaver\nApplications define graphs declaratively using theStateGraphAPI or imperatively using the@entrypoint/@taskfunctional API. At runtime, thePregelengine orchestrates execution in discrete steps, persisting checkpoints after each step for durability and time-travel debugging.\n@entrypoint\nSources:README.md59-67libs/langgraph/pyproject.toml6-8\nArchitectural Components\nThe LangGraph system comprises six major subsystems that work together to enable stateful agent workflows:\n6. API Server5. SDK Layer4. Development Tools3. Prebuilt Components2. Persistence Layer1. Core Frameworkcompiles tocreatespersists viausesimplementsimplementsimplementsusesusesgeneratesopensconnects toconnects torunsusesStateGraph(graph builder API)@entrypoint / @task(functional API)Pregel(execution engine)BaseCheckpointSaver(checkpoint interface)PostgresCheckpointSaverSqliteCheckpointSaverInMemoryCheckpointSaverBaseStore(cross-thread memory)create_react_agent()ToolNode(tool execution)langgraph CLILangGraph StudioLangGraphClient(Python SDK)@langchain/langgraph-sdk(JavaScript SDK)langgraph-api(FastAPI server)\ncompiles to\npersists via\nconnects to\nconnects to\nStateGraph(graph builder API)\n@entrypoint / @task(functional API)\nPregel(execution engine)\nBaseCheckpointSaver(checkpoint interface)\nPostgresCheckpointSaver\nSqliteCheckpointSaver\nInMemoryCheckpointSaver\nBaseStore(cross-thread memory)\ncreate_react_agent()\nToolNode(tool execution)\nlanggraph CLI\nLangGraph Studio\nLangGraphClient(Python SDK)\n@langchain/langgraph-sdk(JavaScript SDK)\nlanggraph-api(FastAPI server)\nComponent Descriptions:\nCore Framework: TheStateGraphclass (libs/langgraph/langgraph/graph/state.py) provides methods likeadd_node(),add_edge(), andcompile()to build graphs. ThePregelclass (libs/langgraph/langgraph/pregel/__init__.py) executes graphs in BSP steps. The functional API (libs/langgraph/langgraph/func/__init__.py) offers@entrypointand@taskdecorators for simpler graph construction.\nCore Framework: TheStateGraphclass (libs/langgraph/langgraph/graph/state.py) provides methods likeadd_node(),add_edge(), andcompile()to build graphs. ThePregelclass (libs/langgraph/langgraph/pregel/__init__.py) executes graphs in BSP steps. The functional API (libs/langgraph/langgraph/func/__init__.py) offers@entrypointand@taskdecorators for simpler graph construction.\n@entrypoint\nPersistence Layer:BaseCheckpointSaver(libs/checkpoint/langgraph/checkpoint/base/__init__.py) defines the interface for checkpoint persistence. Implementations includePostgresCheckpointSaver(libs/checkpoint-postgres/) for production deployments andSqliteCheckpointSaver(libs/checkpoint-sqlite/) for local development.BaseStore(libs/checkpoint/langgraph/checkpoint/store/base.py) provides cross-thread memory for long-term agent context.\nPersistence Layer:BaseCheckpointSaver(libs/checkpoint/langgraph/checkpoint/base/__init__.py) defines the interface for checkpoint persistence. Implementations includePostgresCheckpointSaver(libs/checkpoint-postgres/) for production deployments andSqliteCheckpointSaver(libs/checkpoint-sqlite/) for local development.BaseStore(libs/checkpoint/langgraph/checkpoint/store/base.py) provides cross-thread memory for long-term agent context.\nBaseCheckpointSaver\nPostgresCheckpointSaver\nSqliteCheckpointSaver\nPrebuilt Components: Thecreate_react_agent()function (libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py) constructs a ReAct-style agent graph.ToolNode(libs/prebuilt/langgraph/prebuilt/tool_node.py) handles tool invocation with automatic error handling.\nPrebuilt Components: Thecreate_react_agent()function (libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py) constructs a ReAct-style agent graph.ToolNode(libs/prebuilt/langgraph/prebuilt/tool_node.py) handles tool invocation with automatic error handling.\ncreate_react_agent()\nDevelopment Tools: ThelanggraphCLI (libs/cli/) provides commands likedev,build, andupfor local development and Docker image generation. LangGraph Studio is a visual debugging interface.\nDevelopment Tools: ThelanggraphCLI (libs/cli/) provides commands likedev,build, andupfor local development and Docker image generation. LangGraph Studio is a visual debugging interface.\nSDK Layer:LangGraphClient(libs/sdk-py/) enables Python applications to interact with remote LangGraph deployments. The JavaScript SDK (libs/sdk-js/) provides similar functionality with React hooks for streaming.\nSDK Layer:LangGraphClient(libs/sdk-py/) enables Python applications to interact with remote LangGraph deployments. The JavaScript SDK (libs/sdk-js/) provides similar functionality with React hooks for streaming.\nLangGraphClient\nAPI Server: Thelanggraph-apipackage (libs/api-service/) exposes deployed graphs via a REST API with Server-Sent Events (SSE) streaming.\nAPI Server: Thelanggraph-apipackage (libs/api-service/) exposes deployed graphs via a REST API with Server-Sent Events (SSE) streaming.\nlanggraph-api\nSources:libs/langgraph/pyproject.toml26-33libs/checkpoint/pyproject.toml14-17libs/checkpoint-postgres/pyproject.toml14-19libs/checkpoint-sqlite/pyproject.toml14-18libs/prebuilt/pyproject.toml26-29\nPackage Ecosystem\nLangGraph is distributed as multiple PyPI packages with explicit dependency relationships:\nlanggraphv1.0.7langgraph-checkpointv4.0.0langgraph-checkpoint-postgresv3.0.4langgraph-checkpoint-sqlitev3.0.3langgraph-prebuiltv1.0.7langgraph-sdkv0.3.xlanggraph-clilangchain-core>=0.1pydantic>=2.7.4ormsgpack>=1.12.0psycopg>=3.2.0aiosqlite>=0.20\nlanggraphv1.0.7\nlanggraph-checkpointv4.0.0\nlanggraph-checkpoint-postgresv3.0.4\nlanggraph-checkpoint-sqlitev3.0.3\nlanggraph-prebuiltv1.0.7\nlanggraph-sdkv0.3.x\nlanggraph-cli\nlangchain-core>=0.1\npydantic>=2.7.4\normsgpack>=1.12.0\npsycopg>=3.2.0\naiosqlite>=0.20\nPackage Descriptions:\nlanggraph-checkpoint>=2.1.0\nlangchain-core>=0.1\npydantic>=2.7.4\nlanggraph-checkpoint\nlangchain-core>=0.2.38\normsgpack>=1.12.0\nlanggraph-checkpoint-postgres\nlanggraph-checkpoint>=2.1.2\npsycopg>=3.2.0\nlanggraph-checkpoint-sqlite\nlanggraph-checkpoint>=3\naiosqlite>=0.20\nlanggraph-prebuilt\nlanggraph-checkpoint>=2.1.0\nlangchain-core>=1.0.0\nlanggraph-sdk\nlanggraph-cli\nlanggraph-sdk\nThe modular design allows users to install only required components. For example, a production deployment might uselanggraph+langgraph-checkpoint-postgres, while local development useslanggraph+langgraph-checkpoint-sqlite.\nlanggraph-checkpoint-postgres\nlanggraph-checkpoint-sqlite\nSources:libs/langgraph/pyproject.toml26-33libs/checkpoint/pyproject.toml14-17libs/checkpoint-postgres/pyproject.toml14-19libs/checkpoint-sqlite/pyproject.toml14-18libs/prebuilt/pyproject.toml26-29\nExecution Model\nLangGraph implements a Bulk Synchronous Parallel (BSP) execution model with automatic checkpointing:\nNodePregelRunnerPregelAlgoPregelLoopCheckpointerCompiledGraphNode[\"Node Function\"]Checkpointer[\"BaseCheckpointSaver\"]PregelRunner[\"PregelRunner\"]PregelAlgo[\"PregelAlgo\"]PregelLoop[\"PregelLoop\"]CompiledGraph[\"CompiledStateGraph\"]UserNodePregelRunnerPregelAlgoPregelLoopCheckpointerCompiledGraphNode[\"Node Function\"]Checkpointer[\"BaseCheckpointSaver\"]PregelRunner[\"PregelRunner\"]PregelAlgo[\"PregelAlgo\"]PregelLoop[\"PregelLoop\"]CompiledGraph[\"CompiledStateGraph\"]Userpar[Parallel Execution]alt[Interrupt]loop[BSP Steps]invoke(input, config)load checkpoint (or create new)CheckpointTupleexecute stepprepare_next_tasks()tasks listexecute tasks in parallelcall node_a(state)call node_b(state)node outputstask resultsupdate channels with outputsput checkpoint (checkpoint_ns, checkpoint)GraphInterrupt exceptionfinal state\nKey Execution Characteristics:\nStep-based Execution: ThePregelLoop(libs/langgraph/langgraph/pregel/loop.py) orchestrates execution in discrete supersteps. Each step consists of:Planning:PregelAlgodetermines which nodes can execute based on channel statesExecution:PregelRunnerinvokes node functions in parallelUpdate: Results are written to channelsCheckpoint: State is persisted viaBaseCheckpointSaver\nStep-based Execution: ThePregelLoop(libs/langgraph/langgraph/pregel/loop.py) orchestrates execution in discrete supersteps. Each step consists of:\nPlanning:PregelAlgodetermines which nodes can execute based on channel states\nExecution:PregelRunnerinvokes node functions in parallel\nPregelRunner\nUpdate: Results are written to channels\nCheckpoint: State is persisted viaBaseCheckpointSaver\nBaseCheckpointSaver\nChannel System: State flows between nodes through typed channels (libs/langgraph/langgraph/channels/). Channel types include:LastValue: Overwrites previous valueTopic: Appends to a sequenceBinaryOperatorAggregate: Combines values with a reducer functionEphemeralValue: Not persisted in checkpoints\nChannel System: State flows between nodes through typed channels (libs/langgraph/langgraph/channels/). Channel types include:\nLastValue: Overwrites previous value\nTopic: Appends to a sequence\nBinaryOperatorAggregate: Combines values with a reducer function\nBinaryOperatorAggregate\nEphemeralValue: Not persisted in checkpoints\nEphemeralValue\nDurability Modes: Configured viacompile()withinterrupt_before/interrupt_afteror explicitCommand.update()/Command.goto()returns. The system automatically saves checkpoints according to the durability policy.\nDurability Modes: Configured viacompile()withinterrupt_before/interrupt_afteror explicitCommand.update()/Command.goto()returns. The system automatically saves checkpoints according to the durability policy.\ninterrupt_before\ninterrupt_after\nCommand.update()\nCommand.goto()\nResumability: Any checkpoint can be loaded and execution resumed from that point usinginvoke(input, config={\"configurable\": {\"checkpoint_id\": \"...\"}}).\nResumability: Any checkpoint can be loaded and execution resumed from that point usinginvoke(input, config={\"configurable\": {\"checkpoint_id\": \"...\"}}).\ninvoke(input, config={\"configurable\": {\"checkpoint_id\": \"...\"}})\nSources:libs/langgraph/langgraph/pregel/__init__.pylibs/langgraph/langgraph/pregel/loop.pylibs/langgraph/langgraph/channels/\nDevelopment Workflow\nThe typical LangGraph development lifecycle progresses from local iteration to production deployment:\niterateopenreadytest locallydeployLocal Development(in-memory execution)langgraph dev(hot-reload server)LangGraph Studio(visual debugger)langgraph build(Docker image)docker compose up(PostgreSQL + Redis + API)LangSmith Deployment(managed hosting)SDK Access(LangGraphClient)\ntest locally\nLocal Development(in-memory execution)\nlanggraph dev(hot-reload server)\nLangGraph Studio(visual debugger)\nlanggraph build(Docker image)\ndocker compose up(PostgreSQL + Redis + API)\nLangSmith Deployment(managed hosting)\nSDK Access(LangGraphClient)\nWorkflow Stages:\nLocal Development: Write graph code and test withStateGraph.compile().invoke(). UseInMemoryCheckpointSaver(libs/checkpoint/langgraph/checkpoint/memory/__init__.py) for fast iteration without external dependencies.\nLocal Development: Write graph code and test withStateGraph.compile().invoke(). UseInMemoryCheckpointSaver(libs/checkpoint/langgraph/checkpoint/memory/__init__.py) for fast iteration without external dependencies.\nStateGraph.compile().invoke()\nInMemoryCheckpointSaver\nDevelopment Server: Runlanggraph dev(libs/cli/langgraph_cli/cli.py) to start a local server with hot reloading. The server automatically reloads on code changes and exposes the graph athttp://localhost:8123.\nDevelopment Server: Runlanggraph dev(libs/cli/langgraph_cli/cli.py) to start a local server with hot reloading. The server automatically reloads on code changes and exposes the graph athttp://localhost:8123.",
79
+ "model": "gpt-4o-2024-08-06",
80
+ "source": "selenium",
81
+ "success": true
82
+ },
83
+ "code_complexity": {
84
+ "cyclomatic_complexity": "medium",
85
+ "cognitive_complexity": "medium",
86
+ "maintainability_index": 75
87
+ },
88
+ "security_analysis": {
89
+ "vulnerabilities_found": 0,
90
+ "security_score": 85,
91
+ "recommendations": []
92
+ }
93
+ },
94
+ "plugin_generation": {
95
+ "files_created": [
96
+ "mcp_output/start_mcp.py",
97
+ "mcp_output/mcp_plugin/__init__.py",
98
+ "mcp_output/mcp_plugin/mcp_service.py",
99
+ "mcp_output/mcp_plugin/adapter.py",
100
+ "mcp_output/mcp_plugin/main.py",
101
+ "mcp_output/requirements.txt",
102
+ "mcp_output/README_MCP.md"
103
+ ],
104
+ "main_entry": "start_mcp.py",
105
+ "requirements": [
106
+ "fastmcp>=0.1.0",
107
+ "pydantic>=2.0.0"
108
+ ],
109
+ "readme_path": "/export/zxcpu1/shiweijie/code/ghh/Code2MCP/workspace/langgraph/mcp_output/README_MCP.md",
110
+ "adapter_mode": "import",
111
+ "total_lines_of_code": 0,
112
+ "generated_files_size": 0,
113
+ "tool_endpoints": 0,
114
+ "supported_features": [
115
+ "Basic functionality"
116
+ ],
117
+ "generated_tools": [
118
+ "Basic tools",
119
+ "Health check tools",
120
+ "Version info tools"
121
+ ]
122
+ },
123
+ "code_review": {},
124
+ "errors": [],
125
+ "warnings": [],
126
+ "recommendations": [
127
+ "- Implement comprehensive test coverage to ensure code reliability and maintainability\n- Optimize large file sizes to improve performance and reduce load times\n- Enhance documentation for better understanding of complex modules and functions\n- Streamline the dependency management process by utilizing a requirements.txt or pyproject.toml file\n- Improve the CI/CD workflows to automate testing and deployment processes\n- Refactor code to reduce complexity and improve readability\n- Conduct a security audit to identify and mitigate potential vulnerabilities\n- Enhance the CLI tool with more user-friendly commands and options\n- Implement a more robust error handling mechanism to improve system resilience\n- Optimize the use of resources in the development and production environments\n- Increase the modularity of the codebase to facilitate easier updates and maintenance\n- Improve the integration of the JavaScript/TypeScript SDK with the existing system\n- Enhance the caching system to improve data retrieval speeds\n- Conduct regular performance testing to identify and address bottlenecks\n- Improve the logging and monitoring systems for better issue tracking and resolution"
128
+ ],
129
+ "performance_metrics": {
130
+ "memory_usage_mb": 0,
131
+ "cpu_usage_percent": 0,
132
+ "response_time_ms": 0,
133
+ "throughput_requests_per_second": 0
134
+ },
135
+ "deployment_info": {
136
+ "supported_platforms": [
137
+ "Linux",
138
+ "Windows",
139
+ "macOS"
140
+ ],
141
+ "python_versions": [
142
+ "3.8",
143
+ "3.9",
144
+ "3.10",
145
+ "3.11",
146
+ "3.12"
147
+ ],
148
+ "deployment_methods": [
149
+ "Docker",
150
+ "pip",
151
+ "conda"
152
+ ],
153
+ "monitoring_support": true,
154
+ "logging_configuration": "structured"
155
+ },
156
+ "execution_analysis": {
157
+ "success_factors": [
158
+ "Efficient execution of all workflow nodes",
159
+ "Successful generation of MCP plugin files"
160
+ ],
161
+ "failure_reasons": [],
162
+ "overall_assessment": "good",
163
+ "node_performance": {
164
+ "download_time": "Completed successfully, indicating efficient data retrieval",
165
+ "analysis_time": "Completed successfully, indicating effective code analysis",
166
+ "generation_time": "Completed successfully, indicating efficient code generation",
167
+ "test_time": "No original project tests passed, indicating potential issues with test setup or coverage"
168
+ },
169
+ "resource_usage": {
170
+ "memory_efficiency": "Memory usage data not available",
171
+ "cpu_efficiency": "CPU usage data not available",
172
+ "disk_usage": "Disk usage data not available"
173
+ }
174
+ },
175
+ "technical_quality": {
176
+ "code_quality_score": 70,
177
+ "architecture_score": 75,
178
+ "performance_score": 65,
179
+ "maintainability_score": 75,
180
+ "security_score": 85,
181
+ "scalability_score": 70
182
+ }
183
+ }
langgraph/source/AGENTS.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AGENTS Instructions
2
+
3
+ This repository is a monorepo. Each library lives in a subdirectory under `libs/`.
4
+
5
+ When you modify code in any library, run the following commands in that library's directory before creating a pull request:
6
+
7
+ - `make format` – run code formatters
8
+ - `make lint` – run the linter
9
+ - `make test` – execute the test suite
10
+
11
+ To run a particular test file or to pass additional pytest options you can specify the `TEST` variable:
12
+
13
+ ```txt
14
+ TEST=path/to/test.py make test
15
+ ```
16
+
17
+ Other pytest arguments can also be supplied inside the `TEST` variable.
18
+
19
+ ## Libraries
20
+
21
+ The repository contains several Python and JavaScript/TypeScript libraries.
22
+ Below is a high-level overview:
23
+
24
+ - **checkpoint** – base interfaces for LangGraph checkpointers.
25
+ - **checkpoint-postgres** – Postgres implementation of the checkpoint saver.
26
+ - **checkpoint-sqlite** – SQLite implementation of the checkpoint saver.
27
+ - **cli** – official command-line interface for LangGraph.
28
+ - **langgraph** – core framework for building stateful, multi-actor agents.
29
+ - **prebuilt** – high-level APIs for creating and running agents and tools.
30
+ - **sdk-js** – JS/TS SDK for interacting with the LangGraph REST API.
31
+ - **sdk-py** – Python SDK for the LangGraph Server API.
32
+
33
+ ### Dependency map
34
+
35
+ The diagram below lists downstream libraries for each production dependency as
36
+ declared in that library's `pyproject.toml` (or `package.json`).
37
+
38
+ ```text
39
+ checkpoint
40
+ ├── checkpoint-postgres
41
+ ├── checkpoint-sqlite
42
+ ├── prebuilt
43
+ └── langgraph
44
+
45
+ prebuilt
46
+ └── langgraph
47
+
48
+ sdk-py
49
+ ├── langgraph
50
+ └── cli
51
+
52
+ sdk-js (standalone)
53
+ ```
54
+
55
+ Changes to a library may impact all of its dependents shown above.
56
+
57
+ - Do NOT use Sphinx-style double backtick formatting (` ``code`` `). Use single backticks (`` `code` ``) for inline code references in docstrings and comments.
langgraph/source/CLAUDE.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AGENTS Instructions
2
+
3
+ This repository is a monorepo. Each library lives in a subdirectory under `libs/`.
4
+
5
+ When you modify code in any library, run the following commands in that library's directory before creating a pull request:
6
+
7
+ - `make format` – run code formatters
8
+ - `make lint` – run the linter
9
+ - `make test` – execute the test suite
10
+
11
+ To run a particular test file or to pass additional pytest options you can specify the `TEST` variable:
12
+
13
+ ```
14
+ TEST=path/to/test.py make test
15
+ ```
16
+
17
+ Other pytest arguments can also be supplied inside the `TEST` variable.
18
+
19
+ ## Libraries
20
+
21
+ The repository contains several Python and JavaScript/TypeScript libraries.
22
+ Below is a high-level overview:
23
+
24
+ - **checkpoint** – base interfaces for LangGraph checkpointers.
25
+ - **checkpoint-postgres** – Postgres implementation of the checkpoint saver.
26
+ - **checkpoint-sqlite** – SQLite implementation of the checkpoint saver.
27
+ - **cli** – official command-line interface for LangGraph.
28
+ - **langgraph** – core framework for building stateful, multi-actor agents.
29
+ - **prebuilt** – high-level APIs for creating and running agents and tools.
30
+ - **sdk-js** – JS/TS SDK for interacting with the LangGraph REST API.
31
+ - **sdk-py** – Python SDK for the LangGraph Server API.
32
+
33
+ ### Dependency map
34
+
35
+ The diagram below lists downstream libraries for each production dependency as
36
+ declared in that library's `pyproject.toml` (or `package.json`).
37
+
38
+ ```text
39
+ checkpoint
40
+ ├── checkpoint-postgres
41
+ ├── checkpoint-sqlite
42
+ ├── prebuilt
43
+ └── langgraph
44
+
45
+ prebuilt
46
+ └── langgraph
47
+
48
+ sdk-py
49
+ ├── langgraph
50
+ └── cli
51
+
52
+ sdk-js (standalone)
53
+ ```
54
+
55
+ Changes to a library may impact all of its dependents shown above.
56
+
57
+ - Do NOT use Sphinx-style double backtick formatting (` ``code`` `). Use single backticks (`` `code` ``) for inline code references in docstrings and comments.
langgraph/source/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 LangChain, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
langgraph/source/Makefile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Define the directories containing projects
2
+ LIBS_DIRS := $(wildcard libs/*)
3
+
4
+ # Default target
5
+ .PHONY: all
6
+ all: lint format lock test
7
+
8
+ # Install dependencies for all projects
9
+ .PHONY: install
10
+ install:
11
+ @echo "Creating virtual environment..."
12
+ @uv venv
13
+ @for dir in $(LIBS_DIRS); do \
14
+ if [ -f $$dir/pyproject.toml ]; then \
15
+ echo "Installing dependencies for $$dir"; \
16
+ uv pip install -e $$dir; \
17
+ fi; \
18
+ done
19
+
20
+ # Lint all projects
21
+ .PHONY: lint
22
+ lint:
23
+ @for dir in $(LIBS_DIRS); do \
24
+ if [ -f $$dir/Makefile ]; then \
25
+ echo "Running lint in $$dir"; \
26
+ $(MAKE) -C $$dir lint; \
27
+ fi; \
28
+ done
29
+
30
+ # Format all projects
31
+ .PHONY: format
32
+ format:
33
+ @for dir in $(LIBS_DIRS); do \
34
+ if [ -f $$dir/Makefile ]; then \
35
+ echo "Running format in $$dir"; \
36
+ $(MAKE) -C $$dir format; \
37
+ fi; \
38
+ done
39
+
40
+ # Lock all projects
41
+ .PHONY: lock
42
+ lock:
43
+ @for dir in $(LIBS_DIRS); do \
44
+ if [ -f $$dir/Makefile ]; then \
45
+ echo "Running lock in $$dir"; \
46
+ (cd $$dir && uv lock); \
47
+ fi; \
48
+ done
49
+
50
+ # Lock all projects and upgrade dependencies
51
+ .PHONY: lock-upgrade
52
+ lock-upgrade:
53
+ @for dir in $(LIBS_DIRS); do \
54
+ if [ -f $$dir/Makefile ]; then \
55
+ echo "Running lock-upgrade in $$dir"; \
56
+ (cd $$dir && uv lock --upgrade); \
57
+ fi; \
58
+ done
59
+
60
+ # Test all projects
61
+ .PHONY: test
62
+ test:
63
+ @for dir in $(LIBS_DIRS); do \
64
+ if [ -f $$dir/Makefile ]; then \
65
+ echo "Running test in $$dir"; \
66
+ $(MAKE) -C $$dir test; \
67
+ fi; \
68
+ done
langgraph/source/README.md ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <picture class="github-only">
2
+ <source media="(prefers-color-scheme: light)" srcset="https://langchain-ai.github.io/langgraph/static/wordmark_dark.svg">
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://langchain-ai.github.io/langgraph/static/wordmark_light.svg">
4
+ <img alt="LangGraph Logo" src="https://langchain-ai.github.io/langgraph/static/wordmark_dark.svg" width="80%">
5
+ </picture>
6
+
7
+ <div>
8
+ <br>
9
+ </div>
10
+
11
+ [![Version](https://img.shields.io/pypi/v/langgraph.svg)](https://pypi.org/project/langgraph/)
12
+ [![Downloads](https://static.pepy.tech/badge/langgraph/month)](https://pepy.tech/project/langgraph)
13
+ [![Open Issues](https://img.shields.io/github/issues-raw/langchain-ai/langgraph)](https://github.com/langchain-ai/langgraph/issues)
14
+ [![Docs](https://img.shields.io/badge/docs-latest-blue)](https://docs.langchain.com/oss/python/langgraph/overview)
15
+
16
+ Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents.
17
+
18
+ ## Get started
19
+
20
+ Install LangGraph:
21
+
22
+ ```
23
+ pip install -U langgraph
24
+ ```
25
+
26
+ Create a simple workflow:
27
+
28
+ ```python
29
+ from langgraph.graph import START, StateGraph
30
+ from typing_extensions import TypedDict
31
+
32
+
33
+ class State(TypedDict):
34
+ text: str
35
+
36
+
37
+ def node_a(state: State) -> dict:
38
+ return {"text": state["text"] + "a"}
39
+
40
+
41
+ def node_b(state: State) -> dict:
42
+ return {"text": state["text"] + "b"}
43
+
44
+
45
+ graph = StateGraph(State)
46
+ graph.add_node("node_a", node_a)
47
+ graph.add_node("node_b", node_b)
48
+ graph.add_edge(START, "node_a")
49
+ graph.add_edge("node_a", "node_b")
50
+
51
+ print(graph.compile().invoke({"text": ""}))
52
+ # {'text': 'ab'}
53
+ ```
54
+
55
+ Get started with the [LangGraph Quickstart](https://docs.langchain.com/oss/python/langgraph/quickstart).
56
+
57
+ To quickly build agents with LangChain's `create_agent` (built on LangGraph), see the [LangChain Agents documentation](https://docs.langchain.com/oss/python/langchain/agents).
58
+
59
+ ## Core benefits
60
+
61
+ LangGraph provides low-level supporting infrastructure for *any* long-running, stateful workflow or agent. LangGraph does not abstract prompts or architecture, and provides the following central benefits:
62
+
63
+ - [Durable execution](https://docs.langchain.com/oss/python/langgraph/durable-execution): Build agents that persist through failures and can run for extended periods, automatically resuming from exactly where they left off.
64
+ - [Human-in-the-loop](https://docs.langchain.com/oss/python/langgraph/interrupts): Seamlessly incorporate human oversight by inspecting and modifying agent state at any point during execution.
65
+ - [Comprehensive memory](https://docs.langchain.com/oss/python/langgraph/memory): Create truly stateful agents with both short-term working memory for ongoing reasoning and long-term persistent memory across sessions.
66
+ - [Debugging with LangSmith](http://www.langchain.com/langsmith): Gain deep visibility into complex agent behavior with visualization tools that trace execution paths, capture state transitions, and provide detailed runtime metrics.
67
+ - [Production-ready deployment](https://docs.langchain.com/langsmith/app-development): Deploy sophisticated agent systems confidently with scalable infrastructure designed to handle the unique challenges of stateful, long-running workflows.
68
+
69
+ ## LangGraph’s ecosystem
70
+
71
+ While LangGraph can be used standalone, it also integrates seamlessly with any LangChain product, giving developers a full suite of tools for building agents. To improve your LLM application development, pair LangGraph with:
72
+
73
+ - [LangSmith](http://www.langchain.com/langsmith) — Helpful for agent evals and observability. Debug poor-performing LLM app runs, evaluate agent trajectories, gain visibility in production, and improve performance over time.
74
+ - [LangSmith Deployment](https://docs.langchain.com/langsmith/deployments) — Deploy and scale agents effortlessly with a purpose-built deployment platform for long running, stateful workflows. Discover, reuse, configure, and share agents across teams — and iterate quickly with visual prototyping in [LangGraph Studio](https://docs.langchain.com/oss/python/langgraph/studio).
75
+ - [LangChain](https://docs.langchain.com/oss/python/langchain/overview) – Provides integrations and composable components to streamline LLM application development.
76
+
77
+ > [!NOTE]
78
+ > Looking for the JS version of LangGraph? See the [JS repo](https://github.com/langchain-ai/langgraphjs) and the [JS docs](https://docs.langchain.com/oss/javascript/langgraph/overview).
79
+
80
+ ## Additional resources
81
+
82
+ - [Guides](https://docs.langchain.com/oss/python/langgraph/overview): Quick, actionable code snippets for topics such as streaming, adding memory & persistence, and design patterns (e.g. branching, subgraphs, etc.).
83
+ - [Reference](https://reference.langchain.com/python/langgraph/): Detailed reference on core classes, methods, how to use the graph and checkpointing APIs, and higher-level prebuilt components.
84
+ - [Examples](https://docs.langchain.com/oss/python/langgraph/agentic-rag): Guided examples on getting started with LangGraph.
85
+ - [LangChain Forum](https://forum.langchain.com/): Connect with the community and share all of your technical questions, ideas, and feedback.
86
+ - [LangChain Academy](https://academy.langchain.com/courses/intro-to-langgraph): Learn the basics of LangGraph in our free, structured course.
87
+ - [Case studies](https://www.langchain.com/built-with-langgraph): Hear how industry leaders use LangGraph to ship AI applications at scale.
88
+
89
+ ## Acknowledgements
90
+
91
+ LangGraph is inspired by [Pregel](https://research.google/pubs/pub37252/) and [Apache Beam](https://beam.apache.org/). The public interface draws inspiration from [NetworkX](https://networkx.org/documentation/latest/). LangGraph is built by LangChain Inc, the creators of LangChain, but can be used without LangChain.
langgraph/source/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ langgraph Project Package Initialization File
4
+ """
langgraph/source/examples/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # LangGraph examples
2
+
3
+ This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview). Please refer to the LangChain docs for the most up-to-date examples and usage guidelines for LangGraph.
langgraph/source/examples/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # -*- coding: utf-8 -*-
langgraph/source/examples/chatbot-simulation-evaluation/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # -*- coding: utf-8 -*-
langgraph/source/examples/chatbot-simulation-evaluation/agent-simulation-evaluation.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "10251c1c",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/chatbot-simulation-evaluation/agent-simulation-evaluation.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "c5fc63df",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.1"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/chatbot-simulation-evaluation/langsmith-agent-simulation-evaluation.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "a4351a24",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/chatbot-simulation-evaluation/langsmith-agent-simulation-evaluation.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "4cc9af1e",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/chatbot-simulation-evaluation/simulation_utils.py ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import functools
2
+ from typing import Annotated, Any, Callable, Dict, List, Optional, Union
3
+
4
+ from langchain_community.adapters.openai import convert_message_to_dict
5
+ from langchain_core.messages import AIMessage, AnyMessage, BaseMessage, HumanMessage
6
+ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
7
+ from langchain_core.runnables import Runnable, RunnableLambda
8
+ from langchain_core.runnables import chain as as_runnable
9
+ from langchain_openai import ChatOpenAI
10
+ from typing_extensions import TypedDict
11
+
12
+ from langgraph.graph import END, StateGraph, START
13
+
14
+
15
+ def langchain_to_openai_messages(messages: List[BaseMessage]):
16
+ """
17
+ Convert a list of langchain base messages to a list of openai messages.
18
+
19
+ Parameters:
20
+ messages (List[BaseMessage]): A list of langchain base messages.
21
+
22
+ Returns:
23
+ List[dict]: A list of openai messages.
24
+ """
25
+
26
+ return [
27
+ convert_message_to_dict(m) if isinstance(m, BaseMessage) else m
28
+ for m in messages
29
+ ]
30
+
31
+
32
+ def create_simulated_user(
33
+ system_prompt: str, llm: Runnable | None = None
34
+ ) -> Runnable[Dict, AIMessage]:
35
+ """
36
+ Creates a simulated user for chatbot simulation.
37
+
38
+ Args:
39
+ system_prompt (str): The system prompt to be used by the simulated user.
40
+ llm (Runnable | None, optional): The language model to be used for the simulation.
41
+ Defaults to gpt-3.5-turbo.
42
+
43
+ Returns:
44
+ Runnable[Dict, AIMessage]: The simulated user for chatbot simulation.
45
+ """
46
+ return ChatPromptTemplate.from_messages(
47
+ [
48
+ ("system", system_prompt),
49
+ MessagesPlaceholder(variable_name="messages"),
50
+ ]
51
+ ) | (llm or ChatOpenAI(model="gpt-3.5-turbo")).with_config(
52
+ run_name="simulated_user"
53
+ )
54
+
55
+
56
+ Messages = Union[list[AnyMessage], AnyMessage]
57
+
58
+
59
+ def add_messages(left: Messages, right: Messages) -> Messages:
60
+ if not isinstance(left, list):
61
+ left = [left]
62
+ if not isinstance(right, list):
63
+ right = [right]
64
+ return left + right
65
+
66
+
67
+ class SimulationState(TypedDict):
68
+ """
69
+ Represents the state of a simulation.
70
+
71
+ Attributes:
72
+ messages (List[AnyMessage]): A list of messages in the simulation.
73
+ inputs (Optional[dict[str, Any]]): Optional inputs for the simulation.
74
+ """
75
+
76
+ messages: Annotated[List[AnyMessage], add_messages]
77
+ inputs: Optional[dict[str, Any]]
78
+
79
+
80
+ def create_chat_simulator(
81
+ assistant: (
82
+ Callable[[List[AnyMessage]], str | AIMessage]
83
+ | Runnable[List[AnyMessage], str | AIMessage]
84
+ ),
85
+ simulated_user: Runnable[Dict, AIMessage],
86
+ *,
87
+ input_key: str,
88
+ max_turns: int = 6,
89
+ should_continue: Optional[Callable[[SimulationState], str]] = None,
90
+ ):
91
+ """Creates a chat simulator for evaluating a chatbot.
92
+
93
+ Args:
94
+ assistant: The chatbot assistant function or runnable object.
95
+ simulated_user: The simulated user object.
96
+ input_key: The key for the input to the chat simulation.
97
+ max_turns: The maximum number of turns in the chat simulation. Default is 6.
98
+ should_continue: Optional function to determine if the simulation should continue.
99
+ If not provided, a default function will be used.
100
+
101
+ Returns:
102
+ The compiled chat simulation graph.
103
+
104
+ """
105
+ graph_builder = StateGraph(SimulationState)
106
+ graph_builder.add_node(
107
+ "user",
108
+ _create_simulated_user_node(simulated_user),
109
+ )
110
+ graph_builder.add_node(
111
+ "assistant", _fetch_messages | assistant | _coerce_to_message
112
+ )
113
+ graph_builder.add_edge("assistant", "user")
114
+ graph_builder.add_conditional_edges(
115
+ "user",
116
+ should_continue or functools.partial(_should_continue, max_turns=max_turns),
117
+ )
118
+ # If your dataset has a 'leading question/input', then we route first to the assistant, otherwise, we let the user take the lead.
119
+ graph_builder.add_edge(START, "assistant" if input_key is not None else "user")
120
+
121
+ return (
122
+ RunnableLambda(_prepare_example).bind(input_key=input_key)
123
+ | graph_builder.compile()
124
+ )
125
+
126
+
127
+ ## Private methods
128
+
129
+
130
+ def _prepare_example(inputs: dict[str, Any], input_key: Optional[str] = None):
131
+ if input_key is not None:
132
+ if input_key not in inputs:
133
+ raise ValueError(
134
+ f"Dataset's example input must contain the provided input key: '{input_key}'.\nFound: {list(inputs.keys())}"
135
+ )
136
+ messages = [HumanMessage(content=inputs[input_key])]
137
+ return {
138
+ "inputs": {k: v for k, v in inputs.items() if k != input_key},
139
+ "messages": messages,
140
+ }
141
+ return {"inputs": inputs, "messages": []}
142
+
143
+
144
+ def _invoke_simulated_user(state: SimulationState, simulated_user: Runnable):
145
+ """Invoke the simulated user node."""
146
+ runnable = (
147
+ simulated_user
148
+ if isinstance(simulated_user, Runnable)
149
+ else RunnableLambda(simulated_user)
150
+ )
151
+ inputs = state.get("inputs", {})
152
+ inputs["messages"] = state["messages"]
153
+ return runnable.invoke(inputs)
154
+
155
+
156
+ def _swap_roles(state: SimulationState):
157
+ new_messages = []
158
+ for m in state["messages"]:
159
+ if isinstance(m, AIMessage):
160
+ new_messages.append(HumanMessage(content=m.content))
161
+ else:
162
+ new_messages.append(AIMessage(content=m.content))
163
+ return {
164
+ "inputs": state.get("inputs", {}),
165
+ "messages": new_messages,
166
+ }
167
+
168
+
169
+ @as_runnable
170
+ def _fetch_messages(state: SimulationState):
171
+ """Invoke the simulated user node."""
172
+ return state["messages"]
173
+
174
+
175
+ def _convert_to_human_message(message: BaseMessage):
176
+ return {"messages": [HumanMessage(content=message.content)]}
177
+
178
+
179
+ def _create_simulated_user_node(simulated_user: Runnable):
180
+ """Simulated user accepts a {"messages": [...]} argument and returns a single message."""
181
+ return (
182
+ _swap_roles
183
+ | RunnableLambda(_invoke_simulated_user).bind(simulated_user=simulated_user)
184
+ | _convert_to_human_message
185
+ )
186
+
187
+
188
+ def _coerce_to_message(assistant_output: str | BaseMessage):
189
+ if isinstance(assistant_output, str):
190
+ return {"messages": [AIMessage(content=assistant_output)]}
191
+ else:
192
+ return {"messages": [assistant_output]}
193
+
194
+
195
+ def _should_continue(state: SimulationState, max_turns: int = 6):
196
+ messages = state["messages"]
197
+ # TODO support other stop criteria
198
+ if len(messages) > max_turns:
199
+ return END
200
+ elif messages[-1].content.strip() == "FINISHED":
201
+ return END
202
+ else:
203
+ return "assistant"
langgraph/source/examples/chatbots/information-gather-prompting.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "a9014f94",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/chatbots/information-gather-prompting.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "f47ce992",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.9"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/code_assistant/langgraph_code_assistant.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "1f2f13ca",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/code_assistant/langgraph_code_assistant.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "5e4c9bfe",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.12.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/code_assistant/langgraph_code_assistant_mistral.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/customer-support/customer-support.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "a8232bc9",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/customer-support/customer-support.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "63da8671",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.12.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/extraction/retries.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "8dbdba5b",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/extraction/retries.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "1d444b7f",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.12.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/human_in_the_loop/wait-user-input.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "3ecab357",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "3f2866bd",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.9"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/lats/lats.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "09038b53",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/lats/lats.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "b1669748",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.12.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/llm-compiler/LLMCompiler.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "85205e97",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/llm-compiler/LLMCompiler.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "2fdab366",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.9"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/multi_agent/hierarchical_agent_teams.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "5cc8a2ad",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/multi_agent/hierarchical_agent_teams.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "b9f3508a",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.9"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/multi_agent/multi-agent-collaboration.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "d2b507b9",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/multi_agent/multi-agent-collaboration.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "41a8f10a",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/plan-and-execute/plan-and-execute.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "9138f92e",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/plan-and-execute/plan-and-execute.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "093678ba",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/rag/langgraph_adaptive_rag.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_adaptive_rag_cohere.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_adaptive_rag_local.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_agentic_rag.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_crag.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_crag_local.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_self_rag.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_self_rag_local.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/rag/langgraph_self_rag_pinecone_movies.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
langgraph/source/examples/react-agent-from-scratch.ipynb ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "294995c4",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/how-tos/react-agent-from-scratch.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "metadata": {},
14
+ "source": [
15
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
16
+ ]
17
+ }
18
+ ],
19
+ "metadata": {
20
+ "kernelspec": {
21
+ "display_name": "Python 3",
22
+ "language": "python",
23
+ "name": "python3"
24
+ },
25
+ "language_info": {
26
+ "codemirror_mode": {
27
+ "name": "ipython",
28
+ "version": 3
29
+ },
30
+ "file_extension": ".py",
31
+ "mimetype": "text/x-python",
32
+ "name": "python",
33
+ "nbconvert_exporter": "python",
34
+ "pygments_lexer": "ipython3",
35
+ "version": "3.11.9"
36
+ }
37
+ },
38
+ "nbformat": 4,
39
+ "nbformat_minor": 2
40
+ }
langgraph/source/examples/react-agent-structured-output.ipynb ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "40f0d107",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/how-tos/react-agent-structured-output.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "metadata": {},
14
+ "source": [
15
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
16
+ ]
17
+ }
18
+ ],
19
+ "metadata": {
20
+ "kernelspec": {
21
+ "display_name": "Python 3 (ipykernel)",
22
+ "language": "python",
23
+ "name": "python3"
24
+ },
25
+ "language_info": {
26
+ "codemirror_mode": {
27
+ "name": "ipython",
28
+ "version": 3
29
+ },
30
+ "file_extension": ".py",
31
+ "mimetype": "text/x-python",
32
+ "name": "python",
33
+ "nbconvert_exporter": "python",
34
+ "pygments_lexer": "ipython3",
35
+ "version": "3.11.9"
36
+ }
37
+ },
38
+ "nbformat": 4,
39
+ "nbformat_minor": 4
40
+ }
langgraph/source/examples/reflection/reflection.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "658773a2",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/reflection/reflection.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "1cb60657",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.11.9"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }
langgraph/source/examples/reflexion/reflexion.ipynb ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "caf07859",
6
+ "metadata": {},
7
+ "source": [
8
+ "[This file has been moved](https://github.com/langchain-ai/langgraph/blob/23961cff61a42b52525f3b20b4094d8d2fba1744/docs/docs/tutorials/reflexion/reflexion.ipynb)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "cd1df0e0",
14
+ "metadata": {},
15
+ "source": [
16
+ "This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview)."
17
+ ]
18
+ }
19
+ ],
20
+ "metadata": {
21
+ "kernelspec": {
22
+ "display_name": "Python 3 (ipykernel)",
23
+ "language": "python",
24
+ "name": "python3"
25
+ },
26
+ "language_info": {
27
+ "codemirror_mode": {
28
+ "name": "ipython",
29
+ "version": 3
30
+ },
31
+ "file_extension": ".py",
32
+ "mimetype": "text/x-python",
33
+ "name": "python",
34
+ "nbconvert_exporter": "python",
35
+ "pygments_lexer": "ipython3",
36
+ "version": "3.12.2"
37
+ }
38
+ },
39
+ "nbformat": 4,
40
+ "nbformat_minor": 5
41
+ }