Creating agentic workflows

An agentic workflow defines a set of linked activities and controls that are designed to achieve a specific business purpose or goal.

Agentic workflows do not run unless an LLM model is available. If models are not configured, an administrator must add the necessary models before you run the agentic workflows. For more information, see Choosing a foundation model and Managing custom LLMs using AI gateway.

About this task

When you create an agentic workflow, you start with a start node and an end node. The start node is the entry point of the agentic workflow. It defines the inputs that are required to begin execution, such as values provided by a user or external system. It also initializes agentic workflow variables that are used as the agentic workflow progresses. The end node is the exit point of the agentic workflow. It defines the output that is returned when the agentic workflow completes execution.

The order in which you create your agentic workflow is up to you. If you know the types of activities that you want to include in your sequence, you can start by adding those activities.

Agentic workflows that are run asynchronously and can be long-running. When you run an agentic workflow tool in a chat, you provide the agentic workflow inputs, but any agentic workflow outputs might not be immediately available. Use the Get flow status utility tool that is provided to check the tool's status at any time and to retrieve the tool's outputs.

Tip:

If you added an agentic workflow input and want to help ensure that the agent prompts for that input, mark the input as required. If you have nested input types, mark the input as required for the nested properties that you want the agent to prompt for. If an input or property has a default value, the agent might use the default value instead of prompting the user for a value.

Create an agentic workflow

An agentic workflow can be created for a specific agent, or added directly to the system.

To create an agentic workflow in the system:

  1. From the menu Menu, navigate to Build.

  2. Navigate to All tools.

    On IBM Cloud environment, select the workspace where you want to create the workflow from the workspace list.

    You can choose a global workspace or a private workspace, or create a new workspace depending upon your roles and workspace-level permissions. All workflows you create are associated and visible within the selected workspace only.

  3. Select an existing tool or click Create tool + to add a new tool.

  4. Select Agentic workflow.

  5. Enter a meaningful name for the workflow.

  6. Click Start building. The flow editor opens, from here you can start creating your agentic workflow.

To create an agentic workflow for an agent:

  1. From the menu Menu, navigate to Build.

  2. Navigate to All agents.

    On IBM Cloud environment, select the workspace associated with your agent in the workspace list.

  3. Find and click your agent.

  4. From the agent's toolset in the Toolset section, click Add tool.

  5. Click Agentic workflow.

  6. Enter a meaningful name for the workflow.

  7. Click Start building. The flow editor opens, from here you can start creating your agentic workflow.

Edit agentic workflow details

To edit agentic workflow details:

  1. From the menu Menu, navigate to Build.

  2. Navigate to All tools.

    On IBM Cloud environment, select the workspace associated with the workflow from the workspace list.

  3. Select the workflow, and click the Options icon option icon, and select Edit details.

  4. In the Overview tab, update the name and enter a description for the tool.

  5. Click the Parameters tab to configure inputs and outputs for the tool.

  6. Click Add inputs to define the input. For detailed instruction, see Adding inputs

  7. Click Add outputs to define the output. For the detailed instruction, see Adding outputs

  8. Click Done.

Example agentic workflows

You can download example agentic workflows from https://github.com/IBM/ibm-watsonx-orchestrate-adk/tree/main/examples/flow_builder. For information about how to import workflows into your watsonx Orchestrate environment, see Building agentic workflows in the ADK documentation.

Configure workflow settings

Workflow settings allow you to automatically map chat history to node inputs and customize how data is summarized for large conversations.

To configure workflow settings:

  1. In the workflow builder, click settings on the right side of the subheader.

  2. The Auto-map chat history to inputs option is set to ON by default, which automatically maps the last five conversation turns from chat history as node inputs.

  3. If you choose to customize the summarization instructions, then click Edit next to Custom summarization instructions.

    1. Enter the Summarization instruction. Specify guidance such as key details that must remain unchanged and content that can be safely omitted to reduce size.

    2. Click Save.

Add tools

You can add tools to an agentic workflow to extend an agent’s capabilities. For more information, see Adding tools.

Add agents

You can add agents to an agentic workflow to manage task‑specific actions within the flow. For more information, see Adding agents.

Configure agentic workflow controls

Agentic workflow controls define the execution path of an agentic workflow. By configuring agentic workflow controls, you can set conditions, branches, and loops that determine how data moves between nodes.

Add a branch control

