Workshop Setup
The Case
Section titled “The Case”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.
Prerequisites
Section titled “Prerequisites”- 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.
1. Create your project
Section titled “1. Create your project”mkdir murder-mystery && cd murder-mysterynpm init -ynpm install @kortexya/reasoninglayer typescript tsx2. Get the workshop files
Section titled “2. Get the workshop files”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.
3. Configure your credentials
Section titled “3. Configure your credentials”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});4. Verify it works
Section titled “4. Verify it works”npx tsx step-01-sorts.tsYou should see:
🔍 Case file opened! Created 10 sortsIf 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+ |
The Investigation Plan
Section titled “The Investigation Plan”| 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 |
Quick reference
Section titled “Quick reference”// 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 solvedguard("gt", 0.8) // constraint: > 0.8psi("suspect", {...}) // reference a sort by nameThe golden rule: Value.* for storage, plain values inside psi() for reasoning. Never mix them.