feat: add web-search and extended-thinking capabilities to the campaign switch AI decider — a per-step web lookup about the contact's company (query derived from contact fields only, results fenced as untrusted, +1 credit charged only when results land, wired through a new tasks SetAISearch) and a thinking toggle that routes to the stronger model tier with a 2048-token budget priced through usage metering, with editor toggles under Capabilities and sequences/ai-credits docs

This commit is contained in:
Matthew Meszaros
2026-07-18 08:42:08 +02:00
parent 053ca6a71d
commit 163d3057de
9 changed files with 136 additions and 7 deletions
@@ -3157,8 +3157,26 @@ function SwitchStepFields({
/>
<p className="mt-1 text-[11px] text-slate-400">
One model call per contact reaching this step picks exactly one case. Supports the same{" "}
{"{{.FirstName}}"} / {"{{.Company}}"} variables as your email copy. Costs 1 credit per contact.
{"{{.FirstName}}"} / {"{{.Company}}"} variables as your email copy. Costs 1 credit per contact
plus usage on long calls.
</p>
<div className="mt-3">
<Label>Capabilities</Label>
<div className="space-y-1">
<AIContextToggle
label="Web search"
detail="Looks up the contact's company on the web before deciding. +1 credit when results are found"
on={!!action.ai_web_search}
onToggle={() => setAction((a) => ({ ...a, ai_web_search: !a.ai_web_search || undefined }))}
/>
<AIContextToggle
label="Extended thinking"
detail="Uses the stronger model with a bigger reasoning budget. Costs more through usage metering"
on={!!action.ai_thinking}
onToggle={() => setAction((a) => ({ ...a, ai_thinking: !a.ai_thinking || undefined }))}
/>
</div>
</div>
</div>
) : (
<div>
@@ -69,6 +69,11 @@ export interface SequenceAction {
switch_cases?: string[];
switch_value?: string;
ai_instruction?: string;
// AI-decider capabilities: web search runs one lookup about the contact's
// company before deciding (+1 credit when results are found); thinking
// routes to the stronger model tier (costs more through usage metering).
ai_web_search?: boolean;
ai_thinking?: boolean;
// Context opt-outs for the AI decider: by default the model also sees the
// contact's campaign history (steps run, opens/clicks/replies, prior
// outcomes) and their newest inbound email. Stored inverted so existing