A branch controls the path that is followed in an agentic workflow. The path is defined based on specified conditions. You can define multiple paths and path conditions for the branch. If none of the conditions are met, the agentic workflow follows the default path.

To add a branch to the agentic workflow:

  1. To create a branch, either:

    • Click the add icon icon. From the Flow nodes tab, click and drag the Branch control onto the canvas. You can drop the control directly on a connector line or anywhere on the canvas.

    • Click the connector line between start and end nodes. Select Add a flow control > Branch. A branch is automatically inserted onto the connector line.

  2. The branch is preconfigured with an if-else statement.

Add paths

To add a path to a branch:

  1. Click the branch.

  2. In the branch window, select Add path.

Add path conditions

To add a condition to a path:

  1. Click the branch.

  2. Find the path and select Edit condition. Choose one of the following options to define a condition:

    • To build a condition by using Condition builder:

      1. In the Condition builder Condition builder window, click plus icon and select a variable from the Available variables drop-down list.

      2. Click plus icon and select an Operator from the drop-down list.

      3. Click plus icon and Enter a Value.

      4. Press enter. To add more than one condition, select Add condition.

    • To build a condition by using Expression editor:

      1. Select Expression editor Expression editor.

      2. Click Enter expression and enter the Python expression.

  3. Click back.

Edit or delete a condition

To edit the conditions of a path:

  1. Click the branch.

  2. Find the path and select Edit condition. Choose one of the following options to edit a condition:

    • To edit a condition by using Condition builder:

      1. Update the variable, operator, and value.

      2. Click enter.

    • To edit a condition by using Expression editor:

      1. Select expression editor Expression editor.

      2. Click the expression to open the editor window and update the Python expression.

To delete the condition of a path:

  1. Click the branch.

  2. Find the path and select Edit condition.

  3. Click delete condition delete.

Edit paths

You can manage the paths in your branch by changing the order, renaming a path, or deleting a path.

To change the order of the paths:

  1. Click the branch.

  2. Click more actions More actions.

  3. Select Move up or Move down from the list to change the order.

You can also reorder the paths by clicking and dragging the move icon next to the path.

To edit a path:

  1. Click the branch.

  2. Click more actions More actions.

  3. Select Edit path name and enter the new name.

To delete a path:

  1. Click the branch.

  2. Click more actions More actions.

  3. Select Delete.

Add a For each control

A For each control runs a series of actions for every item in a list. The iterator variable represents the current item in the list, and the index variable indicates its position, starting from zero. You can use them to access and process each item in the list.

To create a For each control, either:

  • Click the add icon icon. From the Flow nodes tab, click and drag the For each control onto the canvas. You can drop the control directly on a connector line or anywhere on the canvas.

  • Click the connector line between start and end nodes. Select Add a flow control > For each. A For each control is automatically inserted onto the connector line.

You can download an example agentic workflow that is related to the For each control from https://github.com/IBM/ibm-watsonx-orchestrate-adk/tree/main/examples/flow_builder/recent_transactions. For more information, see Example agentic workflows.

Select list

To select a list for the For each control:

  1. Click the For each control.

  2. Use one of the following options to select a list:

    • By default, auto-map auto-map is enabled, which select a list object form the agentic workflow input.

However, you can change this default behavior and configure list object by choosing variable or expression options.

  • To configure list object by using a variable, Select Variable and choose a variable from the Available variables list.

  • To configure list object by using an expression, Select Expression and click Enter expression under Select a list field to open the editor window and update the Python expression.

Once the list object is selected, the iterator and index variables are automatically provided.

Add local variables

Local variables are used only within a For each control and are not accessible outside of it. Each iteration of the For each can store intermediate results specific to that iteration. These values are stored within them and cannot be shared between different iterations.

To add local variables to the For each control:

  1. Click the For each control.

  2. Click Edit details in the Local variables section.

  3. Select Add in the Local variables window.

  4. Choose the variable type from the drop-down list.

  5. Enter the Name and Description.

  6. Select the List of {object type} checkbox if you want to store a list of values in the variable.

  7. Click Add.

To add more than one local variables, click Add.

Edit or delete local variable

To edit a local variable:

  1. Click the For each control.

  2. Click Edit details in the Local variables section.

  3. Hover over the variable and select Edit.

  4. Update the name and description in the Update output window.

  5. Click Save.

To delete a local variable:

  1. Click the For each control.

  2. Click Edit details in the Local variables section.

  3. Hover over the variable and select Delete.

Configure activities

Activities define the actions that an agentic workflow can perform. You can configure different types of x on the task you want to accomplish.

User activities

You can use user activity to create chat-based interaction to collect input and display the result within an agentic workflow. For more information, see Adding user activities.

For an example video on how to add user activities, see Building an agentic workflow with user activities in watsonx Orchestrate in Videos.

Logic blocks

You can use logic block to add custom Python logic directly within an agentic workflow. For more information, see Adding logic blocks.

Generative prompts

You can use a generative prompt when you need help with tasks that involve natural language understanding. It works by using a large language model (LLM) to generate text or structured content. For generative prompts in agentic workflows, you can add new models through the AI Gateway. For more information, see Adding generative prompts.

For an example video on how to add generative prompts, see Building an agentic workflow with generative prompts in watsonx Orchestrate in Videos.

Document classifiers

You can add document classifiers to agentic workflows to automatically identify document types. For more information, see Adding document classifiers.

Document extractors

You can add document extractors to agentic workflows to extract fields or entities such as date, names, and others from documents. For more information, see Adding document extractors.

Text extractors

You can use a text extractor in an agentic workflow to extract text from a document. For more information, see Adding text extractors.

Flow inspector

Flow inspector provides a consolidated view of agentic workflow execution history, helping you review how a workflow ran from start to finish. You can examine execution sequences, analyze data exchanged between steps, and diagnose errors or unexpected behaviors. For detailed information about flow inspector features and capabilities, see Inspecting agentic workflows.

Inputs and outputs

Inputs are the external values that are passed into the agentic workflow at run time. They provide the initial information that is required for the agentic workflow to start its execution. Inputs can include user-provided values, system values, or data received from other process.

Outputs are the results that are produced when an agentic workflow finishes execution. They define the information that is returned from the agentic workflow, such as processed data or responses for upstream nodes. Outputs make the agentic workflow’s results available for reuse in other processes, tools, or workflows.

Adding inputs

To add agentic workflow inputs:

  1. Click start node.

  2. In the Inputs window, click Add.

  3. Select an input type from the list.

  4. Enter a Name and Description.

  5. Optional: Select the List of {data type} checkbox to store a list of values in the input.

  6. Optional: Turn on the Set default values toggle switch to set the input with a default value.

  7. Enter a value and click Done in the default value field.

  8. Click Add.

    • If you select the List of {data type} checkbox, you can add more than one default value in the List of default values field.

    • The List of {data type} checkbox is not available for file inputs, and the Set default value option is not available for file and object inputs.

    • For object data type, you can choose between Simple view and JSON view to view the object properties.

Adding outputs

To add agentic workflow outputs:

  1. Click the end node.

  2. In the Outputs window, click Add.

  3. Select the output type from the list.

  4. Optional: Select the List of {data type} checkbox to generate a list of values as output.

  5. Click Add.

    • The List of {data type} checkbox is not available for file inputs.

    • For object data type, you can choose between Simple view and JSON view to view the object properties.

Flow variables in an agentic workflow

Flow variables are used while an agentic workflow runs. You can select from available options or define custom variables. They allow data sharing between nodes, with intermediate values preserved and available across different steps. Flow variables are accessible throughout the entire agentic workflow and can be shared and updated between nodes.

Adding flow variables

To add flow variables:

  1. Click flow variables icon on the left side of the agentic workflow window.

  2. Click Add and select the variable type from the list.

  3. Enter a Name and Description.

  4. Optional: Select the List of {data type} checkbox to store a list of values in the variable.

  5. Optional: Turn on the Set default values toggle switch to set the variable with a default value.

  6. Enter a value and click Done in the default value field.

  7. Click Add.

    • If you select the List of {data type} checkbox, you can add more than one default value in the List of default values field.

    • The Set default value option is not available for file, object, and user variables.

    • For object data type, you can choose between Simple view and JSON view to view the object properties.

Input, output, and variable types

The following table lists the available inputs, outputs, and variables types in an agentic workflow:

Type

Description

Boolean

To define inputs, outputs or variables that require a true or false value

Date/time

To define a date, a time, or a combined date and time value. Date values use the mm/dd/yyyy format. Time values use the hh:mm format with an AM/PM selector. For time and date & time, you can also select a time zone from the list provided.

