Case study · client delivery · Jun – Oct 2026 · v3.7.0 live

Compass: one assistant across live Dynamics 365 and the business's own know-how

Staff ask in plain English and get sourced, company-scoped answers with a stated confidence: orders, stock, customers, store context, and the how-to behind them. It runs in Teams, a web console, five MCP tool packs and the shared D365 Agent Factory landing zone. One engine behind every door.

88release battery · green nightly
95%judge agreement with human review
3,738answers with an evidence trace
v1 → v3.714 releases in 14 weeks
My role

Principal AI Engineer. Architecture, the planner and tool layer, access policy, the evaluation harness, CI and nightly canary, and the landing-zone integration reviewed and merged by the platform owner.

Stack

FastAPI on Azure App Service · GPT-4.1 / 4.1-mini and text-embedding-3-large on Azure AI Foundry · Dynamics 365 F&O OData (39 entities, read-only) · Azure AI Search / Foundry IQ · Table + Blob storage · Entra ID · Application Insights · GitHub Actions

Governance

Microsoft Zero Trust principles, OWASP LLM & Agentic Top 10 assessment, six ADRs, SBOM and secret scanning on every commit, one-command rollback.

Watch first · about a minute

From a question in Teams to a cited answer.

Plain-English captions, no sound needed. Switch to For tech for the architecture, guardrails and evaluation detail.

▶ Explainer · about a minute · captions on screenGIF
Business view shows the story and results; tech view adds every engineering section.
How a question flows

Six steps from sign-in to a cited answer.

Figures are computed in code with provenance. "Not visible to your role" and "no confident answer" are real answers, never guesses.

01Sign in

Teams, the landing zone or the web console establishes who is asking through Entra ID.

02Resolve scope

Compass maps the person to their F&O user: roles, default legal entity, store context. Admin profiles can override.

03Plan

The model picks tools under a schema; verified exemplars of similar questions guide the plan.

04Read live

Read-only OData calls to F&O, scoped to the company; knowledge retrieval over the business's own SOPs for the how-to.

05Compose honestly

Figures are computed in code; the answer names the company, cites sources and states confidence, or declines and logs a gap.

06Record

An episode (tools, checks, latency) is written for evaluation. The nightly battery and the judge read the same evidence.

Follow a question, then follow the night
0 / 9
Sign inEntra · any doorResolve scoperole ∩ pack · company · storePlanschema-constrainedComposecode · cite · confidenceAnswerTeams · web · MCPLive D365 F&OOData · read-onlyKnowledgeAI Search · SOPsEpisodetrace spine · 3,738Nightly canary03:00 AEST · 88 casesIndependent judge95% ↔ human reviewTeams card · greenGitHub issue · redself-diagnosedGold exemplars44 · precedents
—

Solution architecture

Four ways in, one engine, nothing left to the model that code can do.

Each door authenticates differently and all resolve the same identity and scope. The engine is one deployable: versioned, health-checked and rollback-able in a single command.

Front doors
Teams / Copilot Studio connectorD365 Agent Factory landing-zone tileWeb console and adminFive MCP tool packs for packaged agents
↓
Engine
FastAPI on Azure App Service · v3.7.0Schema-constrained plannerAccess policy · role ∩ packAnswer composition with provenanceTrace spine
↓
Models
gpt-4.1 for planninggpt-4.1-mini where it is enoughtext-embedding-3-largeAzure AI Foundry, australiaeast, in-regionNo arithmetic by the model
↓
Live Dynamics 365
F&O OData · 39 entities · read-only by constructionCompany-scoped readsNative ERP MCP brokered read-only through Compass
↓
Knowledge and stores
Azure AI Search / Foundry IQ agentic retrieval36 knowledge cards · 4 SOPs ingestedTable + Blob: episodes, battery runs, exemplars, access profilesStatistics in traces, never business content
↓
Identity and operations
Entra ID · Easy Auth · Compass Agent API registrationApplication InsightsGitHub Actions: CI and nightly canarySemVer tags · ADR log
Access & security

Read-only by construction. Scoped to the person, every time.

No write path exists

