AI practice

The hard part of an agent is not the loop

It is deciding what it may do without asking. Persona, memory and skills are configuration. Tool permissions and the gates around irreversible actions are the design.

354
BACKEND TESTS, 13 SUITES
58
FRONTEND TESTS
8
ARCHITECTURE DECISION RECORDS
8
PUBLIC REPOSITORIES
The team

MVP to enterprise, hands-on

PremitiveKey runs an expert AI and machine learning engineering team with hands-on experience taking systems from a first MVP through to enterprise deployment. The work is practical rather than research: model and provider selection, retrieval design, agent orchestration, evaluation harnesses, and the deterministic code that has to sit around all of it.

MVP

Prove the idea works on real data before it is worth building properly. A narrow slice, a held-out evaluation set, and an honest read on whether the model earns its place at all.

Production

Tenancy, permissions, background processing, cost controls and observability. This is where most AI pilots stall, and almost none of it is model work.

Enterprise

SSO, audit trails, role-based access, data residency and approval gates on anything irreversible. One platform we built was engineered to ISO 27001 and taken through certification with the client.

Retrieval-augmented generationAgent and multi-agent orchestrationDocument extraction and KYCComputer vision and product matchingEvaluation and held-set scoringProvider abstractionPrompt and task contractsCost and latency budgeting
Four principles

How we build AI that can be trusted with real work

Each of these is visible in a public repository or a live product on this site, not just stated here.

The model reads and drafts. It does not decide.

Extraction, classification and drafting are language work. Scoring against a rule, computing a figure or taking an irreversible action belongs in deterministic code.

Withholding beats guessing.

A field the extractor is not confident about is returned blank and flagged, never filled with a plausible value. In retrieval, a relevance floor decides whether an answer is composed at all.

Humans approve anything irreversible.

A state in the workflow, not a convention in a prompt. The run pauses, persists, and resumes on a person’s decision, with the approval recorded.

Accuracy is measured, not asserted.

A held set of real cases, scored on every change, with precision and recall reported separately rather than as a single number.

Capabilities

What each one does, in plain language

Four capabilities with a system behind each. Three are public code; one is a recording of working software.

CapabilityWhat it doesBehind it
Enterprise RAGAnswers questions from your own documents with citations, and declines when the documents do not contain an answer. Retrieval runs behind a relevance threshold, so the model is never called to guess.EnterpriseRAG
Built · public
Visual AIA photograph replaces the search box. The system identifies each item, matches it to a catalogue by meaning rather than keyword, and returns nothing rather than a weak match.Visual product discovery
KYC & onboardingIdentity documents extracted into typed fields. A field the model is not sure of comes back empty and flagged for a reviewer, never filled with something plausible.KycCheckAI
Built · public
Agent-driven QAA model writes API test scenarios and keeps them current as the API changes. The suite runs on a schedule over a job store that survives a restart, so a regression is visible rather than discovered.QAAPIAutomation
Built · public
How we build agents · shown running

Two systems, traced step by step

The clearest answer to “how do you build agents” is to watch one work. EnterpriseRAG, our public retrieval platform, turns a document into searchable knowledge and a question into a grounded, cited answer. The agentic workflow takes a request through planning, evidence, review, human approval and execution. Each map is the real structure; the trace beside it records every step as it happens.

EnterpriseRAG · public repository

Enterprise RAG platform: from document to grounded answer

Documents are extracted, classified, chunked and embedded inside the organisation’s own infrastructure. Questions are planned, retrieved against the vector index, checked for grounding and answered with citations. 354 backend tests; source public.

