Files
wehub-resource-sync a7d6d88f6f
CI / changes (push) Has been cancelled
CI / cd libs/checkpoint (push) Has been cancelled
CI / cd libs/checkpoint-conformance (push) Has been cancelled
CI / cd libs/checkpoint-postgres (push) Has been cancelled
CI / cd libs/checkpoint-sqlite (push) Has been cancelled
CI / cd libs/cli (push) Has been cancelled
CI / cd libs/prebuilt (push) Has been cancelled
CI / cd libs/sdk-py (push) Has been cancelled
CI / cd libs/langgraph (push) Has been cancelled
CI / Check SDK methods matching (push) Has been cancelled
CI / Check CLI schema hasn't changed #3.13 (push) Has been cancelled
CI / CLI integration test (push) Has been cancelled
CI / sdk-py integration test (push) Has been cancelled
CI / CI Success (push) Has been cancelled
baseline / benchmark (push) Has been cancelled
Deploy Redirects to GitHub Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:37:18 +08:00

49 lines
1.3 KiB
Python

"""Create a sequential no-op graph consisting of a few hundred nodes."""
from langgraph._internal._runnable import RunnableCallable
from langgraph.graph import MessagesState, StateGraph
def create_sequential(number_nodes: int) -> StateGraph:
"""Create a sequential no-op graph consisting of a few hundred nodes."""
builder = StateGraph(MessagesState)
def noop(state: MessagesState) -> None:
"""No-op function."""
pass
async def anoop(state: MessagesState) -> None:
"""No-op function."""
pass
prev_node = "__start__"
for i in range(number_nodes):
name = f"node_{i}"
builder.add_node(name, RunnableCallable(noop, anoop))
builder.add_edge(prev_node, name)
prev_node = name
builder.add_edge(prev_node, "__end__")
return builder
if __name__ == "__main__":
import asyncio
import time
import uvloop
graph = create_sequential(3000).compile()
input = {"messages": []} # Empty list of messages
config = {"recursion_limit": 20000000000}
async def run():
len([c async for c in graph.astream(input, config=config)])
uvloop.install()
start = time.time()
asyncio.run(run())
end = time.time()
print(f"Time taken: {end - start:.4f} seconds")