PocketFlow icon indicating copy to clipboard operation
PocketFlow copied to clipboard

Feature Requests

Open zachary62 opened this issue 11 months ago • 11 comments

Below is a list of feature requests I have received. Please feel free to leave comments if you have additional ones.

  • [ ] Support for other languages, like TypeScript, Node.js, JavaScript, Golang, Dart, ...
  • [ ] A friendly ELI5 tutorial

zachary62 avatar Jan 05 '25 06:01 zachary62

Are we going to try to keep the source code at a 100 lines? Because I would love for there to be -

  • Halt operation before nodes (for human in the loop use cases)
  • Tracking/telemetry for debugging during development or production.
  • Visualization of the entire graph for complex, multi-step workflows

beubax avatar Jan 06 '25 18:01 beubax

Are we going to try to keep the source code at a 100 lines? Because I would love for there to be -

  • Halt operation before nodes (for human in the loop use cases)
  • Tracking/telemetry for debugging during development or production.
  • Visualization of the entire graph for complex, multi-step workflows

Great questions!

The 100 lines are designed based on the open–closed principle, so we’d love to keep it minimal. But feel free to extend the classes based on your needs!

Another thing we are exploring is to keep the core part 100 lines, but allow "extras", e.g., for visualization and logging.

Halt operation before nodes (for human-in-the-loop use cases)

You can try input(), which waits synchronously for human input. (See class FindRelevantFile(Node)) You can also try async nodes that, for example, waits until a user sends a message to a queue.

Tracking/telemetry for debugging during development or production

Could you elaborate on the features you need? If it's for the prompts, one approach is to log the prompts and responses inside call_llm(). You can also include the call stack in your logs to know where each prompt is called. These approaches are orthogonal to the 100-line nested graph.

Visualization of the entire graph for complex, multi-step workflows

I will create an example code snippet to demonstrate how to visualize the steps as a helper function. Coming soon!!

zachary62 avatar Jan 06 '25 19:01 zachary62

Added example on how to visualize flow: https://the-pocket.github.io/PocketFlow/utility_function/viz.html

zachary62 avatar Jan 07 '25 02:01 zachary62

Added example on how to visualize flow: https://minillmflow.github.io/miniLLMFlow/viz.html

this doesnt go anywhere, but Im really interested in visualization. I was considering forking the repository, but would also be happy to contribute a pull request. Im a huge fan of node based programming because it helps encourage encapsulation and reusability. These are super useful when coding with cursor and Ive been building an application that uses this for backend development even without llm integration.

SquallLeonhart13 avatar Jan 18 '25 03:01 SquallLeonhart13

@SquallLeonhart13 Sorry, that link is outdated! Please check out: https://the-pocket.github.io/PocketFlow/utility_function/viz.html I’d really appreciate your contribution! Let me know what you have in mind!

zachary62 avatar Jan 18 '25 14:01 zachary62

Mermaid diagrams are good. There is something called Sugiyama layouts that I think would be better for visualizing flows. I made an internal tool when working at airbnb in react that took in dotgraph represenations to visualize logic flows.

they look like this https://medium.com/@fulit103/creating-a-dag-layout-view-with-d3-and-react-4a9dee3230a4

We were able to attach different functionality like having the nodes show up in Sourcegraph, visualize executions.

I would like to adopt the dotgraph format just because there is already an editor out there for it, but I may eventually write a converter for a custom layout.

Im a little busy right now, but Ill keep you updated with any progress I when I get a chance to make a pull request. I might expand the library you wrote for readability in the branch.

In my personal opinion, it might make sense to pull the core library into its own directory and then have this project pull it as a dependency. You have written something that useful for improving all python programming in the age of ai agents, not just for specifically making agents.

SquallLeonhart13 avatar Jan 18 '25 21:01 SquallLeonhart13

Sugiyama layouts sound interesting! Yeah, I’d appreciate that when you have more time. Making it an extra might be a good way to go. Thanks for the compliment!

zachary62 avatar Jan 19 '25 15:01 zachary62

Hi @zachary62

PocketFlow looks very promising, thanks for the great work.

It would be a very interesting feature to add a memory layer to the graph to make the agent stateful, similar to letta but very lightweight.

Update: Done and dusted

kohinoor98 avatar Mar 20 '25 22:03 kohinoor98

I am trying to port pocketflow to a npm package, will start with simple node and flow and example of simple chat

dheerapat avatar Mar 25 '25 18:03 dheerapat

I am trying to port pocketflow to a npm package, will start with simple node and flow and example of simple chat

@dheerapat Join the discord! https://discord.com/invite/hUHHE9Sa6T There has been an ongoing effort for a npm package by the community!

zachary62 avatar Mar 25 '25 19:03 zachary62

Not sure this is the right place to discuss roadmap, feel free to move this discussion to other places.

  • Toward production usage. Including features like serving and tracing (maybe through a decorator?)
  • Persistent storage example. Storing shared into mysql or redis?

redreamality avatar May 06 '25 15:05 redreamality