UNPKG

@langgraph-js/sdk

Version:

The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces

22 lines (21 loc) 519 B
import { Command } from "@langchain/langgraph"; /** * 保留 langgraph-swarm 在 handoff 时丢失的 state */ export const keepAllStateInHandOff = (state) => { // omit activeAgent and messages const { activeAgent, messages, ...rest } = state; return { ...rest, }; }; export const createHandoffCommand = (name, state) => { return new Command({ goto: name, graph: Command.PARENT, update: { active_agent: name, ...state, }, }); };