Skip to content

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 knowledgeasync/await, objects, arrays

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

1. Create your project

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

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

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

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:

ErrorFix
Cannot find moduleRun npm install again
401 UnauthorizedCheck your API key (no extra spaces)
fetch failedCheck the URL — must be https://platform.ovh.reasoninglayer.ai/api/v1
node: command not foundInstall Node.js 18+

The Investigation Plan

StepFileWhat you buildTime
1step-01-sorts.tsDefine case types (suspects, evidence, locations)25 min
2step-02-terms.tsEnter all suspects, evidence, and testimonies20 min
3step-03-inference.tsWrite deduction rules, find who had opportunity40 min
4step-04-negation.tsEliminate the innocent15 min
5step-05-fuzzy.tsWeigh uncertain evidence (DNA vs eyewitness)25 min
6step-06-causal.tsReconstruct motive chains, ask “what if?“20 min
7step-07-agents.tsDeploy autonomous detective agents20 min

Quick reference

// STORING evidence (terms) — tagged format
Value.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 format
FeatureInput.string("Nina Torres") // "Nina Torres"
FeatureInput.variable("?Suspect") // variable to be solved
guard("gt", 0.8) // constraint: > 0.8
TermInput.byName("suspect", {...}) // reference a sort by name

The golden rule: Value.* for storage, FeatureInput.* for reasoning. Never mix them.