Skip to content

dyui.integrations.langgraph

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.

def emit(item: Any, writer: Any = None, *, config: Any = None) -> None

Send 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 RunnableConfig
from langgraph.prebuilt import ToolRuntime
async def search(state, config: RunnableConfig): # a graph node
emit(ui.Table(...), config=config)
@tool
def 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.

DyUI Docs assistant

Answers come from the DyUI docs. gpt-oss-120b via Groq. Press Escape or the close button to return to the page.