Decimal

To define numeric values that include decimal points

File

To define a file that can be passed into or out of a flow. It can be used for uploading or downloading files, document processing, or passing files into or out of a tool within the flow.

Integer

To define whole number values

Object

To define input, output, or variable object properties by using JSON schema

String

To define text-based inputs, outputs, or variables

User

To define variables that store user-related details

Tip:
  • The User data type is available only for flow variables and is not currently supported for flow inputs or flow outputs.

Prerequisites for using user data type in an agentic workflow

You can use the user data type to define variables that hold tenant user details. Before you can list tenant users in an agentic workflow, you must configure access to the IBM Cloud platform APIs.

As a tenant administrator, complete the following steps to configure the access:

  1. Create a service ID or user that represents your application or workflow. For more information, see the Managing service IDs.

  2. Generate an API key for the Service ID. For more information, see Managing service ID API keys.

  3. Assign the following roles to the Service ID or user:

    • Administrator role, scoped to the target wxO tenant as a resource

    • Viewer role for all IAM Account Management services

For more information on assigning roles, see Managing access to resources. After you assign these roles, register the API key of the Service ID or user as a connection with the predefined application ID WXO_PLATFORM_USER_API.

This prerequisite is only required for watsonx Orchestrate tenants that are hosted on IBM Cloud.

Setup connection

After you complete the prerequisites, follow these steps to configure the connection:

  1. Activate your tenant environment.

    orchestrate env activate

  2. Add the connection.

    orchestrate connections add -a WXO_PLATFORM_USER_API

  3. Configure the connection for the draft and live environments.

    orchestrate connections configure -a WXO_PLATFORM_USER_API --env draft -t -k <api_key> orchestrate connections configure -a WXO_PLATFORM_USER_API --env live -t -k <api_key>
  4. Set the API key credentials.

    orchestrate connections set-credentials -a WXO_PLATFORM_USER_API --env draft --api-key <api_key> orchestrate connections set-credentials -a WXO_PLATFORM_USER_API --env live --api-key <api_key>

After you complete the setup, your agentic workflow can securely access tenant user details by using the user data type.

Adding properties to an object data type

You can add properties to an object data type for inputs, outputs, and variables.

To add properties to an object data type:

  1. Select Object data type from the list.

  2. Enter a Name and Description.

  3. Optional: Select the List of objects checkbox to store a list of values in the object data type.

  4. Click plus next to the object name in the object tree or click Add + in the Object properties section.

  5. Select a property from the list.

  6. Enter a Name and Description.

  7. Optional: Select the List of {data type} checkbox to store a list of values in the object property.

  8. Optional: Turn on the Set default values toggle switch to set the properties with a default value.

  9. Enter a value and click Done in the default value field.

  10. You can choose between Simple view and JSON view to view the object properties.

  11. Click Save.

The Set default value option is not available for object variable.

Object data types

When you define an object, consider the following elements. An object includes a name, an optional description, and a set of properties defined by using a simplified subset of the JSON schema standard. For more information, see the JSON schema documentation.

Properties can themselves be objects with their own nested properties. They can also be lists, which are defined by using the JSON schema array type.

Here is an example that shows the properties of an Employee object that is defined by using JSON schema

{
    "id": {
        "type": "integer",
        "description": "Unique identifier for the employee"
    },
    "firstName": {
        "type": "string",
        "description": "Employee's first name"
    },

    "lastName": {
        "type": "string",
        "description": "Employee's last name"
    },
    "email": {
        "type": "string",
        "description": "Employee's email address"
    },
    "department": {
        "type": "string",
        "description": "Employee's department"
    },
    "salary": {
        "type": "number",
        "description": "Employee's salary"
    },
    "isActive": {
        "type": "boolean",
        "description": "Whether the employee is currently active"
    },
    "startDate": {
        "type": "string",
        "format": "date",
        "description": "Employee's start date"
    },
    "badges": {
        "type": "array",
        "items": {
            "type": "string"
        },
        "description": "Employee's badges"
    },
    "address": {
        "type": "object",
        "properties": {
            "street": {
                "type": "string"
            },
            "city": {
                "type": "string"
            },
            "zipCode": {
                "type": "string"
            }
        }
    }
}