The Dynamics client has no write method. Write, form and action tools are never exposed and are refused by name, proven every night by the adversarial cases.

Role ∩ pack

Effective access is always the person's own F&O role intersected with the tool pack. A pack can never widen what a role allows. Finance views stay behind a deny-list.

Fail-closed doors

The landing-zone surface validates signature, tenant, audience, expiry and scope; refuses app-only tokens; accepts only the landing zone's origin; refuses anyone it cannot place as an F&O user.

Zero Trust applied

Verify every request (Entra sign-in or validated bearer, per-client API keys). Least privilege. Assume breach: external content is treated as untrusted input, never as instructions.

OWASP LLM & Agentic Top 10

A written assessment and twelve permanent adversarial cases: injection, disclosure, authority-framed writes, role escalation, PII probes, tool misuse. They run every night.

Supply chain & secrets

Pinned dependencies, dependency audit, an SBOM per build, secret scanning over history. No secrets in the repository; runtime settings live in App Service.

Evaluation harness

How well it is tested.

Evaluation-first: the battery is written before changes, gates every release, and re-runs against production every night.

Seven layers of evidence

  • Trace spineEvery answer leaves an episode: tools, retrieval, checks, latency. 3,738 recorded.
  • Release battery88 exact pass/fail cases: order tracker 28, sales 28, retail 20, adversarial 12. Nothing ships without a green run.
  • Independent judgeGrades groundedness, intent, tool accuracy, task adherence and completeness against the evidence the tools returned. Calibrated at 95% agreement with human review on a 20-case set.
  • Nightly canaryFull judged battery against production at 03:00 AEST, regression analysis against comparable baselines, a Teams card, and a red auto-files a diagnosed GitHub issue.
  • Learning loopEpisodes that pass both layers become gold exemplars retrieved as precedents at planning time. 44 verified; inspectable and deletable; no retraining.
  • Business regressionThe client's original validation workbooks re-run in production and scored with evidence: 46 / 46.
  • Unit tests24 offline tests for token validation, identity, run summaries and router accept/refuse paths, in CI on every commit.

Red nights, honestly

32 nights since 3 September: 25 green, 6 red, 1 running. Functional packs 76 / 76 green every night.

Five of the six reds were one adversarial wording case: the agent refused a write correctly, then offered to fetch. The fence held every time; the first occurrence found a real defect, fixed in v3.6.2 with a tightened no-overpromise rule. One red was a harness timeout, fixed with retry-on-exception and comparable baselines.

Battery
88/88
release gate
Judge
82/85
v3.7.0 gate run
Acceptance
28/28
landing zone, live token
Production hardening

The platform explains itself.

Fourteen releases in fourteen weeks: each one gated, each one reversible in a single command, and every failure files its own report.

Compass is operated as a service with a version it can report, a known-good state it can return to, and a nightly check that is harder on it than its users are. Observability is end to end: an answer's episode records the tools called, what retrieval returned, which checks ran and how long each took, so a wrong answer is traced to the step that produced it rather than to the model in general. Dependencies, lint rules and the judge's calibration set are pinned, so a regression is a change someone made, not drift nobody can find.

Releases

  • Rollback bookmark: a reproducible known-good deploy zip and tag; stepping back is one command
  • Release gate: the on-demand canary must be green (v3.7.0: 88/88, judge 82/85)
  • Zero-downtime versioned deploys; the health endpoint reports the live version for warm-poll verification
  • SemVer tags v1.0 → v3.7.0; Conventional Commits

CI on every commit

  • Ruff (pinned) and 24 offline unit tests
  • Dependency audit and an SBOM per build
  • Secret scan over the whole history
  • Self-diagnosing failures: a red night files a GitHub issue with the failing cases and run link, proven 15 and 30 Sep

Controls and kill switches

  • Per-client MCP keys with rate limits
  • The landing-zone surface switches off in one setting
  • Content-boundary rule on by default
  • Honest retries: a failed case is retried once and the first answer is kept, so a flaky wording cannot hide
  • Least-privilege F&O application user over the 39 entities, recipe published

