Skip to main content

Async Component

Use the Async component to run parts of your workflow in the background. It's essential for long-running tasks like processing large files or looping through thousands of records, preventing timeouts and keeping your main agent responsive.

Why this matters

Without Async, tasks that take longer than a few minutes can fail with a timeout error. Async offloads these heavy jobs to a separate process, ensuring your main workflow completes instantly while the background task runs to completion.

What You’ll Configure

Step 1: Define Inputs

Inputs for the Async component are the data you need to pass to the background workflow. Each input you define here becomes available as a variable within the async branch.

FieldRequired?DescriptionNotes
Input NameYesA unique name for your input.This name becomes an output variable to use in the async flow.
TypeYesData type (String, Number, Array, etc.).Ensures data is handled correctly in the background process.
Default ValueNoA fallback value if no input is provided.Useful for testing or making inputs optional.
OptionalNoMarks the input as not required for execution.The workflow will proceed even if this input is not supplied.
Parameterizing Your Job

Think of Async inputs as the parameters for your background job. If you're processing a list of users, you might have an input named userList of type Array.

Step 2: Understand Outputs

The Async component has a primary output in the main workflow and makes your inputs available within the async branch.

OutputDescriptionWhere It's Available
JobIDA unique reference ID for the asynchronous job that was just started.Main workflow (immediately)
(Your Inputs)Each input you defined in Step 1 is available as an output variable to be used in subsequent steps.Inside the async branch only
A Tale of Two Workflows

The JobID is returned instantly in your main workflow. It's like a receipt confirming the job was started. The actual results of the operation are only available inside the separate async branch or if you use the Await component to retrieve them later.

Step 3: How to Debug Async Workflows

Debugging is different

The Debug Mode toolbar cannot be used on the async branch because it executes as a completely separate process from the main workflow. You must use the Logs to trace its execution.

  1. Go to Agent Settings > Logs.
  2. Find the execution log for your main workflow that triggered the Async component.
  3. A separate log entry will exist for the async workflow. You can find it by looking for a new run that started at the same time.
  4. Review this separate log to see the step-by-step execution and identify any errors in your background task.

Step 4: When to Use the Await Component

Use the Await Component only when your main workflow must pause and wait for a result from the async job before it can continue.

Use CaseUse Async alone?Use Async + Await?
Fire-and-forget tasks (e.g., sending notifications)YesNo
Solving a timeout in a long loopYesNo
Needing results back in the same user sessionNoYes
TIP

If you just need to solve a timeout, Async alone is sufficient. Only add Await if the main workflow depends on the background job's output.

Best Practices

  • Develop Synchronously First: Build and debug the core logic in a standard workflow. Once it works correctly, wrap it in an Async component.
  • Implement Completion Notifications: Since the job runs in the background, have it notify you of its completion. The last step in your async branch could be a Send Email, Slack Message, or API Call to another system.
  • Use for Heavy Lifting: Reserve Async for truly long-running tasks: processing large datasets, complex For Each loops, or calling slow external APIs that would otherwise time out.
  • Store Results Persistently: It's often safer to have the async job save its output to a database, file storage, or a system of record rather than relying on Await.

Troubleshooting Tips

If your async job fails or doesn't run...
  • Check the Logs: This is the most critical step. Go to Agent Settings > Logs and find the log for the async execution to see the exact error message and the step that failed.
  • Verify Your Inputs: Double-check the data being passed into the Async component. An incorrect data type or a null value can cause the background job to fail immediately.
  • Test Logic Separately: Temporarily move the logic out of the Async component and run it synchronously using Debug Mode to confirm the logic itself is sound.
  • Check Permissions: Ensure the agent has the necessary permissions for all actions within the async branch (e.g., API credentials, database access).

What to Try Next

  • Combine Async with the Await Component to get results back in your main flow.
  • Use Async to wrap a For Each Loop that processes thousands of records from a database without timing out.
  • Store results from an async job in a permanent location using RAG Remember or by calling an external database.