Skip to content

FRAMEWORKS

LangGraph

Resolve before a node and preserve graph/run correlation afterward.

Last updated

Lifecycle hooks

The adapter does not replace graph orchestration. Store the returned context in run state and pass it unchanged to afterNode.

const hooks = createLangGraphHooks(vira, {
  context: { kind:"agent", host:{ name:"langgraph", runtime:"node" }, modelTarget:{ provider:"openai", model:"your-model-id" } },
});
const context = await hooks.beforeNode(resolveRequest);
const output = await graph.invoke(input);
await hooks.afterNode(context, output);