dyui.integrations.langgraph
dyui.integrations.langgraph.stream()
Section titled “dyui.integrations.langgraph.stream()”async def stream( graph: Any, input: Any, config: Any = None, **kwargs: Any,) -> AsyncIterator[Any]Run graph and yield text deltas, Reasoning deltas and emitted components.
dyui.integrations.langgraph.emit()
Section titled “dyui.integrations.langgraph.emit()”def emit(item: Any, writer: Any = None, *, config: Any = None) -> NoneSend a component (or {"ui": ...} dict) to the chat from inside a node or tool.
On Python 3.11+ emit(item) finds the current LangGraph run by itself. On
Python 3.10 LangGraph can’t propagate its run context into nodes, so pass the run
explicitly; these forms work on every version::
from langchain_core.runnables import RunnableConfigfrom langgraph.prebuilt import ToolRuntime
async def search(state, config: RunnableConfig): # a graph node emit(ui.Table(...), config=config)
@tooldef forecast(city: str, runtime: ToolRuntime) -> str: # a tool emit(ui.Chart(...), writer=runtime)Parameters
| Name | Type | Description |
|---|---|---|
item |
Any |
A ui.* component instance or a {"ui": ...} dict. |
writer |
Any |
A LangGraph StreamWriter, or a Runtime / ToolRuntime (its stream_writer and config are used). |
config |
Any |
The node’s RunnableConfig; makes the writer usable on Python 3.10. |