Decisions on record

  • ADR 0001–0006: baseline conformance, packaged agents, portable battery, trace spine and judge, canary gate, landing-zone surface
  • Factory ADR 0115 for the externally hosted agent pattern
  • Playbooks, a spec per packaged agent, security documentation
  • Evidence workbook for the 28/28 acceptance
Governance, safety & guardrails

Lighter where the blast radius is small, heavier where it matters, adversarial every night.

Compass cannot write to the ERP, so its heaviest controls are on who may see what, on honesty about confidence, and on proving every night that the fence still holds.

Input guardrails
Entra sign-in or validated bearer: signature, tenant, audience, expiry, scopeApp-only tokens refusedOrigin-restricted landing-zone doorRetrieved content treated as untrusted input, never as instruction
↓
System-prompt constraints
Plan under a schema; tools only from the person's packNo arithmetic by the modelName the company, cite the source, state confidenceDecline and log a gap rather than guessNo-overpromise rule (tightened in v3.6.2)
↓
Output guardrails
Answer-integrity guards before the reply leavesIndependent judge: groundedness, intent, tool accuracy, task adherence, completenessJudge calibrated at 95% agreement with humansHonest zero when there is no stock
↓
Programmatic controls
No write method exists in the Dynamics clientWrite, form and action tools refused by nameRole ∩ pack; a pack can never widen a roleFinance views behind a deny-listPer-client keys, rate limits, one-setting kill switch

Humans in the loop, deliberately placed

No person approves a read, because a read is reversible and the scoping is enforced in code. Humans sit where judgement matters: a 20-case calibration set anchors the judge to human review; an editor's approval can promote an episode to a gold exemplar, and every exemplar is inspectable and deletable; every red night is read by a person before the fix ships; business sign-off closes each packaged agent.

Failure modes, designed for

  • Hallucination — figures computed in code with provenance; judge scores groundedness against what the tools returned
  • Prompt injection — twelve permanent adversarial cases: injection, disclosure, authority-framed writes, role escalation, PII probes, tool misuse
  • Out-of-distribution questions — "no confident answer" is a real answer and files a knowledge gap
  • Over-reliance — every answer names its sources and confidence; "not visible to your role" is said plainly

Compliance and transparency

  • Models and retrieval in-region (australiaeast); data stays in the tenant
  • Traces hold statistics, never business content
  • Per-person scoping: roles, legal entity and store follow the signed-in person through every door
  • OWASP Top 10 for LLM and Agentic Applications: written assessment, tests nightly
  • Red nights published honestly: 6 of 32, each one explained
Failure mode
Control
Evidence
Agent asked to change an order "on the CFO's authority"
No write path exists; refused by name; adversarial case ADV-series runs nightly
12 / 12 refused, every night
Agent refuses correctly, then offers to fetch what it cannot
No-overpromise rule tightened; deterministic guard planned to close ADV-10
found by the suite, fixed in v3.6.2
Token from another tenant or an app-only token
Fail-closed validation of signature, tenant, audience, expiry, scope; app-only refused
24 unit tests, 28/28 acceptance
Document refresh silently changes answers
Nightly canary against production with comparable baselines; regression analysis per case
functional packs 76 / 76 green nightly
Harness itself flakes
Retry on exception, first answer recorded; a red files a diagnosed issue
1 harness red, fixed v3.6.1
The journey

Fourteen releases in fourteen weeks, each one gated.

v1.0 · Knowledge agent, self-growing Q&A cards, Entra sign-in, read-only D365 surfaceJun–Jul
v3.0 · Metadata-grounded analyst: entity oracle, exact joins, arithmetic in code. 30/30 golden batteryJul
v3.4 · Legal-entity and role-based access, packaged agents, store context, portable 88-case batteryAug
v3.5–3.6 · Trace spine, judged evaluation, OWASP assessment, nightly canary, exemplar loopSep
v3.7.0 · Bearer-validated landing-zone surface, 24 unit tests, Agent API registrationSep
Landing zone · PRs merged by the platform owner; tile live; 28/28 acceptanceOct
Next · per-user F&O enforcement (on-behalf-of)agreed
Next · Manufacturing agent on the proven capability-module patterndiscovery

Need an agent that can touch your ERP without ever writing to it?