EnterpriseRAG · document to indexrun 1/2Built · public
Usersweb app · admin console · public chatbot
Employees & teamsweb application
Administratorsadmin console
Public userspublic chatbot
Identity providerSSO · OIDC, SAML
FrontendNext.js · TypeScript · route handlers as the BFF
Chat interfacegrounded answers, citations
Document managementupload, status, tags
Admin dashboardorganisations, settings, keys
Middlewaresecurity headers → request ID → CORS → auth → rate limit
JWT authenticationhttpOnly refresh, denylist
Rate limitingper IP, per user
Input & file validationtype, size, signature
Audit trailappend-only
Backend APIFastAPI · Python · SQLAlchemy
Document servicemetadata, duplicates, status
RAG & chat servicecontext, grounding, citations
Agent frameworkquery planner · response composer
LLM provider managementencrypted keys, fallback, routing
Workers & cacheCelery workers · Redis
Extraction & OCRPDF, DOCX, PPTX · Tesseract
AI classificationcategory, title, tags
Chunking & embedding1000 chars · local 768-d
Vector indexingdeterministic point IDs
Redistask queue, cache, limits
Data & modelsPostgreSQL · Qdrant · file storage · providers
PostgreSQLmetadata, chat history, audit
Qdrantdocument embeddings
File storageoriginals, OCR output
LLM providersOpenAI · Anthropic · Gemini · Groq
  • 01RECEIVEdocument uploaded · web app or API
  • 02VALIDATEtype, size and signature checked · duplicates rejected
  • 03QUEUErecord written · processing task queued
  • 04EXTRACTtext extracted · OCR only where a page has none
  • 05CLASSIFYcategory, title and tags · via the LLM provider
  • 06EMBED1000-character chunks · local embeddings, no API cost
  • 07INDEXvectors upserted · deterministic IDs, safe to retry
  • 08COMPLETEstatus COMPLETED · audit row written
Knowledge stays in-house. Extraction, chunking and embedding run on the organisation’s own infrastructure, and every vector has a deterministic ID, so a retry can never duplicate a document.
  • 01ASKquestion submitted · last six turns loaded from cache
  • 02ADMITtoken verified · per-user rate limit applied
  • 03PLANquery planner refines the question · 25 s, no retry
  • 04RETRIEVEtop-5 chunks above 0.35 relevance · completed docs only
  • 05VERIFYevidence present · otherwise an honest refusal, no model call
  • 06COMPOSEanswer written from the passages only · 60 s, one retry
  • 07CHECKcitations verified against the retrieved chunks · PII masked
  • 08ANSWERanswer with source references · message and sources stored
Grounded by design. The composing model sees only retrieved passages, every citation is checked against them, and when the evidence is not there the system says so.
Agentic systems · LangGraph, CrewAI, MCP

Agentic AI workflow: from request to audited action

The workflow, not the model, is in control: LangGraph sequencing with durable state, CrewAI agents under typed task contracts with explicit tool grants over MCP, a human approval gate on anything irreversible, and a trace of every run.

Agentic workflow · request to audited actionrun 1/2Reference architecture
Requestweb app · API · schedule · a person for approvals
Requestuser, API call or schedule
Human reviewerapproval console
Responsetyped result, returned
OrchestrationLangGraph state machine · CrewAI Flows
Workflow controlsequencing and routing
Durable statesurvives restarts
Retry & validation policyexplicit, per step
Human approval gatea state, on irreversible actions
AgentsCrewAI crew · typed task contracts
Plannerscopes the task
Research agentread-only tool grant
Analyst agentstructured output
Reviewer agentchecks the contract
Execution agentwrites only what is granted
Tools · MCPone declared contract per tool
MCP serverdeclared tool contract
Search & retrievalgrounded, cited
APIs & servicesinternal, third-party
CRM · ERPsystems of record
Modelsbehind an adapter, never wired through the app
LLMreasoning, drafting
Embeddingslocal or hosted
Provider adaptervendor is configuration
Data & observabilityPostgreSQL · tracing · audit
Application databasesystem of record
Logs & tracinginputs, calls, latency, cost
Audit trailappend-only, attributable
  • 01RECEIVErequest enters the workflow · run ID, state created
  • 02PLANplanner scopes the task · typed task contract issued
  • 03RESEARCHresearch agent gathers evidence · read-only grant
  • 04ANALYSEanalyst produces structured output · schema enforced
  • 05REVIEWreviewer checks the output against its contract · pass
  • 06APPROVEirreversible action waits for a person · approved
  • 07EXECUTEexecution agent acts through the declared MCP contract
  • 08RECORDrun traced: inputs, calls, latency, cost · audit row appended
  • 09RETURNtyped result returned · state marked complete
The workflow is in control. Deterministic code decides what runs next, each agent does one job under a typed contract, and nothing irreversible happens without a person.
  • 01WAKEthe schedule fires · run ID, state created
  • 02PLANplanner scopes the task · typed task contract issued
  • 03RETRIEVEresearch agent gathers evidence · read-only grant
  • 04ANALYSEanalyst produces structured output · schema enforced
  • 05REVIEWreviewer checks the output against its contract · pass
  • 06UPDATEa reversible write through the declared MCP contract · inside its tool grant
  • 07RECORDrun traced: inputs, calls, latency, cost · audit row appended
  • 08RETURNtyped result returned · state marked complete
