Skip to content

Workshop Setup

Billionaire tech CEO Marcus Chen was found dead in his mansion study last night during a private dinner party. Cause of death: cyanide poisoning. 6 guests were present. Your job: build an AI detective to solve the murder.

You’ll use the Reasoning Layer SDK to model evidence, write deduction rules, weigh uncertain testimony, reconstruct motive chains, and deploy an autonomous detective agent.

  • Node.js 18+ — check with node --version
  • A code editor — VS Code recommended
  • Basic TypeScript knowledge — async/await, objects, arrays

No prior knowledge of logic programming, Prolog, or AI is needed.

Terminal window
mkdir murder-mystery && cd murder-mystery
npm init -y
npm install @kortexya/reasoninglayer typescript tsx

The workshop code is available at gitlab.com/kortexya-pub/workshop. Clone it or download the 7 TypeScript files (step-01-sorts.ts through step-07-agents.ts) into your project folder.

In each step file, replace the placeholder credentials:

const client = new ReasoningLayerClient({
baseUrl: 'https://platform.ovh.reasoninglayer.ai/api/v1',
tenantId: 'YOUR_TENANT_ID', // given by the instructor
auth: { mode: 'bearer', token: 'YOUR_API_KEY' }, // given by the instructor
});
Terminal window
npx tsx step-01-sorts.ts

You should see:

🔍 Case file opened! Created 10 sorts

If you see this, you’re ready. If not:

Error Fix
Cannot find module Run npm install again
401 Unauthorized Check your API key (no extra spaces)
fetch failed Check the URL — must be https://platform.ovh.reasoninglayer.ai/api/v1
node: command not found Install Node.js 18+
Step File What you build Time
1 step-01-sorts.ts Define case types (suspects, evidence, locations) 25 min
2 step-02-terms.ts Enter all suspects, evidence, and testimonies 20 min
3 step-03-inference.ts Write deduction rules, find who had opportunity 40 min
4 step-04-negation.ts Eliminate the innocent 15 min
5 step-05-fuzzy.ts Weigh uncertain evidence (DNA vs eyewitness) 25 min
6 step-06-causal.ts Reconstruct motive chains, ask “what if?” 20 min
7 step-07-agents.ts Deploy autonomous detective agents 20 min
// STORING evidence (terms) — tagged format
"Nina Torres" // {"type":"String","value":"Nina Torres"}
42 // {"type":"Integer","value":42}
true // {"type":"Boolean","value":true}
null // unknown / not yet determined
// REASONING about evidence (inference) — untagged format
"Nina Torres" // "Nina Torres"
"?Suspect" // variable to be solved
guard("gt", 0.8) // constraint: > 0.8
psi("suspect", {...}) // reference a sort by name

The golden rule: Value.* for storage, plain values inside psi() for reasoning. Never mix them.