Skip to content

How and where to pass, SubGraph streming as True ? #152

@shailesh-numaai

Description

@shailesh-numaai

I am using Supervisor complied graph in Python like this

workflow = create_supervisor(
    [agent_add, agent_subtract, agent_multiply],
    model=ChatOpenAI(model="gpt-4o", temperature=0.2),
    prompt=supervisor_prompt,
)

graph = workflow.compile()

this is exposed via langgraph.json to frontend

{
  "dependencies": ["."],
  "graphs": {
    "supervisor": "./agents/supervisor.py:graph"
  },
  "env": ".env"
}

But I am struggling on how to enable custom message streaming from Tools called vai subgraph / agents to main chat UI. I suspect I am not sending subgraph = true for streaming from subgraph but not sure where to configure this in my case?

Already tried passing it hear

const handleSubmitEdit = () => {
    setIsEditing(false);

    const newMessage: Message = { type: "human", content: value };
    thread.submit(
      { messages: [newMessage] },
      {
        checkpoint: parentCheckpoint,
        streamMode: ["values"],
        **// @ts-ignore
        subgraphs: true,**
        optimisticValues: (prev) => {
          const values = meta?.firstSeenState?.values;
          if (!values) return prev;

          return {
            ...values,
            messages: [...(values.messages ?? []), newMessage],
          };
        },
      },
    );
  };

but no luck, anyone knows?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions