Steps
Workflows in AgentScope AI are structured sequences of actions that guide agents through complex tasks. Each workflow consists of multiple steps, where each step represents a discrete operation or decision. Steps can include tool invocations, data transformations, conditional logic, or external API calls.
Defining a Workflow Step
Each step within a workflow follows a structured schema that includes:
Step ID: A unique identifier for the step.
Action: The operation to be performed (e.g., tool execution, branching, or API call).
Input Parameters: Data required for executing the step.
Output Handling: How results are processed and passed to the next step.
Conditions (Optional): Logic that determines whether a step should be executed.
Example: Defining a Workflow Step
Below is an example of a workflow step that fetches user information from an API and processes it:
Workflow Execution Flow
A workflow consists of multiple steps executed sequentially or based on conditional logic. The execution flow typically follows this pattern:
Initialize Workflow: Set up the required context and input parameters.
Execute Steps: Perform actions as defined in each step.
Evaluate Conditions: Determine the next step based on execution results.
Handle Errors: Apply error-handling mechanisms for failed steps.
Finalize Workflow: Return processed results or trigger follow-up actions.
Example: Multi-Step Workflow
The following example demonstrates a simple workflow that verifies a user and retrieves their transaction history:
Error Handling in Workflow Steps
To ensure reliability, workflows can include error-handling mechanisms:
Retries: Automatically retry failed steps.
Fallback Steps: Define alternative actions if a step fails.
Logging & Alerts: Capture error details and notify relevant systems.
Example of a step with error handling:
Last updated