Unattended where that is safe. A reversible write proceeds on the reviewer’s pass; anything irreversible stops at the approval gate first. Either way the whole run is traced and attributable.
Choosing the model

Generative or predictive: the first decision, and the one most often wrong

Both are called AI. They are built differently, cost differently by two orders of magnitude, and fail differently. Getting this right at the start saves more money than any optimisation afterwards.

Generative AIPredictive AI
ProducesNew content conditioned on context: an answer, a summary, a typed record, a draftAn estimate drawn from history: a class, a score, a rank, a number, an anomaly flag
NeedsA model, good context, and evidence to ground it. Little or no labelled dataLabelled history that resembles the traffic you will actually see
Right whenThe input is unstructured and the output is language or a structured record. The rules are too many, or change too often, to write downThe question is closed-ended and you need the same answer every time, in milliseconds, at negligible cost
Fails byInventing something fluent and confident that is not trueScoring well overall while being wrong on exactly the cases that matter
Measured byGrounding, citation coverage, refusal rate, and a held set scored on every changePrecision and recall reported separately, on a held-out set, with drift watched after launch
Cost shapePer call, ongoing, and it rises with usage: a design constraint from day oneExpensive to train once, then close to free per prediction
Our guardA relevance threshold that stops the model being called when the evidence is not there, and a typed contract it must returnA confidence floor below which the system defers to a person rather than deciding
The pattern that works. Predictive first, generative last. The cheap, consistent model narrows, routes, ranks and flags; the expensive, variable one explains, composes and drafts, and only on what survived. Most of the AI rescue work we are asked to do turns out to be a generative model placed where a predictive one belonged, or a generative model with nothing in front of it deciding when to stay quiet.
Status

Where our AI actually runs

A current status of the AI systems we have built. We publish it because the discipline that keeps an agent out of production until it is trusted is the discipline you are hiring us for.

SystemStatusDetail
MeshTribe · agent layerAcceptance testingProfile integrity, content and report triage, community editorial and relevance. Structured verdicts with reasons and confidence, an audit ledger, and human escalation on anything irreversible.
Cinepolis Indonesia · agent layerAcceptance testingRecommendation, demand prediction and re-engagement above a live booking platform.
Play Cinemas · agent layerAcceptance testingTwo model providers behind one orchestrator, so the vendor is a configuration decision.
PolicyDesk · document AIIn-houseInsurer-aware extraction, renewal chains and family cover mapping for India’s insurance distributors.
EnterpriseRAG · retrievalBuilt · publicQdrant retrieval with 354 backend tests across 13 suites. Read the study.
Platforms beneath themLiveMeshTribe, both cinema applications, FOXBOX and Sadhan are all in production.
No agent layer is live in production yet. The platforms are. We draw that line explicitly, on every page where a system is named.
Practice

How we work, in the open

8 repositories are public at github.com/PremitiveAI, and so are the architecture decisions behind them: 354 backend tests across 13 suites, 58 frontend tests, 8 architecture decision records and a 10-table schema you can read.

Architecture decision records

Eight published. Every significant decision is written down with its reason, so the next engineer inherits the thinking and not just the code.

Held-set evaluation

Accuracy is measured on a set of real cases, scored on every change, with precision and recall reported separately.

Typed task contracts

Prompts are provider-specific and swapping one changes the output. What works is defining your own tasks, each with a typed contract and its own test cases.

Go deeper

The architecture, the studies and the recordings

For a technical reader: the layered reference architecture, three engineering studies with public code behind each, and recordings of systems running.

Reference architecture

Application, flow orchestration, crews, agents, tools, model layer, and data and observability. What each layer is responsible for, and the failure it prevents.

Engineering study 01

Retrieval that knows when to stop. 354 backend tests, 14 pipeline stages, 8 ADRs, 14 documented limitations.

Engineering study 02

Agents that run unattended: a durable job store that survives a restart, and results that make regressions visible.

Engineering study 03

Extraction that returns null rather than a plausible value, and hybrid vector plus fuzzy matching.

Demonstrations

Visual product discovery, fit-to-model try-on and an API QA agent, recorded from working software.

Public repositories

8 repositories at github.com/PremitiveAI. Read the code and the architecture decision records before you call us.

Ask us where AI actually belongs in your product

Often the answer is a smaller slice than expected, and occasionally it is nowhere. You get that answer either way.

A 60-minute architecture review · no charge · the notes are yours either way