The employee object schema includes the following properties:

  • id, email, salary, isActive, and startDate are simple properties that hold integer, string, decimal, boolean, and date values.

  • address is an object property with nested properties: street, city, and zipCode.

  • badges is a list, expressed as a JSON Schema array of string values.

You can download an example agentic workflow that is related to the Object data type from https://github.com/IBM/ibm-watsonx-orchestrate-adk/tree/main/examples/flow_builder/Employee_information. For more information, see Example agentic workflows.

Mapping data

Nodes within an agentic workflow might require data as input. This data can come from the inputs into the agentic workflow, from the outputs of upstream nodes, and from chat session context.

When an agentic workflow completes, it might also produce data as output. The data that is produced by the agentic workflow might come from the agentic workflow inputs or from nodes within the agentic workflow.

By default, when a node requires data as input, the agentic workflow engine attempts to identify potential data sources. If the agentic workflow engine locates a source, it automatically maps that data into the node. However, you can override this default behavior and provide a mapping on nodes or the agentic workflow output. To override the mapping behavior for the agentic workflow output, select the End node of the agentic workflow.

To edit data mapping in an agentic worklow, select the node and then click Edit data mapping.

The following data-mapping options are available:

  • Automapping: An agentic workflow automatically maps data between steps by connecting node inputs to other nodes' outputs or to the agentic workflow’s own inputs. If a required piece of data isn’t produced by any node within the agentic workflow, you can define an agentic workflow-level input with the same name and type. The agentic workflow engine then maps it automatically, which can ensure seamless data transfer throughout the agentic workflow.

Using the chat session context in automapping

Previously, agentic workflows did not automatically have access to the information entered into the chat prior to the workflow being triggered. To make the information available to the workflow, you had to define flow inputs and instruct the agent to populate them from the chat context. That process is no longer necessary and workflows can now easily be granted access to the most recent information in the chat context.

Enabling the chat session context includes the last 5 conversation turns from a chat history. A conversation turn refers to a single exchange between a user and the agent in a chat.

Agentic workflows support this feature by default. If you want to turn it off, or want to check whether it is enabled for your specific workflow:

  1. Open the agentic workflow.

  2. Click the Settings icon settings icon.

  3. Use the Auto-map chat history to inputs switch to turn the feature on or off.

If automapping is unsuccessful, you can prompt the user to provide the required input in a chat. To enable this behavior, set the Ask user for input if auto-mapping is unsuccessful switch to on when automapping data.

Automap

  • Blank parameters: To set a parameter to blank, close the Auto-map option for the node parameter. If input parameters for a node in an agentic workflow are left empty or blank, then no value is passed to the input parameter throughout the agentic workflow.

Blank parameter

  • Python expressions: You can add Python expressions for node parameters in an agentic workflow.

Expression

  • Variables: You can add variables for node parameters in an agentic workflow.

Variables

  • Literal values: You can add a specific literal value for agentic workflow runtime, such as a number or a date, to node parameters in an agentic workflow. To add a literal value, close the Auto-map option for the node parameter. The option to set a default value is not available for parameters that are mapped to literal values.

Literal value

  • Default values: You can add a specific default value to node parameters in an agentic workflow. The option to set a default value is not available for parameters that are mapped to literal values.

Default value

Date/time format for code blocks and expressions

When you define date and time values in code blocks or data map expressions, use the ISO 8601 standard format with IANA timezone support:

ISO 8601 format: YYYY-MM-DDThh:mm:ss±hh:mm[timezone/location]

Example: 2026-02-19T07:15:00+05:00[Europe/London]

Format breakdown:

  • Date: YYYY (Year), MM (Month), DD (Day)

  • Time: hh (Hour), mm (Minutes), ss (Seconds)

  • Separator: A 'T' divides the date and time components

  • Time Zone: 'Z' (UTC) or a ±hh:mm offset

  • Timezone location: IANA timezone identifier in square brackets (for example, [Europe/London])

The timezone location is recommended but can be omitted. This format ensures logical sorting, eliminates ambiguity, and provides international recognition.

What to do next

Your agentic workflow is now created. You can use the Chat preview to test your agentic workflow.

A user activity consists of one or more chat-based interactions to collect input and display results within an agentic workflow.

A logic blocks adds custom logic as Python logic within your agentic workflow.

A generative prompt uses the capabilities of large language models (LLMs) for tasks.

A document classifier automatically identifies document types.

A document extractor gets fields and entities from documents.

A text extractor obtains text from a document.