breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
195 stars 26 forks source link

Implement a node that can inspects the outer graph #1017

Open dglazkov opened 8 months ago

dglazkov commented 8 months ago

Learning from experience of building the Graph Inspector API, I am realizing that there's some powerful use cases that we can unlock if we have a node that allows us to inspect what's wired into (or out of) a subgraph that contains this node.

Sample use case: a Router worker. Imagine a new worker that is part of the Agent Kit, which can examine what's wired out of it. This would allow the user of the Router to connect it to multiple destination workers (Writer, Critic, Librarian, etc.) and let the Router decide which destination to choose based on the task given.

I would like to figure out a Core Kit node that enables implementing such a worker.

It seems such a node would need to have a capability to look outside of its own graph, to the enclosed graph, and return back the input/output schemas representing the wiring.

dglazkov commented 8 months ago

I wonder if a more general approach is a node that reflects back the NodeContext. Maybe it's just the reflect node with a power-up?