Chain Workflow
Chain Workflow pattern decomposes a complicated task into a sequence of steps. Each step takes the output of the previous step as its input, processes the input, then calls the next step with updated input.
Implementation
This pattern consists of a management task and a sequence of subtasks. All these tasks are implemented using Task Execution pattern.
The flow chart below shows the basic steps.
Example
An example of using chain workflow is improving the quality of content of an article. The content of an article can be improved in many ways. ChatGPT provides some suggestions about how to polish an article. We can apply one suggestion in each step to improve the content.
For demo purpose, an new article is generated using LLM first for the given topic. Then this article is passed to a chain of three agents for improvements. Each agent focuses on a particular area for improvement. The result of the last agent is returned as the final result.
Reference Implementation
See this page for reference implementation and examples.