2026 · Zendata · Confidential client
Enterprise Vendor Portal AI Assistant
Migrated a role-aware vendor portal FAQ assistant to Claude Haiku 5.5 and added two scoped operational queries, with verified access context and read-only data tools.
- n8n
- Anthropic API
- Claude Haiku 5.5
- MySQL
- Backend REST API
- Role-based access
- JavaScript
My role
I migrated the role-aware FAQ assistant from a shared free model to Claude Haiku 5.5 through the Anthropic API and added two role-scoped operational queries. The portal and backend authentication system already existed.
Evidence
What I did
- Migrated the assistant from a shared free model to Claude Haiku 5.5 through the Anthropic API.
- Added queries for personnel assigned to purchase orders and contractor personnel currently inside a plant.
- Kept results scoped to the user's role, plant, and vendor using the existing backend authentication context.
- Restricted the assistant's database account to the columns its queries need; sensitive identifiers, credentials, notes, and images are outside that access.
- Configured the assistant's database account with a limit of 5 connections and 3,000 queries per hour, plus a 5-second query timeout.
- Kept the event log privacy-minimized: it stores a row ID not linked to the user, role, outcome, duration, and fixed-category feedback, without prompts, answers, auth tokens, or user identity.
What can be verified
- Validated the 17 query tools against a development database with test data: median 0.88 ms, P95 3.09 ms, and maximum 13.2 ms across 85 runs. This is development database time, not assistant latency.
- With a temporary user holding the same permissions as the production one, all 17 intended queries succeeded and 15 of 15 restricted operations were rejected.
- With a non-existent vendor, user, or plant, all 17 tools returned 0 rows with data; a role lacking the relevant permission also got no results (0 leaks).
- Passed 9 of 9 cases in the controlled on-site personnel scenario, using test entries and exits.
- An assisted review found four possible authorization gaps across plants or vendors; I fixed them and the test cases now cover them.
- Defined a 24-case end-to-end matrix; only a smoke test has run so far, so I do not claim the matrix has passed.
Still to be measured
- Establish an agreed measurement period for end-to-end latency (median and P95), average cost per request, categorized workflow error rate, reviewed answer quality, and access-matrix pass rate.
Problem
Users needed a more accessible way to ask questions about operational information already held in an enterprise portal. Internal staff and external vendors needed different access scopes, and answers had to respect the permissions already enforced by the surrounding system.
Solution
I integrated an AI assistant into the existing portal through an n8n workflow. The workflow validates the session token with the backend, builds context from verified identity and access data, then routes the question to an internal-user or contractor agent. Claude Haiku 5.5 can use bounded read-only tools to retrieve relevant authorized information before the workflow formats a response for the portal.
The assistant supports questions about categories such as vendor status, compliance documents, employee records, purchase orders, access requests, and follow-up items. This migration added queries for personnel assigned to purchase orders and contractor personnel currently inside a plant. Results remain bounded by the user’s role, plant, and vendor scope; the chat text is not a source of authority.
My role
I migrated the assistant from a shared free model to Claude Haiku 5.5 through the Anthropic API and added two role-scoped operational queries: personnel assigned to purchase orders and contractor personnel currently inside a plant. I also handled the separate internal and contractor agent workflows, context construction from verified backend data, scoped MySQL tools, output redaction, usage and connection limits, the five-second query timeout, session and conversation memory, feedback, and failure notifications. The portal and backend authentication system already existed; I did not own those systems or the wider enterprise rollout.
Architecture
Request and tool flow
Main request path- 01
Enterprise portal
Chat widget sends the question with the existing session token.
- 02
n8n webhook
Receives the request and coordinates the workflow.
- 03
Backend verification
Validates the token, then builds context from verified user and access data. Applies per-user usage limits before querying the model.
- 04
Role-aware routing
Routes to a dedicated internal-user or contractor agent.
- 05
Claude Haiku 5.5
Interprets the question and selects from the agent’s available tools.
- 06
Bounded MySQL tools
Read-only queries retrieve only authorized operational information.
- 07
Formatted response
Applies output handling before returning JSON to the portal.
Supporting operational paths
Separate from the main request sequence- FeedbackCaptures user feedback through a separate workflow path.
- Conversation endHandles session termination and memory cleanup.
- Usage controlsPer-user limits, throttling, and repeated off-topic request handling.
- Failure handlingError paths and operational notifications for workflow failures.
The diagram shows the conceptual request and tool flow. It intentionally leaves out implementation details that could identify or expose the original environment.
Security and reliability decisions
- Separate permission from scope. I separated role permission (the same pages the portal enables) from data scope (plant and vendor): the model does not decide what a user can see; the query and the database account do.
- Verify identity at the backend. The workflow checks the token and obtains user context from trusted backend data before it builds the agent context.
- Keep access scoped. Retrieval is bounded by verified user, vendor or company, plant, and application permissions. The message itself cannot grant access.
- Limit database access. MySQL tools are read-only, and the assistant’s database account is restricted to the columns its queries need. Sensitive identifiers, credentials, notes, and images are outside that access.
- Handle sensitive patterns carefully. The response goes through pattern-based redaction for certain sensitive identifiers. This does not remove every possible form of personal information.
- Control usage. Per-user rate and daily limits, throttling, and handling for repeated off-topic requests reduce excessive use.
- Plan for operations. Session termination, conversation memory, feedback, minimal event logging, error paths, and failure notifications are handled as part of the workflow.
Technical validation (development environment, test data)
I wrote a reproducible script that validates the assistant’s 17 query tools against a development database. Everything it writes to the database sits in a transaction that is rolled back at the end, and the temporary user is dropped.
- Query design: all 17 use parameters (no user text concatenated), a 5-second timeout, a row cap or aggregated result, and a scope filter.
- Query timing: 85 runs (17 × 5), with a median of 0.88 ms, P95 of 3.09 ms, and maximum of 13.2 ms. This is development database time, not the assistant’s end-to-end latency.
- Least privilege: with a temporary user holding the same permissions as the production one, the 17 intended queries worked and 15 of 15 restricted operations were rejected. The rejected ones were: reading sensitive identifiers, the QR code token, notes, photos, and gate guard data, SELECT *, the users table, and session tokens; also writing, deleting, creating or dropping tables, and querying other databases. The user is capped at 5 connections and 3,000 queries per hour.
- No scope, no data: with a non-existent vendor, user, or plant, all 17 tools returned 0 rows with data. A role lacking the relevant permission also got no results, even when it was an administrator: 0 leaks.
- Controlled “personnel on site” scenario: I ran 9 of 9 cases with test entries and exits. They cover that the main contractor sees only its own personnel, a subcontractor sees only its own, an unrelated vendor sees nothing, an internal user sees only their plants, and that the plant selector, missing permission, and company filter are respected. It also confirms that anyone who already left, and anyone who entered before midnight, does not appear.
- Authorization review: an assisted review found four possible gaps across plants or vendors. I fixed them and the cases above now cover them.
- Functional tests: I defined a 24-case end-to-end matrix: 18 authorization cases (12 allowed and 6 denied), 2 data-protection and assistant-manipulation cases, and 4 behavior cases. So far only a smoke test has run, so I do not claim the matrix has passed.
Telemetry and cost
The current event log uses a row ID not linked to the user and stores role, outcome, duration, and feedback from a fixed set of categories. It does not store the question, answer, authentication token, or user identity. Start time can be reconstructed from the event timestamp and duration. Tool names and error categories are not yet recorded; adding those fields is a proposed workflow change, so they are not presented as current telemetry.
The Anthropic API key has a dedicated workspace. Average cost per request can be calculated for an agreed period by dividing that workspace’s console cost by the matching response, error, and off-topic request events. This includes retries in the period total; no per-request token count or measured cost baseline is available yet.
For future answer-quality review, I define a correct answer as one that matches what the portal shows for the same view and contains no information outside the user’s access scope. I will mark a case inconclusive when the portal and database disagree or the answer depends on a night shift. Neither outcome rate has been measured yet.
Engineering challenges
Preserving permission boundaries while supporting natural language. A free-form question can describe an entity or scope, but it cannot serve as proof of authorization. The workflow constructs context from backend-verified data and exposes only scoped tools to each agent type.
Handling ambiguous questions. A user may not provide enough context to select a record or action reliably. Tool availability is bounded, and the model decides which tools are relevant; when the request cannot be resolved safely, the assistant states that it found no information instead of making something up.
Keeping usage manageable. Limits and throttling provide control at the user and workflow level, while repeated off-topic requests have a separate handling path. These controls reduce some misuse patterns but cannot prevent every abuse scenario.
Recovering from failures. Model, API, or workflow errors can interrupt the request. Explicit error paths and operational notifications make these failures visible to the team instead of treating an incomplete response as success.
Trade-offs and limitations
- LLM responses can be incorrect or incomplete, even when the available data is correct.
- Sensitive-identifier redaction is pattern-based and does not guarantee that all personal information is removed.
- Usage limits do not guarantee protection against every abuse scenario.
- Security depends on correct backend authorization, database permissions, and workflow configuration.
- On-site personnel only considers same-day records; anyone who entered before midnight does not appear, and the assistant says so instead of estimating.
- Performance tests use a low-volume development database; production timings may be higher.
- The public description omits production prompts, schemas, queries, endpoint details, and configuration. No formal security or privacy certification is claimed.
What I learned
This project gave me practical experience integrating an LLM into an existing business system rather than treating the model as a standalone feature. The key engineering work was in tool orchestration, deriving access context from trusted backend data, making retrieval bounded, and designing operational paths for sessions, usage controls, feedback, and failures.
Validate authorization with negative tests and reversible synthetic scenarios, instead of trusting the model to follow the prompt.
Metrics to measure next
After agreeing on a measurement period with the system owner, I will report end-to-end response latency (median and P95), average cost per request, workflow error rate by category, the proportion of reviewed answers that meet the correctness definition above, and the number of access-matrix cases passed out of 24. These are pending measurements, not current results.