Normalizes whatever was handed in as a root into a RunnableRoot.
An agent and a workflow are both roots already and pass through as
themselves. Anything else node-like — a tool, a plain function, an
already-built node — becomes the single node of a one-node workflow, exactly
what edges: [['START', value]] spells by hand, so {agent: node} and
{agent: new Workflow({edges: [['START', node]]})} are the same request
spelled two ways.
The value is built before it reaches the graph parser, which would build it
anyway, because the built node is what carries the name and description the
wrapping workflow takes.
Normalizes whatever was handed in as a root into a RunnableRoot.
An agent and a workflow are both roots already and pass through as themselves. Anything else node-like — a tool, a plain function, an already-built node — becomes the single node of a one-node workflow, exactly what
edges: [['START', value]]spells by hand, so{agent: node}and{agent: new Workflow({edges: [['START', node]]})}are the same request spelled two ways.The value is built before it reaches the graph parser, which would build it anyway, because the built node is what carries the name and description the wrapping workflow takes.