watsonx Orchestrate is a low code tool to build AI agents for business. It comes with a new component, called ‘Tool Builder’ to create flows via a graphical user interface or for developers via Python. This post introduces the new powerful capability.
To run the examples below, install the IBM watsonx Orchestrate Agent Development Kit (ADK). You can point the ADK against watsonx Orchestrate on AWS or IBM Cloud or run the watsonx Orchestrate Developer Edition locally via containers.
Flows
The new flow tools are available as public preview.
Flows is an agentic workflow tool that enables you to sequence nodes to build dynamic, intelligent workflows. Each node can represent an agent, a tool, or built-in capabilities such as user interactions, prompts, decision logic, or document extraction.
As I blogged about earlier, there are different types of agentic systems with pros and cons. While fully autonomous agents are getting a lot of attention these days, in many scenarios you need more structure. For example, you simply might want to call a tool B after the tool A before the LLM generates a response. While you can try to implement this via instructions for the agent, it is not as reliable, not necessary and rather over-engineered.
The flows in watsonx Orchestrate address this challenge by adding the ability to have workflows for certain parts, but letting agents orchestrate other parts autonomously.
Flows have nodes, edges and data mappings. The documentation talks about different node types to integrate different re-usable components, custom code and required ‘human in the loop’ activities:
- Tools
- Agents
- Users
- Python code
- Generative AI prompts
Example
The screenshot at the top of this post shows a simple flow where two tools are invoked after each other. Some of the capabilities are only available via code (see below) yet, for example chaining of agents. Other features are planned to be added.
A flow can contain custom logic, tools and agents, but from the perspective of an agent it is just another tool. Similarly to other tools, flows provide a schema for input and output parameters.
Asynchronous Execution
Once deployed, you can invoke queries like ‘get me a hello message for John Doe’. This will invoke the first tool to combine the first and last name and invoke the second tool to return a greeting.
Since flows take usually longer, they are invoked asynchronously. Currently the parent agents don’t have a mechnism how to receive the responses. Instead, users need to pull updates, for example via ‘what is the current status?’ which triggers a tool that is provided out of the box.
Code
In addition to the Tool Builder user interface developers can write code to implement flows. There are a number of examples.
This is the code from the example above. Input and output schemas are defined and a function which is annotated contains the flow definition.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''
Build a simple hello world flow that will combine the result of two tools.
'''
from pydantic import BaseModel
from ibm_watsonx_orchestrate.experimental.flow_builder.flows import END, Flow, flow, START
from .get_hello_message import get_hello_message
from .combine_names import combine_names
class Name(BaseModel):
"""
This class represents a person's name.
Attributes:
first_name (str): The person's first name.
last_name (str): The person's last name.
"""
first_name: str
last_name: str
@flow(
name = "hello_message_flow",
input_schema=Name,
output_schema=str
)
def build_hello_message_flow(aflow: Flow = None) -> Flow:
"""
Creates a flow with two tools: get_hello_message and combine_names.
This flow will rely on the Flow engine to perform automatic data mapping at runtime.
Args:
flow (Flow, optional): The flow to be built. Defaults to None.
Returns:
Flow: The created flow.
"""
combine_names_node = aflow.tool(combine_names)
get_hello_message_node = aflow.tool(get_hello_message)
aflow.edge(START, combine_names_node).edge(combine_names_node, get_hello_message_node).edge(get_hello_message_node, END)
return aflow
The flows are compiled into JSON to be executed by the flows engine.
Expressions
As displayed in the screenshot at the top, there are plans to have different components to define flows. The branch component is already available. To build a typical if/then flow, an expression language is provided. Nice.
Next Steps
To learn more, check out the watsonx Orchestrate documentation and the watsonx Orchestrate Agent Development Kit landing page.