[GH-ISSUE #1788] [langgraph]: Missing of Code Explaination #232

Closed
opened 2026-02-17 17:19:27 -05:00 by yindo · 1 comment
Owner

Originally created by @SijanMahmudAI on GitHub (Dec 8, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1788

Type of issue

issue / bug

Language

Python

Description

I have found this code in this page : https://docs.langchain.com/oss/python/langgraph/graph-api#node-caching .
But the problem is I did not found the explanation of ".set_entry_point()" and ".set_finish_point()" methods in the full documentation.

Please add the explanation of these methods or just remove from the documentation code.

code:

import time
from typing_extensions import TypedDict
from langgraph.graph import StateGraph
from langgraph.cache.memory import InMemoryCache
from langgraph.types import CachePolicy


class State(TypedDict):
    x: int
    result: int


builder = StateGraph(State)


def expensive_node(state: State) -> dict[str, int]:
    # expensive computation
    time.sleep(2)
    return {"result": state["x"] * 2}


builder.add_node("expensive_node", expensive_node, cache_policy=CachePolicy(ttl=3))
builder.set_entry_point("expensive_node")
builder.set_finish_point("expensive_node")

graph = builder.compile(cache=InMemoryCache())

print(graph.invoke({"x": 5}, stream_mode='updates'))    
# [{'expensive_node': {'result': 10}}]
print(graph.invoke({"x": 5}, stream_mode='updates'))    
# [{'expensive_node': {'result': 10}, '__metadata__': {'cached': True}}]
Originally created by @SijanMahmudAI on GitHub (Dec 8, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1788 ### Type of issue issue / bug ### Language Python ### Description I have found this code in this page : https://docs.langchain.com/oss/python/langgraph/graph-api#node-caching . But the problem is I did not found the explanation of ".set_entry_point()" and ".set_finish_point()" methods in the full documentation. Please add the explanation of these methods or just remove from the documentation code. **code:** ```python import time from typing_extensions import TypedDict from langgraph.graph import StateGraph from langgraph.cache.memory import InMemoryCache from langgraph.types import CachePolicy class State(TypedDict): x: int result: int builder = StateGraph(State) def expensive_node(state: State) -> dict[str, int]: # expensive computation time.sleep(2) return {"result": state["x"] * 2} builder.add_node("expensive_node", expensive_node, cache_policy=CachePolicy(ttl=3)) builder.set_entry_point("expensive_node") builder.set_finish_point("expensive_node") graph = builder.compile(cache=InMemoryCache()) print(graph.invoke({"x": 5}, stream_mode='updates')) # [{'expensive_node': {'result': 10}}] print(graph.invoke({"x": 5}, stream_mode='updates')) # [{'expensive_node': {'result': 10}, '__metadata__': {'cached': True}}] ```
yindo added the langgraphexternal labels 2026-02-17 17:19:27 -05:00
yindo changed title from [langgraph]: Missing of Code Explaination to [GH-ISSUE #1788] [langgraph]: Missing of Code Explaination 2026-06-05 17:25:47 -04:00
yindo closed this issue 2026-06-05 17:25:47 -04:00
Author
Owner

@uditstocks commented on GitHub (May 1, 2026):

I'd like to work on this! I'll add explanations for set_entry_point() and set_finish_point() methods.
Will submit a PR shortly.

<!-- gh-comment-id:4359123461 --> @uditstocks commented on GitHub (May 1, 2026): I'd like to work on this! I'll add explanations for set_entry_point() and set_finish_point() methods. **Will submit a PR shortly**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#232