-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
https://langchain-ai.github.io/langgraph/agents/memory/#manage-message-history
pre_model_hook parameter is not available for create_swarm. When pre_model_hook is used with individual create_react_agent, the state message change doesn't reflect on swarm state. Kindly resolve this.
Currently as a workaround, have to modify swarm graph to begin with memory management node. Without modification, both nodes runs in parallel during graph start.
def route_to_active_agent(state: dict):
return state.get("active_agent", default_active_agent)
builder.add_conditional_edges(START, route_to_active_agent, path_map=route_to) **-->** _change START to memory management node_
return builder
def create_swarm(
agents: list[Pregel],
*,
default_active_agent: str,
state_schema: StateSchemaType = SwarmState,
config_schema: Type[Any] | None = None,
) -> StateGraph:
Metadata
Metadata
Assignees
Labels
No labels