When to use
Use an agent fallback as a failsafe when a one step action unexpectedly becomes a multi-step flow.How it works
act()
is attempted for the direct action- If it fails,
agent()
figures out the new path - Agent completes all needed steps (open menu → click button)
Example scenario
Before: Sign in button was in the headerAfter: Sign in now requires: Click account menu → Click “Sign in” option A single
act("click sign in")
can’t handle this change. The agent fallback can discover and execute both steps.