Skip to main content

CallHQ Agents — how this works

In the app: /claygents

How it works

THREE kinds of saved config, all validated fail-closed before a row is ever written. Research columns: a plain-English brief fires the claygent-build intent to n8n, which asks Anthropic to propose a {key, label, instruction, category} spec and calls back; the callback route validates TWICE (zod for wire shape, then validateGeneratedColumnSpec() for domain rules — key format, collisions, banned patterns) before a ResearchColumnDef row is written. The 4 template presets (Prospecting/Account Scoring/Contact Scoring/Copywriting) skip the AI round trip but go through the SAME validator. A saved column fires through the unmodified fireResearchColumn() engine — researchColumn.ts's only change is a fallback lookup for a DB-defined column. Email agent: a saved persona/ICP/value-prop brief (validateEmailAgentConfig, its own AgentPreset row, kind="email") drives fireSequenceGenerateIntent() against an EXISTING campaign (drafts a Sequence, never sends) and applyReplyDraftPreset() drives the existing classifyAndDraftReply() (drafts Reply.claudeDraft only). Social agent: a saved brand/track/voice/platforms brief (validateSocialAgentConfig, kind="social") folds voice into a big-rock angle for the unmodified createContentFromBigRock(), then fires the existing fireSocialPostIntent() once per named platform — the SAME CONTENT-00 disclosure gate and CONTENT-05 tier pipeline every other scheduled post goes through. No kind ever sends/posts directly; every output lands in an existing human-release draft state.

Data source

src/lib/enrichment/claygent/* (claygentBuild.ts, validator.ts, agentValidator.ts, shared.ts, presets.ts, researchColumnDefRepo.ts, agentPresetRepo.ts, emailAgent.ts, socialAgent.ts) + researchColumn.ts's fallback lookup.

Troubleshooting

A built column never appears? A validation failure returns ok:false with reasons and writes nothing, silently from the UI's perspective. "Run on lead"/"Draft sequence"/"Apply to reply"/"Atomize + schedule" do nothing? Every run action no-ops (never throws) for an unknown lead/campaign/reply/preset key — check the id you typed matches an existing row exactly.

Vendors: anthropic-console — check Tools for live/mocked status.

Who can see this: admin