I’m building a multi-step guided agent (a self-reflection tool with 20 sequential User Input blocks) and I need a “Back” button so users can return to the previous question and amend their answer.
With the native interface, this works fine — I set On Cancel → Select Destination on the User Input block and it routes correctly.
The problem is with a custom interface. I’ve built one using the Interface Designer, and it looks great, but I can’t find a way to trigger that same On Cancel path from it. Inspecting src/bridge.ts, the only exports available are:
submit(values)
uploadFile(file)
requestFile(options?)
useTemplateVariables()
useIsRunning()
There’s no cancel() or equivalent, and submit() always advances to the next block — so a Back button in a custom interface behaves identically to Next.
My questions:
- Is there a supported way to trigger a block’s configured ‘On Cancel’ destination from within a custom interface? If so, what’s the correct call?
- If not, what’s the recommended pattern for back navigation in a multi-step agent that uses custom interfaces?
- Would you recommend the approach of submitting a navigation flag (e.g.
nav_action: 'back') and then using a conditional block after each input to route backwards? Or is there a cleaner method I’ve missed?
Being able to combine custom interfaces with backward navigation matters quite a bit for this project, so any guidance would be appreciated.
Hi @marcusjmcd,
Thanks for the post!
There isn’t a built-in way to trigger On Cancel from a Custom Interface right now.
A workaround that may work for you is to have a single User Input block render multiple interfaces, then use a Router block to trigger a downstream block (or group of blocks) based on a variable you update from within the interface. Here’s a sample agent you can copy and explore:
https://app.mindstudio.ai/agents/creative-writing-generator-57f073bd/remix
There’s a single User Input block, and I asked the interface designer to:
- Create a unique interface for each variable
- Each time it collects an input, also update {{variableUpdate}} with the name of what needs to be generated
- Create back and next buttons, and display the outputs
The Router block reads {{variableUpdate}} and routes to the matching Generate Text block, for example poem, which runs the prompt for that generation step.
Here’s the prompt I used for the interface designer:
You are in charge of designing the User Input interface.
What I’d like to see:
- When the user just starts the run, and all variables are empty, I’d like you to display a nice yet simple interface with pastel colors moving across the screen in gradient to collect the haikuTopic variable. Once collected, populate variable variableUpdate with newHaiku. That will trigger a router block (outside your control) to match the value and launch the Haiku generation. When the haiku variable is populated, display it to the user along with the value of haikuTopic
- After that, let the user proceed to the new screen and collect poemTopic. I’d like the interface to look like an illustration to an epic ancient book. Also, populate the variableUpdate with newPoem, and once the poem variable is populated, display it to the user along with the topic they entered
- Repeat the same steps for storyTopic and populate the variableUpdate with newStory
I’d like the user to have easy access to the previous tabs with haiku, poem, and story. Once the haiku is generated, the next interface with poem should have easy access to the haiku interface, so the user can go back, change the haiku topic value, and you’d save the new value to haikuTopic and update the variableUpdate with newHaiku. Same applies to others.
Here’s the agent structure for context:
Select all blocks in your canvas, copy them, and paste here so the interface designer has your setup
Let me know if you have any questions!
Thanks for this Alex! That sample agent you linked to was super helpful 