ZYEL / LABCoding tutorial →
By Chason ArthurRevision 112.046Updated

02 / AI integration workbench

Evidence before
automation.

Turn a service ticket into a reviewable next step. Inspect the sources, test the contract, then decide what happens.

Ticket → grounded draft → human → adapter

A small workflow. Explicit boundaries.

In-memory session
01 / Input

Synthetic service ticket

12–2,000 characters. Document instructions are untrusted data. Text and drafts stay in this tab’s memory.

Ready. Four fixture attempts per ten seconds.

02 / Contract

A grounded draft

Start with a ticket.

The adapter returns a typed classification, recommendation and exact source spans. Invalid output never reaches review.

Inspect the output schema
03 / Provenance

Read the source material

Locally authored synthetic documents, revision 1. Citation links highlight exact spans. Matching text does not establish a recommendation’s correctness.

04 / Human decision

You decide. The adapter waits.

No customer contact or real service API is connected.

Generate a valid, actionable draft to begin review.

Engineering evidence

Test fixtures, approvals, and failure cases.

What runs here

Browser fixture adapter, strict result validation, source checks, human review, abort/timeout tests and a lazy Vue annotation reader.

What stays disabled

The optional server-side Responses API adapter. It needs approved infrastructure, authentication, budget and review before enabling. No key belongs in this page.

What this cannot establish

Live model reliability, people leadership, paying client references, high-traffic operations or RFP compliance.

Read the implementation, tradeoffs and verification steps →

Lab discussion / AI Integration Workbench

What would you try next?

Ask about the code, compare an approach, or describe an edge case. Reader comments are reviewed before publication.

All lab discussions

Reader comments

Open the discussion to read and add reader comments.

Read or write a comment →

Code walkthrough

Follow the implementation in code.

These short excerpts connect the lab’s behavior to its implementation. Each example links to the full tutorial step for its context, tradeoffs and checkpoint. Names and dependencies belong to that source; the excerpts are not standalone programs.

Example 01 · Tutorial excerpt

Define the data contract before the prompt.

Accept a small, predictable payload and make abstention representable. Begin with the synthetic tickets and documents in core.mjs . Dealer references use the shared Lab’s synthetic D001 -style identifiers; there is no private customer join.

const input = validateInput({
  ticketId: 'SYN-1042',
  body: syntheticTicket,
  scenario: 'normal'
});
const draft = validateResult(fixtureResult(input), input);

Read the full tutorial step

Example 02 · Tutorial excerpt

Put each external dependency behind an adapter.

Keep provider behavior replaceable and failure states observable. Start with the validated contract. Live provider access is not required or authorized for this demo.

const controller = new AbortController();
const adapter = makeFixtureAdapter({ latency: 650, timeout: 2500 });
const result = await adapter.analyze(input, { signal: controller.signal });
// On cancel or an edit:
controller.abort();

Read the full tutorial step

Example 03 · Tutorial excerpt

Make citations verifiable by the application.

Give reviewers exact evidence they can inspect. Use immutable revisioned source documents and the current trimmed input text.

const source = sources.find(s => s.id === cite.sourceId);
if (!source ||
    source.text.slice(cite.start, cite.end) !== cite.quote ||
    cite.end - cite.start !== cite.quote.length) {
  throw new Error('Citation rejected');
}

Read the full tutorial step

Example 04 · Tutorial excerpt

Make human review a state transition.

Prevent an actionable draft from becoming an external action by accident. Use a validated result and an explicit reviewer confirmation.

const review = approve(draft, { confirmed, note });
const receipt = await fixtureHandoff(review, { signal });
// receipt.sent is always false in this demo

Read the full tutorial step

Example 05 · Tutorial excerpt

Measure the behavior you can actually prove.

Verify contract handling, not a fictional production benchmark. Run the pure Node tests and the browser workflow against a loopback preview.

node --test lab/ai-workbench/tests/core.test.mjs
# From an isolated test installation with Playwright 1.62.1:
PLAYWRIGHT_MODULE=/absolute/test-dir/node_modules/playwright/index.mjs \
LAB_BASE_URL=http://127.0.0.1:4173 node lab/ai-workbench/tests/browser.mjs

Read the full tutorial step