Skip to main content
Workflows are deterministic, stateful, multi-agent pipelines that power many of our production use cases. They are incredibly powerful and offer the following benefits:
  • Control and Flexibility: You have full control over the multi-agent process, how the input is processed, which agents are used and in what order.
  • Built-in Memory: You can store state and cache results in a database at any time, meaning your agents can re-use results from previous steps.
  • Defined as a python class: You do not need to learn a new framework, its just python.
How to build a workflow:
  1. Define your workflow as a class by inheriting from the Workflow class
  2. Add one or more agents to the workflow
  3. Implement your logic in the run() method
  4. Cache results in the session_state as needed
  5. Run the workflow using the .run() method

Example: Blog Post Generator

Let’s create a blog post generator that can search the web, read the top links and write a blog post for us. We’ll cache intermediate results in the database to improve performance.

Create the Workflow

Create a file blog_post_generator.py
blog_post_generator.py

Run the workflow

Install libraries
Run the workflow
Now the results are cached in the database and can be re-used for future runs. Run the workflow again to view the cached results.