Use case · Save-the-sale
Checkout rescue with multi-agent handoff
A stalled checkout triggers an exit-intent rescue agent with a different persona, empowered to offer a small discount and instructed to keep the conversation short. The user sees one chat.
combineTriggersonExitIntenthandoffmulti-agent
Try it live → Run the multi-agent rescue demo with your own API key.
The shape
Your checkout flow loses users at the price-confirmation step. You want to catch them on exit-intent with a different agent — empathetic, briefer, empowered to offer a small concession.
Linda’s multi-agent + triggers stack does this in one config.
Code
import { Linda, onExitIntent, combineTriggers } from "@linda/core";
const linda = new Linda({
transport: { mode: "proxy", url: "/api/linda" },
config: {
agents: [
{
name: "checkout",
persona: "Helpful, brief checkout assistant. Walk the user through.",
target: { type: "form", selector: "#checkout" },
skills: ["payment-intake", "address-verify"],
},
{
name: "rescue",
persona: "Empathetic save-the-sale specialist. Brief. Offers up to 10% off if it'll close the deal. Never pushy.",
triggers: combineTriggers(
onExitIntent(),
{ type: "hesitation", waitMs: 15000 }
),
tools: { coupon: { description: "Issue a discount up to 10%", maxValue: 10 } },
},
],
},
});
linda.attach();
The user experience
- User starts the checkout. The
checkoutagent walks them through. - User pauses at the total. 15 seconds of inactivity — or they move the mouse toward the close-tab button.
- The
rescueagent picks up the chat. Different persona, different tools. - The handoff is invisible — the user sees one continuous chat.
What makes this work
- Shared VFS. The rescue agent reads
/conversation/messages.jsonlto see what was already said. No re-asking. - Capability-isolated tools. Only the rescue agent has the
coupontool. The checkout agent can’t accidentally offer discounts. - Behavioral triggers.
onExitIntentandhesitationare 10 lines each. Write your own.
Anti-patterns to avoid
- Don’t make the rescue agent persistent. Fire once per session, then back off.
- Don’t have the rescue agent re-explain. It has the conversation log.
- Don’t tie the coupon to LLM judgment alone. Use a hook to validate eligibility.
Runnable example: https://github.com/neul-labs/linda/tree/main/examples/checkout-rescue
FAQ
What if the user closes the chat?
The trigger only fires once per session. After that, Linda backs off. You can override via the persistence layer.
Can the rescue agent issue a coupon?
Yes — it can call your /host/coupons MCP server, or a custom tool you wire via beforeToolCall hook.
Ship an agent-driven flow this afternoon.
Install Linda, paste a config, and your form turns into an agent that fills its own inputs.