Workshop Setup
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
- 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
mkdir murder-mystery && cd murder-mysterynpm init -ynpm install @kortexya/reasoninglayer typescript tsx2. 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
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
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
| 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
// STORING evidence (terms) — tagged formatValue.string("Nina Torres") // {"type":"String","value":"Nina Torres"}Value.integer(42) // {"type":"Integer","value":42}Value.boolean(true) // {"type":"Boolean","value":true}Value.uninstantiated() // unknown / not yet determined
// REASONING about evidence (inference) — untagged formatFeatureInput.string("Nina Torres") // "Nina Torres"FeatureInput.variable("?Suspect") // variable to be solvedguard("gt", 0.8) // constraint: > 0.8TermInput.byName("suspect", {...}) // reference a sort by nameThe golden rule: Value.* for storage, FeatureInput.* for reasoning. Never mix them.