AnyBio

Govern for n8n

Put AnyBio Govern between a workflow's AI step and the patient. The n8n-nodes-anybio community package adds an AnyBio Govern node with three outputs, Deliver, Show Hold Text and Send Nothing, and a trigger for Govern webhooks. Install on self-hosted n8n, watch the gate route three drafts, then wire it into your own workflow.

n8n-nodes-anybio is the AnyBio community package for n8n. The AnyBio Govern node evaluates a draft under your Govern policy and routes it to one of three outputs, so a workflow branches without code. The record is written when the call returns. The AnyBio Govern Trigger node starts a workflow on a signed Govern webhook: a hold released or rejected, a hand-off opened, claimed, resolved or resumed.

The video, three and a half minutes, runs on a sandbox application with synthetic data. Three drafts go through one Govern node: an ordinary check-in is delivered and its outcome reported; a draft that changes a dose is held as never sendable and the patient gets the hold text; a message answering a patient who reports chest pain is delivered and opens a hand-off to a person on the record. Then the same node runs as a tool for an AI Agent, which asks the gate before it answers.

Install on self-hosted n8n

The package has no runtime dependencies. It needs a self-hosted n8n with community packages enabled.

From the editor. Settings, Community Nodes, Install, then enter n8n-nodes-anybio.

By hand (queue mode, or an instance without the editor install):

mkdir -p ~/.n8n/nodes && cd ~/.n8n/nodes
npm install n8n-nodes-anybio --omit=dev --omit=peer
# restart n8n

In the official Docker image ~/.n8n is /home/node/.n8n. --omit=peer matters: n8n-workflow is provided by n8n itself, and installing it again pulls native build steps the image does not have.

If your browser reaches n8n by IP address rather than a hostname, start n8n with WEBHOOK_URL and N8N_HOST set to that address. Otherwise the Chat Trigger and every webhook are built against localhost and fail from any other machine.

Credentials

One credential type, AnyBio Govern API, used by both nodes. Create it from inside the node, or from Overview, Credentials.

FieldWhat it is
EnvironmentSandbox (synthetic data only) or Production. A key is bound to one application and one environment; this labels every item the nodes emit.
Application KeyThe application key from the AnyBio console (gk_...). Sent only as Authorization: Bearer.
Application IDOptional. The application's UUID; when set it is sent as application_id, and the API refuses a key that is not bound to it.
Base URLDefault https://api.anybio.io. Sandbox and production keys use the same host.
Webhook Signing SecretFor AnyBio Govern Trigger only: the application's whsec_... secret, shown once when the application is created or the secret is rotated.

The application, its key and its signing secret come from the console: Govern, Applications, New application. The key and the secret are shown once, on the create page. Test on the credential reads the application's webhook delivery log and writes nothing: testing never creates a decision.

The demo workflow

Download govern-three-drafts-one-gate.json, create a new workflow, click the canvas and paste the file's contents. It is the first workflow in the video.

Conversation sets a conversation id, a patient reference, the hold message and the disclosure text.

Record Disclosure records the AI-identity disclosure for the conversation. Every patient-audience turn needs one on record, or the gate holds it with disclosure_missing.

Three drafts produces the three synthetic items. Draft C carries the patient's inbound message, so the gate screens the patient's words as well as the draft.

AnyBio Govern evaluates each item under the application's policy and routes it: Deliver, Show Hold Text or Send Nothing.

On the Deliver branch, Report Delivered reports the outcome, so the record shows what the patient received. On the Show Hold Text branch, Get Decision fetches the full record: policy version, reasons, stop class, review state.

Execute it once and open the Govern node. Expect the check-in and the chest-pain acknowledgement on Deliver, the latter with routeToHuman true and a hand-off id, and the dose change on Show Hold Text with medication_instruction in reasons and stopClass never_sendable.

The node

Evaluate

InputNotes
Draft TextThe message your AI step produced. Never put in an error or a log by the node.
Conversation IDYour thread id, at most 187 characters.
ChannelSMS, Voice, Email (outbound) or Web Chat, App Message (in-session).
AudiencePatient or Clinician. SMS and Voice accept Patient only.
Patient ReferenceYour opaque id; the API stores only its SHA-256. Consent, opt-out, the cap and hand-offs key on it.
Hold MessageThe text Show Hold Text carries: your holding line, fixed text your clinical owner wrote in advance.
Turn ID (additional)The idempotency key. Default: derived from the workflow, execution, node and item, so a retry within an execution replays the stored decision. Map your own message id here to make a re-run replay too.
Inbound Message, Inbound Received At (additional)The patient's message this turn answers, for the red-flag screen. Requires Patient Reference.
Model, Model Version (additional)Recorded as sent and counted in the observe report.

Three outputs:

OutputWhentext
DeliverThe decision is allow, including observe and a channel that is off.The draft. A patient audience never receives rewritten text.
Show Hold TextA hold or block where the hold message is to be shown now: every clinician hold; every patient hold on an in-session channel; a patient hold on an outbound channel when a holding line is owed.The Hold Message. Never the draft.
Send NothingA hold or block on an outbound channel with no holding line owed.Empty. Connect nothing that messages the patient here.

Every item carries output, text, decisionId, decision, mode, status, reasons (codes, never text), stopClass, routeToHuman, handoffId, automationPaused, inboundFlags, wouldHave, disclosureRequired, conversationId, turnId, channel, audience and environment. routeToHuman is independent of the output: an allowed draft can go to Deliver with routeToHuman true, meaning send it and bring a person in.

Report Outcome, Record Disclosure, Get Decision

Report Outcome takes the decision id, whether the message was delivered, and the delivered text; the node hashes the text with SHA-256 and sends only the hash. One outcome per decision. Record Disclosure takes the conversation id, the channel and the text shown, verbatim; once per conversation. Get Decision returns the decision with its current review state and, after a release, the released content.

As a tool for an AI Agent

The node can be attached to an AI Agent as a tool, which is the second workflow in the video: the agent drafts a reply and asks the gate before it answers. As a tool it tells the agent the decision; it does not stand between the agent's reply and the patient. To gate what is actually sent, put AnyBio Govern inline, between the step that drafts and the step that sends, as the demo workflow does.

When AnyBio cannot be reached

The node follows the @anybio/govern SDK here. A turn that comes back without a decision carries gate_unavailable (an outage; heals on its own) or client_misconfigured (a refused key; yours to fix). On a channel last seen in observe or off, the draft goes to Deliver with failOpen true and no decision id. On a channel last seen in enforce, or never seen, the node fails closed: in session the hold message is shown, on an outbound channel nothing is sent.

Trigger

AnyBio Govern Trigger is a webhook trigger. Copy its production URL into the application's webhook URL in the console. Every delivery is verified before anything is parsed, with the credential's signing secret, and an unsigned, stale or mis-signed delivery is answered 401 and starts nothing. Events: hold released, hold rejected, hand-off opened, claimed, resolved, automation resumed.

Source and support

The package is on npm as n8n-nodes-anybio, MIT licensed, with the source at github.com/anybio/n8n-nodes-anybio. The gate's behaviour is documented under Concepts and The policy model; the TypeScript SDK is the Govern SDK page.

On this page