Skip to content

^ run - Add 'allow_run_on_task_fail' option to control run behavior on task failure - #67

Merged
jeremychone merged 1 commit into
aipack-ai:mainfrom
pratraut:allow_run_on_task_fail
Feb 23, 2026
Merged

jeremychone merged 1 commit into
aipack-ai:mainfrom
pratraut:allow_run_on_task_fail

Conversation

@pratraut

Copy link
Copy Markdown
Contributor

Problem

When executing multiple tasks via the agent, a failure in any single task causes the entire run to stop immediately. This results in remaining tasks being skipped.

In some workflows, it is desirable to continue executing subsequent tasks even if one fails.

Solution

Added a new boolean flag - allow_run_on_task_fail.

This flag can be set:

  • In the Options phase
  • Or when running the agent via: aip.agent.run(agent_name, options)

Behavior

Default Behavior (allow_run_on_task_fail = false)

  • Agent stops execution immediately when a task fails.
  • Remaining tasks are skipped.
  • Behavior remains unchanged (backward compatible).

New Behavior (allow_run_on_task_fail = true)

  • Agent continues executing remaining tasks even if a task fails.

Test

# Before All

```lua
return aip.flow.before_all_response({
  inputs = {
    { id = 1, value = "hello" },
    { id = 2, value = "world" },
    { id = 3, value = nil },   -- this will cause an error in # Data below
    { id = 4, value = "foo"  },
    { id = 5, value = "bar"  },
  },
  options = {
    allow_run_on_task_fail = true,
    input_concurrency = 1
  }
})
```

# Data

```lua
if input.value == nil then
    error("Task " .. tostring(input.id) .. " has nil value — simulated failure")
end

return { msg = "Processing: " .. input.value }
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants