惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
The Register - Security
The Register - Security
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
博客园 - 司徒正美
罗磊的独立博客
U
Unit 42
S
SegmentFault 最新的问题
Y
Y Combinator Blog
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
Schneier on Security
Schneier on Security
Know Your Adversary
Know Your Adversary
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
V
Vulnerabilities – Threatpost
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
The Hacker News
The Hacker News
博客园 - 叶小钗
C
Cybersecurity and Infrastructure Security Agency CISA
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
S
Securelist
A
Arctic Wolf
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Threatpost
Scott Helme
Scott Helme
博客园 - 聂微东
博客园 - 【当耐特】
T
Tenable Blog
I
Intezer
D
DataBreaches.Net
B
Blog RSS Feed
Security Latest
Security Latest
C
Cisco Blogs
T
Tor Project blog
N
Netflix TechBlog - Medium

AI Squared

How to Assess Metagenomic Risk with AI in Space Missions - AISquared What Is Predictive AI? Definition, Examples & Use Cases [2026] AI Feedback Loops: How to Improve Model Accuracy [2026] Why Enterprise AI Adoption Still Stalls in 2026 Build Fully Governed, Production Ready AI Workflows in Natural Language  - AISquared AI in Regulated Industries: Compliance, Use Cases & Implementation Your Increasing AI Token Spend is an Architecture Problem - AISquared How to Measure AI ROI: Metrics, Framework & Calculator [2026] 6 Best AI Orchestration Tools: Features, Pricing & Comparison [2026] How to Measure AI Readiness: Assessment Framework & Checklist 10 Best AI Platforms for Enterprises: Features, Pricing & Comparison [2026] Reducing Manual Tasks in Supply Chain with Agentic AI AI in Supply Chain Management: Use Cases, Benefits & Tools [2026] What is the Last Mile of AI? Why Deployment Success Matters 7 Best AI-Powered CRM Tools: Features, Pricing & Comparison [2026] AISquared Partners with John Snow Labs to Bring Domain-Specific AI into Enterprise Workflows - AISquared Introducing the Bolt Model Family - AISquared Introducing: AISquared's Student Builder Program - AISquared AISquared Launches Bolt to Eliminate Token Burden on Enterprise AI - AISquared Launching Agent-to-Agent Communication with the A2A Protocol - AISquared Title: How to Reduce Manual Tasks with AI in 2026 AI Application Architecture: Components & Best Practices [2026] Data Readiness for AI: Framework, Checklist & Best Practices AI Assistants for Employees: How to Design, Deploy & Measure ROI What Is No-Code Workflow Automation? [Complete Guide 2026] AI for Finance Teams How to Build a Smart AI Assistant That Switches Models Based on Context - AI Squared How to Design AI-Powered Workflows: A Complete Guide [2026] Enterprise AI Integration: Strategy, Architecture & Implementation Guide [2026] The Fragmentation Tax: The Hidden Cost of Assembling Your AI Stack - AISquared What Is a Feedback Loop? What Is Structured Data? Definition, Examples & Benefits Generative AI vs Predictive AI: Key Differences & Use Cases What Is No-Code Workflow Automation? [Complete Guide 2026] What is AI Orchestration?: A Complete Guide
How to Build a Fully Governed AI Agent with Data, Tools, and Human Oversight - AISquared
David Root · 2026-04-15 · via AI Squared

Most AI assistants fail when they move beyond simple questions. The moment real data, decisions, and actions are involved, control becomes critical.

Teams need more than just a model. They need systems that can filter sensitive input, route requests correctly, involve humans when needed, and decide when to retrieve data or take action.

This guide shows how to build a fully governed AI assistant using AISquared’s UNIFI platform. The workflow combines multiple layers: input guardrails, query normalization, conditional routing, human approval, knowledge base retrieval, and agent-driven tool usage.

The example focuses on drug-related queries, but the pattern applies to any domain where accuracy, safety, and control matter: healthcare, finance, legal, or operations.

Overview

This workflow builds a fully governed drug inquiry assistant. User input is screened for PII by the first Guardrails node, then lowercased and normalized by the Python Executor. A Conditional node checks whether the query is a comparison — if yes, it routes to Human-in-the-Loop for reviewer authorization; if no, it routes directly to the Knowledge Base for semantic retrieval. Both branches converge at the Prompt node, which aggregates the user’s question with either the HITL-approved comparison query or the Knowledge Base search results. The Agent receives this prompt alongside the Drug Graph MCP Server tools — it determines whether to call an MCP endpoint (primarily for comparisons) or synthesize an answer from the Knowledge Base context. The Agent’s response is screened by a final Guardrails node for content compliance before reaching the Chat Output.

Use case: A drug information assistant where all general queries (drug info, lists, similar drugs, illness lookups) are answered via Knowledge Base retrieval, while drug comparisons require human reviewer sign-off before the Agent calls the compare MCP endpoint. The Agent intelligently selects whether to use MCP tools or the retrieved KB context depending on what the question requires.

Routing Logic

The workflow has two branches, determined by a single Conditional check. Both branches converge at the Prompt node before the Agent.

ConditionPathRetrieval Source
Query contains ‘compare’HITL → Prompt → AgentAgent uses MCP tool (compare_two_drugs_mcp) after human authorization
All other drug queriesKnowledge Base → Prompt → AgentAgent uses Knowledge Base semantic search results; may also call MCP tools (drug info, list, similar) as needed

Tip: The Agent has access to both the Knowledge Base context (via the Prompt’s Search Results input) and the MCP tools at all times. For general queries, it primarily uses the KB results; for comparisons (post-HITL), it calls compare_two_drugs_mcp directly. The Agent determines the best approach autonomously based on the question and available context.

Workflow Diagram

The diagram below shows the full node graph as configured in the UNIFI AI Workflows canvas.

Node Reference

This workflow uses ten nodes across four categories. The Conditional node has two outputs only — compare queries go to HITL, everything else goes to the Knowledge Base. Both paths merge at the Prompt node before the Agent.

CategoryNode NameRole
Input / OutputChat InputEntry point — receives the user’s drug question
ExecutionGuardrails (Input)PII compliance screen — blocks queries containing personal data before any processing
ExecutionPython ExecutorLowercases input and normalizes drug name substrings (e.g. adds default dosage to bare ibuprofen mentions)
ExecutionConditionalSingle check: ‘compare’ in query → HITL; all other drug queries → Knowledge Base
ExecutionHuman in the LoopAuthorization gate for comparison queries only — Approve proceeds to Prompt; Reject returns a denial message
DataKnowledge BaseSemantic search on the Default (non-compare) path — Search Results feed into the Prompt node for all general drug queries
ModelPromptAggregates user question with either HITL-authorized compare query or Knowledge Base search results; passes rendered prompt to Agent
CoreDrug Graph MCP ServerMCP Tool node — exposes selected Drug Graph API endpoints to the Agent; Agent calls these autonomously based on the question
CoreAgentAutonomous LLM — receives rendered prompt + MCP tools; uses KB context for general queries, MCP tools for comparisons and structured lookups
ExecutionGuardrails (Output)Content compliance screen — blocks Agent responses containing hate speech, harassment, or policy violations before delivery
Input / OutputChat OutputReturns the approved Agent response to the user

Step 1 — Register Sources and Tools

Before building the canvas, register the AI/ML source and the MCP server Tool in UNIFI.

1.1  Add AI/ML Source

Sources → AI/ML Sources → Add AI/ML Source

Register the LLM that will power the Agent node. The example below uses Anthropic Claude, but any supported provider can be used.

FieldValue / Notes
ProviderAnthropic (or OpenAI, etc.)
API KeyObtain from console.anthropic.com → API Keys
HTTP Timeout30 seconds (default)
Request Format{“model”:”claude-haiku-4-5-20251001″,”max_tokens”:256,”messages”:[{“role”:”user”,”content”:”Hi.”}],”stream”:false}
Response Format{“id”:”msg_0123ABC”,”type”:”message”,”role”:”assistant”,”content”:[{“type”:”text”,”text”:”Hello!”}]}
Model InputsMap the messages content field as a dynamic input
Model OutputsMap content[0].text as the response text output

1.2  Register the MCP Server as a Tool

Tools → Add Tool → Custom MCP

MCP servers are registered under Tools, not Sources. This Tool is selected when adding the Tool node to the canvas.

FieldValue / ExampleNotes
Server URLhttps://kaiser-drug-graph-rag-backend.onrender.com/mcpFull URL of the MCP server endpoint
Transport Protocolstreamable_httpUse streamable_http for HTTP-based servers; other option: sse
Authentication Typenone (or bearer / basic / api_key)Set to none if the server is open; otherwise select the auth type that matches the server
Secret / Token(API key or bearer token if required)API key, bearer token, or password depending on auth_type
Header Name(if API key header auth)Custom header name, e.g. X-API-Key
Custom Headers(optional)Additional HTTP headers — add via + Add Item
Timeout (seconds)30Request timeout before the MCP call is cancelled

Tip: After saving the Tool, UNIFI introspects the MCP server and discovers its available API endpoints. You will select which specific endpoints to expose to the Agent when configuring the Tool node on the canvas in Step 2.7.

1.3  Set Up the Knowledge Base

The Knowledge Base used by the canvas workflow must be created and populated before building the canvas. It requires three sub-steps: creating the vector store table, syncing data into it, and creating the Knowledge Base configuration that wraps it.

Step A — Create the AISquared Vector Store Table

Sources → Add Data Source → AISquared Vector Store → Create Table

Navigate to Sources, add a new AISquared Vector Store data source, then click Create Table. Define the schema for your drug vector table — at minimum it must include an embedding (vector) column and a text or metadata column. The example below matches the standard document_vector_embeddings schema:

Column NameData TypeNotes
idint8Primary Key — auto-incrementing row identifier
texttextThe raw text content that was embedded — used by the Knowledge Base for retrieval context
embeddingvectorThe embedding vector — must be present for semantic similarity search to work
created_attimestampRecord creation timestamp — useful for incremental sync tracking

Additional metadata columns (e.g. drug_name, category, source) can be added using the + Add column button. Include any fields you want to filter or display alongside the retrieved text.

Tip: You can also click Define SQL Schema at the bottom of the Create Table dialog to paste a raw CREATE TABLE statement instead of filling in fields manually — useful when replicating an existing schema.

Step B — Sync Data into the Vector Store

Once the table is created, populate it by running a sync from your drug data source. Refer to the AISquared Vector Store Sync workflow documentation for full setup instructions — configure the sync to map your source fields to the table columns defined above, with the embedding column receiving the generated vector output.

Important: The embedding model used when syncing data into the vector store must match the embedding model configured in the Knowledge Base (Step C below). A mismatch will produce meaningless similarity scores and irrelevant retrieval results.

Step C — Create the Knowledge Base

Knowledge Bases → New Knowledge Base

With the vector store table populated, create the Knowledge Base configuration that the canvas workflow will use for semantic retrieval.

FieldValue / ExampleNotes
Embedding Provideropen_ai (or matching provider)Must match the provider used when data was synced into the vector store
Embedding Modeltext-embedding-3-smallMust match the exact model used at sync/ingest time
API Key(provider API key)Used to embed search queries at runtime
Chunk Size1000 (tokens or characters)Controls how source text is split before embedding — match the value used during the original sync
Chunk Overlap250Overlap between consecutive chunks — preserves context across chunk boundaries
Vector StorageSelect the AIS Vector Store table created in Step AThis connects the Knowledge Base to the populated drug embedding table

Tip: The Knowledge Base name you assign here is what you will select in the Knowledge Base node configuration on the AI Workflow canvas. Give it a clear, descriptive name (e.g. ‘Drug Knowledge Base’) so it is easy to identify when building the workflow.

Step 2 — Build the Canvas Workflow

In UNIFI: AI Workflows → New Workflow → open the canvas editor

2.1  Chat Input

  1. Add a Chat Input node as the workflow entry point
  2. Connect Chat Input → Message to Guardrails (Input) → input

2.2  Guardrails (Input) — PII Screen

  1. Connect Chat Input → Message to Guardrails (Input) → input
  2. Configure PII detection rules — block queries containing names, emails, phone numbers, or financial identifiers
  3. Connect Guardrails (Input) → Pass to Python Executor → input_msg
  4. Connect Guardrails (Input) → Fail to a Chat Output node with a PII rejection message

Important: Always wire the Guardrails Fail path. An unconnected Fail output results in a silent failure — the user receives no response and no indication that their query was blocked.

2.3  Python Executor — Lowercase and Normalize

Category: Execution — preprocesses the query before routing

The Python Executor lowercases the entire input and normalizes bare ibuprofen mentions to include a default dosage. This ensures consistent casing for the Conditional node’s string matching and adds clinical context for the Agent.

  1. Add a Python Executor node and open the Edit Code panel
  2. Define input_msg as an input in the Input & Output panel on the right side of the editor
  3. Paste the following code — all imports must be inside the run() function body:

def run(input_msg):    # import re    # import json    # import requests    input_msg = input_msg.lower()    if “ibuprofen” in input_msg and “200mg” not in input_msg:        return input_msg.replace(“ibuprofen”, “ibuprofen 200mg”)    return input_msg

  1. Use Test Code in the editor with sample inputs to verify the function before saving:
Sample InputExpected Output
“Tell me about Ibuprofen”“tell me about ibuprofen 200mg”  (lowercased + dosage added)
“compare ibuprofen and acetaminophen”“compare ibuprofen 200mg and acetaminophen”  (lowercased + dosage added)
“what is aspirin?”“what is aspirin?”  (lowercased, no other change)
“ibuprofen 200mg dosage”“ibuprofen 200mg dosage”  (already has 200mg — no duplicate)
  1. Connect Python Executor → Output Data to Conditional → input

Tip: Because the input is lowercased before the Conditional evaluates it, the Conditional’s string matching conditions should also be written in lowercase (e.g. ‘compare’ not ‘Compare’). The lowercase transform makes routing more reliable by eliminating case-sensitivity issues.

2.4  Conditional — Compare Check

The Conditional node performs a single check: does the query contain the word ‘compare’? If yes, the query requires human authorization before any drug data is retrieved. If no, the query proceeds directly to the Knowledge Base for semantic retrieval.

OutputConditionDestination
Condition 1Input contains ‘compare’Human in the Loop → Input Text
DefaultAll other drug queriesKnowledge Base → Search Query
  1. Configure Condition 1: operator contains, value compare
  2. Set Default Input to pass so the normalized query is forwarded unchanged on the Default path
  3. Connect Conditional → Condition 1 to Human in the Loop → Input Text
  4. Connect Conditional → Default to Knowledge Base → Search Query

Tip: The Conditional node is lowercased input so ‘compare’, ‘Compare’, and ‘COMPARE’ are all caught by a single contains condition. Consider also adding a condition for ‘comparison’, ‘versus’, or ‘vs’ using additional Condition outputs if you want to catch those phrasings too.

2.5  Human in the Loop — Comparison Authorization

Category: Execution — pauses the workflow for a reviewer to approve drug comparison queries

Drug comparison queries require explicit human authorization before the Agent is allowed to retrieve and surface comparative drug data. The reviewer sees the user’s preprocessed question and approves or rejects it. Approved queries skip the Knowledge Base entirely and go directly to the Prompt node — the Agent will use the compare MCP tool to fulfill the request.

  1. Connect Conditional → Condition 1 to Human in the Loop → Input Text
  2. Configure the reviewer assignment and timeout policy
  3. Connect Human in the Loop → Approve to Prompt → Input Message — approved comparison queries bypass the Knowledge Base and go directly to the Prompt + Agent
  4. Connect Human in the Loop → Reject to a Chat Output node with a denial message, e.g. ‘Your drug comparison request was not approved by a reviewer.’

Important: Always wire both Approve and Reject. The Human in the Loop node pauses asynchronously — the user receives no response until a reviewer acts. Set clear expectations in the welcome message that comparison requests require review.

2.6  Knowledge Base + Prompt Node

Category: Data (Knowledge Base) + Model (Prompt) — Knowledge Base handles all non-compare queries; Prompt aggregates results from either branch

The Knowledge Base is on the Default path — all queries that are not comparisons are routed here for semantic retrieval against the drug vector store. This covers general drug inquiries, illness lookups, drug detail queries, similar drug requests, and anything else that doesn’t require a comparison. The Prompt node then aggregates whichever input it receives — either KB search results (from the Default path) or the HITL-authorized comparison question (from the Approve path) — and renders a single prompt for the Agent.

  1. Connect Conditional → Default to Knowledge Base → Search Query
  2. Select the drug Knowledge Base from the node’s configuration dropdown — this is connected to the AIS Vector Store containing the drug data
  3. Connect Knowledge Base → Search Results to Prompt → Search Results
  4. Connect Knowledge Base → Search Query source (the normalized query) also to Prompt → Input Message so the original question is available to the LLM
  5. Connect Human in the Loop → Approve to Prompt → Input Message — approved comparison queries join at this point, bypassing the KB
  6. Write a prompt template that handles both paths:

You are a drug information assistant with access to a Drug Graph database.Use the retrieved context below and available MCP tools to answer the user’s question.
– For general drug queries: use the retrieved context from the knowledge base.- For drug comparisons (pre-authorized): use the compare_two_drugs_mcp tool.- For structured lookups: use get_drug_info_mcp, get_drug_list_mcp,  or get_similar_drug_list_mcp as appropriate.
Be concise and factual. Do not speculate beyond retrieved data or tool results.
User question: {{Input Message}}
Retrieved context from knowledge base (empty for comparison queries):{{Search Results}}

  1. Connect Prompt → Rendered Prompt Output to Agent → Input Message

Tip: The Agent has both KB context and MCP tools available on every call. For general queries arriving via the Default path, the KB search results will be populated and the Agent will primarily use them. For comparison queries arriving via HITL Approve, Search Results will be empty and the Agent will call compare_two_drugs_mcp. The prompt template guides this decision explicitly.

2.7  Tool Node — Drug Graph MCP Server

Category: Core — exposes MCP endpoints as tools for the Agent

The Tool node connects the Drug Graph MCP Server to the Agent. You configure which specific API endpoints the Agent has access to — restrict this to only the endpoints needed for the use case.

  1. Add a Tool node (Core category) to the canvas
  2. In the node configuration, click the MCP Server dropdown and select the Drug Graph MCP Server registered in Step 1.2
  3. Click Connect — UNIFI introspects the server and lists all available API endpoints
  4. Check the endpoints to expose — all four are relevant to this workflow:
EndpointEnable?When Agent Uses It
get_drug_list_mcpYesUser asks for a full list of drugs — Agent calls this regardless of KB results
get_similar_drug_list_mcpYesUser asks for drugs similar to a specific one
get_drug_info_mcpYesUser asks for detailed info on a named drug — Agent may supplement or replace KB results
compare_two_drugs_mcpYesDrug comparison — only reached after HITL authorization; KB Search Results will be empty on this path
  1. Connect Tool node → outputs to Agent → Tools

Tip: Even though compare_two_drugs_mcp is enabled in the Tool node, the workflow’s HITL gate ensures the Agent can only reach the Prompt and Tool nodes after a comparison query has been human-authorized. The tool selection restriction and the HITL gate work together as defense-in-depth.

2.8  Agent Node

Category: Core — autonomous LLM that uses the MCP tools to answer the question

  1. Connect Prompt → Rendered Prompt Output to Agent → Input Message
  2. Connect Tool node → outputs to Agent → Tools
  3. Select the AI/ML source registered in Step 1.1 as the Agent’s LLM backend
  4. Remote Agents and Knowledge Base inputs are optional — leave unconnected unless multi-agent or additional RAG patterns are needed
  5. Connect Agent → Response to Guardrails (Output) → input
  6. During development, wire Agent → Execution Trace to a secondary Chat Output to observe tool call decisions in the Playground

2.9  Guardrails (Output) — Content Moderation

Category: Execution — screens the Agent’s response for hate speech, harassment, and policy violations

The output Guardrails node applies content moderation rules to the Agent’s response before it reaches the user. This is distinct from the input Guardrails node, which screens PII — this node focuses on the quality and safety of the generated output.

  1. Connect Agent → Response to Guardrails (Output) → input
  2. Configure content moderation rules — enable hate speech detection, harassment detection, and any other output policy rules required for the deployment context
  3. Connect Guardrails (Output) → Pass to Chat Output → Text
  4. Connect Guardrails (Output) → Fail to a separate Chat Output node with an appropriate message, e.g. ‘The response could not be delivered due to a content policy violation.’
Guardrails NodeWhat It Screens
Guardrails (Input)PII in user queries — names, emails, phone numbers, financial identifiers. Blocks before any processing.
Guardrails (Output)Policy violations in Agent responses — hate speech, harassment, threatening content. Blocks before delivery to user.

Pipeline Flow Reference

The table below maps every connection. The Conditional has two outputs — compare queries go to HITL, all others go to Knowledge Base. Both converge at the Prompt node. Chat Input → Message is also wired directly to Prompt → Input Message so the original question is available for the final LLM synthesis.

FromToData / Notes
Chat Input → MessageGuardrails (Input) → inputRaw user question
Chat Input → MessagePrompt → Input MessageOriginal question also carried forward directly for LLM context
Guardrails (Input) → PassPython Executor → input_msgPII-clean query
Guardrails (Input) → FailChat Output (PII rejection)PII detected — no further processing
Python Executor → Output DataConditional → inputLowercased + normalized query
Conditional → Condition 1Human in the Loop → Input TextContains ‘compare’ — requires authorization
Conditional → DefaultKnowledge Base → Search QueryAll other drug queries — semantic retrieval
Human in the Loop → ApprovePrompt → Input MessageAuthorized comparison query — bypasses KB, goes straight to Prompt
Human in the Loop → RejectChat Output (HITL rejection)Reviewer denied — no KB search, no Agent call
Knowledge Base → Search ResultsPrompt → Search ResultsRetrieved drug context — populated for all non-compare queries; empty for compare path
Prompt → Rendered Prompt OutputAgent → Input MessageAggregated prompt: question + KB context (or empty for compare)
Tool node → outputsAgent → ToolsMCP endpoints available; Agent decides whether to call based on question type
Agent → ResponseGuardrails (Output) → inputAgent’s generated answer — screened before delivery
Guardrails (Output) → PassChat Output → TextApproved response delivered to user
Guardrails (Output) → FailChat Output (content violation)Policy violation in output — blocked
Agent → Execution TraceSecondary Chat Output (dev only)Tool call log — remove in production

Step 3 — Test in the Playground

Test CaseSample InputExpected Behavior
General drug query‘What is aspirin?’Guardrails pass → Python lowercases → Conditional Default → KB retrieves drug context → Prompt → Agent uses KB results → output Guardrails → Chat Output
Illness lookup‘What drug treats hypertension?’Conditional Default → KB semantic search returns drug-condition matches → Agent synthesizes answer from KB context
Drug list‘List all available drugs’Conditional Default → KB → Prompt → Agent calls get_drug_list_mcp for structured list response
Similar drugs‘What drugs are similar to ibuprofen?’Python normalizes to ‘ibuprofen 200mg’ → Conditional Default → KB → Agent calls get_similar_drug_list_mcp
Ibuprofen normalization‘Tell me about Ibuprofen’Python Executor outputs ‘tell me about ibuprofen 200mg’ — verify via Execution Trace that normalized string reaches Agent
Comparison (approved)‘Compare ibuprofen and acetaminophen’Conditional Condition 1 → HITL → Reviewer approves → Prompt (Search Results empty) → Agent calls compare_two_drugs_mcp → output Guardrails → Chat Output
Comparison (rejected)‘Compare ibuprofen and acetaminophen’Conditional Condition 1 → HITL → Reviewer rejects → denial Chat Output; KB and Agent never reached
PII inputQuery with a real name or emailGuardrails (Input) Fail → rejection; all downstream nodes never reached
Output policy violationQuery designed to elicit harmful contentAgent response → Guardrails (Output) Fail → content violation output; response withheld

Tip: For comparison queries, verify via the Agent Execution Trace that Search Results is empty (KB was bypassed) and that compare_two_drugs_mcp was called. For all other queries, verify Search Results is populated and the Agent used that context. If the Agent ignores KB results and calls MCP tools unnecessarily, tighten the prompt template instructions.

Step 4 — Configure Interface and Export

4.1  Interface Settings

SettingRecommended Value
Assistant Name‘Drug Inquiry Assistant’ or your preferred display name
Feedback OptionsEnable thumbs up/down
Welcome Messagee.g. ‘Ask me about any prescription drug. Drug comparison requests require reviewer authorization and may take a few minutes.’
Placeholder Texte.g. ‘Ask about a drug, dosage, side effects, or similar drugs…’

4.2  Save, Export, and Embed

Click Save, then Export or Embed to generate the embeddable assistant snippet. Copy the dataAppId and dataAppUseCaseId from the export panel and insert them into the HTML template below:

FieldDescription
dataAppIdNumeric Data App ID from the UNIFI export panel
dataAppUseCaseIdUnique use case ID string from the UNIFI export panel — replace ‘YOUR_USE_CASE_ID_HERE’
data_apps_runner.jsSelf-contained UNIFI script — includes rendering, data fetching, and authentication. No additional dependencies needed.
<div id=”…”>Mount point for the chat widget — place anywhere in the page body

Tip: The embed snippet connects to the latest published version of the workflow via the dataAppUseCaseId. Updating the workflow in UNIFI (adding guardrail rules, changing the prompt, etc.) does not require changing the HTML embed code.

Quick Reference — Workflow Summary

StepActionKey Detail
1aAdd AI/ML sourceSources → AI/ML Sources; provider, API key, request/response format, model inputs/outputs
1bRegister MCP ToolTools → Add Tool → Custom MCP; Server URL, Transport Protocol (streamable_http), Auth Type, Timeout
2aChat Input + Guardrails (In)PII screen; Pass → Python Executor; Fail → rejection output — always wire both
2bPython Executorrun(input_msg): lowercase entire input; add ‘200mg’ to bare ibuprofen; always return input_msg as fallback; imports inside run()
2cConditional (2 outputs)Condition 1 (contains ‘compare’) → HITL; Default (everything else) → Knowledge Base
2dHuman in the LoopCompare gate; Approve → Prompt (bypasses KB); Reject → denial output; wire both paths + timeout
2eKnowledge Base + PromptKB on Default path — all non-compare queries; KB Search Results + Input Message → Prompt; HITL Approve also wires to Prompt Input Message; Rendered Prompt → Agent
2fTool node (MCP)All 4 endpoints enabled; Agent uses KB context for general queries, calls compare_two_drugs_mcp for authorized comparisons
2gAgentAI/ML source; Input Message from Prompt; Tools from Tool node; uses KB or MCP based on question; Response → Guardrails (Output)
2hGuardrails (Output)Content compliance (hate speech, harassment); Pass → Chat Output; Fail → violation output
3Test 9 casesGeneral, illness, list, similar, normalization, comparison approved/rejected, PII, output violation
4Configure + Export + EmbedInterface Settings → Save → Export → copy IDs → HTML embed template → deploy