Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces (experimental) Flow 🚀. Flexible and extensible component for managing and executing workflows.
Flow class is created by providing a
schema
(zod) that defines the state, and an optional output schema that ensures the flow finishes and the result is in the desired shape. One can then addsteps
.AgentFlow class serves as a simplified interface for creating multi-agent flows.
Step has name and handler, which receives a current
state
and execution context, returns the updates to the state, and optionally a name of the next step it wants to jump to. The handler can be either a sync/async function or a different flow. One can also add a custom validation schema to ensure data consistency and type safety so you can be sure that when the flow enters the given step, it is in a particular state. Hops between steps are, by default, in the order they were added, but each step can define where it wants to jump. Also, the starting node can be changed.Simple Example
Agent Flows
The following example is a simple CLI application that retrieves data from the user and calls simple multi-agentic flow while preserving conversation history.
Other features
FlowError
)Ref: #254