Introduction

The Vellum Workflows SDK is a framework for defining and executing complex AI systems as graphs.

This SDK is currently in Beta and is subject to change. If you’d like to participate in our beta program, you can join our waitlist.

The Vellum Workflows SDK provides a declarative Python syntax for both defining and executing the control flow of graphs. Unlike other graph execution frameworks, which are functional or event-driven in nature, Vellum’s Workflows SDK defines the control flow of a graph statically and makes use of strict typing. This means that the structure of the graph is known ahead of time, and you get all the benefits of type safety and intellisense. This ultimately makes it easier to build more predictable and robust AI systems.

Unique amongst other frameworks, Vellum’s Workflows SDK also allows you to visualize, edit, and execute your graph in a UI, pushing and pulling changes from code to UI and vice versa.

Open Source

The Vellum Workflows SDK is open source and publicly available on GitHub. See source code here.

Core Features

  • Nodes: Nodes are the basic building blocks of a graph. They represent a single task or function.
  • Graph Syntax: An intuitive, declarative syntax for defining the control flow of a graph.
  • Inputs and Outputs: Both the Workflow itself and individual Nodes can take in inputs and produce outputs, which can be used to pass information between Nodes or Workflows.
  • State: Nodes can read and write to the graph’s global state, which can be used to share information between Nodes without defining explicit inputs and outputs.
  • Advanced Control Flow: Support for looping, conditionals, paralellism, state forking, and more.
  • Streaming: Nodes can stream output values back to the runner, allowing for long-running tasks like chat completions to return partial results.
  • Human-in-the-loop: Nodes can wait for External Inputs, allowing for a pause in the Workflow until a human or external system provides input.
  • UI Integration: Push and pull changes from code to Vellum’s UI and vice versa, allowing for rapid testing and iteration.

Quickstart

  1. Install the Vellum Workflows SDK:

    $pip install vellum-ai
  2. Import the Vellum Workflows SDK and define your first Workflow:

    1# my_workflow.py
    2
    3from vellum.workflows import BaseWorkflow
    4from vellum.workflows.nodes import BaseNode
    5
    6
    7class MyNode(BaseNode):
    8
    9 class Outputs(BaseNode.Outputs):
    10 result: str
    11
    12 def run(self):
    13 return self.Outputs(result="Hello, World!")
    14
    15
    16class MyWorkflow(BaseWorkflow):
    17 graph = MyNode
    18
    19 class Outputs(BaseWorkflow.Outputs):
    20 result = MyNode.Outputs.result
    21
    22
    23if __name__ == "__main__":
    24 workflow = MyWorkflow()
    25 result = workflow.run()
    26
    27 print(result.outputs.result)
  3. Run it!

    $python my_workflow.py

Next Steps

Note: To use most out-of-box Nodes, and to push/pull to/from the Velłum UI, you’ll need a Vellum account and API key. Talk to us or visit our pricing page for more information.