Skip to content

feat: add DetectiveAI investigation kit - #363

Open
YashSatyawali wants to merge 1 commit into
Lamatic:mainfrom
YashSatyawali:feat/detective-ai
Open

feat: add DetectiveAI investigation kit#363
YashSatyawali wants to merge 1 commit into
Lamatic:mainfrom
YashSatyawali:feat/detective-ai

Conversation

@YashSatyawali

Copy link
Copy Markdown

Overview

DetectiveAI is an AI-powered detective investigation game built as a Lamatic AgentKit kit.

It combines deterministic game mechanics with Lamatic-powered AI agents for suspect
interrogation, forensic evidence examination, and final case reasoning evaluation.

Problem

Most AI agent demos focus on isolated conversations or single-turn tasks.
DetectiveAI demonstrates how multiple AI workflows can operate inside a
stateful investigation while keeping authoritative game state and sensitive
ground truth outside the LLM.

Approach

  • Deterministic GameEngine manages investigation state and progression.
  • Lamatic SuspectAgent provides interactive suspect interrogation.
  • Lamatic EvidenceAgent provides forensic evidence analysis.
  • Lamatic SolutionEvaluator evaluates the player's final reasoning.
  • Ground-truth information remains isolated from player-facing AI context.
  • FastAPI provides the backend API.
  • React/TypeScript provides the investigation UI.
  • CLI support provides a lightweight way to play and test the scenario.

Result

The complete investigation can be played end-to-end through the CLI or web UI.

The included the_midnight_archive scenario supports:

  • Multiple suspects
  • Multiple locations
  • Evidence discovery and examination
  • Stage-based investigation progression
  • AI suspect interrogation
  • AI forensic analysis
  • Final case submission and evaluation
  • Deterministic scoring
  • Ground-truth confidentiality

Validation

  • Backend tests: 138 passed
  • Frontend tests: 12 passed
  • End-to-end gameplay validation completed
  • Live Lamatic SuspectAgent verified
  • Live Lamatic EvidenceAgent verified
  • Live Lamatic SolutionEvaluator verified
  • Ruff checks passed

Tradeoffs / Design Decisions

The GameEngine remains authoritative for objective game state,
while Lamatic agents are treated as untrusted reasoning components.

Sensitive solution information is never provided to player-facing
agents or exposed through the frontend.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 167 files, which is 67 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1a74a88e-10cd-4a87-8256-0963d057c30d

📥 Commits

Reviewing files that changed from the base of the PR and between a08e4d8 and 3f14663.

⛔ Files ignored due to path filters (7)
  • kits/detective-ai/apps/frontend/package-lock.json is excluded by !**/package-lock.json
  • kits/detective-ai/apps/frontend/public/favicon.svg is excluded by !**/*.svg
  • kits/detective-ai/apps/frontend/public/icons.svg is excluded by !**/*.svg
  • kits/detective-ai/apps/frontend/src/assets/hero.png is excluded by !**/*.png
  • kits/detective-ai/apps/frontend/src/assets/react.svg is excluded by !**/*.svg
  • kits/detective-ai/apps/frontend/src/assets/vite.svg is excluded by !**/*.svg
  • kits/detective-ai/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (167)
  • kits/detective-ai/.env.example
  • kits/detective-ai/.gitignore
  • kits/detective-ai/README.md
  • kits/detective-ai/agent.md
  • kits/detective-ai/apps/.env.example
  • kits/detective-ai/apps/backend/app/__init__.py
  • kits/detective-ai/apps/backend/app/api/__init__.py
  • kits/detective-ai/apps/backend/app/api/dependencies.py
  • kits/detective-ai/apps/backend/app/api/exceptions.py
  • kits/detective-ai/apps/backend/app/api/health.py
  • kits/detective-ai/apps/backend/app/api/main.py
  • kits/detective-ai/apps/backend/app/api/routes/__init__.py
  • kits/detective-ai/apps/backend/app/api/routes/actions.py
  • kits/detective-ai/apps/backend/app/api/routes/evidence.py
  • kits/detective-ai/apps/backend/app/api/routes/interrogation.py
  • kits/detective-ai/apps/backend/app/api/routes/scenarios.py
  • kits/detective-ai/apps/backend/app/api/routes/sessions.py
  • kits/detective-ai/apps/backend/app/api/routes/solutions.py
  • kits/detective-ai/apps/backend/app/api/schemas/__init__.py
  • kits/detective-ai/apps/backend/app/api/schemas/action.py
  • kits/detective-ai/apps/backend/app/api/schemas/errors.py
  • kits/detective-ai/apps/backend/app/api/schemas/evidence.py
  • kits/detective-ai/apps/backend/app/api/schemas/interrogation.py
  • kits/detective-ai/apps/backend/app/api/schemas/scenario.py
  • kits/detective-ai/apps/backend/app/api/schemas/session.py
  • kits/detective-ai/apps/backend/app/api/schemas/solution.py
  • kits/detective-ai/apps/backend/app/core/__init__.py
  • kits/detective-ai/apps/backend/app/core/config.py
  • kits/detective-ai/apps/backend/app/core/exceptions.py
  • kits/detective-ai/apps/backend/app/core/logging.py
  • kits/detective-ai/apps/backend/app/db/.gitkeep
  • kits/detective-ai/apps/backend/app/db/__init__.py
  • kits/detective-ai/apps/backend/app/db/base.py
  • kits/detective-ai/apps/backend/app/db/database.py
  • kits/detective-ai/apps/backend/app/lamatic/.gitkeep
  • kits/detective-ai/apps/backend/app/lamatic/__init__.py
  • kits/detective-ai/apps/backend/app/lamatic/agent.py
  • kits/detective-ai/apps/backend/app/lamatic/client.py
  • kits/detective-ai/apps/backend/app/lamatic/evidence_agent.py
  • kits/detective-ai/apps/backend/app/lamatic/evidence_knowledge.py
  • kits/detective-ai/apps/backend/app/lamatic/exceptions.py
  • kits/detective-ai/apps/backend/app/lamatic/schemas.py
  • kits/detective-ai/apps/backend/app/lamatic/solution_evaluator.py
  • kits/detective-ai/apps/backend/app/lamatic/suspect_agent.py
  • kits/detective-ai/apps/backend/app/main.py
  • kits/detective-ai/apps/backend/app/models/.gitkeep
  • kits/detective-ai/apps/backend/app/models/__init__.py
  • kits/detective-ai/apps/backend/app/models/case.py
  • kits/detective-ai/apps/backend/app/models/evidence.py
  • kits/detective-ai/apps/backend/app/models/game_event.py
  • kits/detective-ai/apps/backend/app/models/game_session.py
  • kits/detective-ai/apps/backend/app/models/location.py
  • kits/detective-ai/apps/backend/app/models/suspect.py
  • kits/detective-ai/apps/backend/app/models/timeline.py
  • kits/detective-ai/apps/backend/app/models/victim.py
  • kits/detective-ai/apps/backend/app/scenarios/__init__.py
  • kits/detective-ai/apps/backend/app/scenarios/exceptions.py
  • kits/detective-ai/apps/backend/app/scenarios/loader.py
  • kits/detective-ai/apps/backend/app/scenarios/registry.py
  • kits/detective-ai/apps/backend/app/scenarios/schemas.py
  • kits/detective-ai/apps/backend/app/scenarios/validator.py
  • kits/detective-ai/apps/backend/app/schemas/__init__.py
  • kits/detective-ai/apps/backend/app/schemas/game_state.py
  • kits/detective-ai/apps/backend/app/schemas/solution_evaluation.py
  • kits/detective-ai/apps/backend/app/services/.gitkeep
  • kits/detective-ai/apps/backend/app/services/__init__.py
  • kits/detective-ai/apps/backend/app/services/game_engine.py
  • kits/detective-ai/apps/backend/app/services/investigation_context.py
  • kits/detective-ai/apps/backend/app/services/investigation_tools.py
  • kits/detective-ai/apps/backend/app/services/player_state.py
  • kits/detective-ai/apps/backend/app/services/session_service.py
  • kits/detective-ai/apps/backend/app/services/solution_service.py
  • kits/detective-ai/apps/backend/app/services/suspect_conversation.py
  • kits/detective-ai/apps/backend/app/services/suspect_knowledge.py
  • kits/detective-ai/apps/backend/cli/.gitkeep
  • kits/detective-ai/apps/backend/cli/__init__.py
  • kits/detective-ai/apps/backend/cli/__main__.py
  • kits/detective-ai/apps/backend/cli/app.py
  • kits/detective-ai/apps/backend/cli/commands.py
  • kits/detective-ai/apps/backend/cli/formatting.py
  • kits/detective-ai/apps/backend/detective_ai.egg-info/PKG-INFO
  • kits/detective-ai/apps/backend/detective_ai.egg-info/SOURCES.txt
  • kits/detective-ai/apps/backend/detective_ai.egg-info/dependency_links.txt
  • kits/detective-ai/apps/backend/detective_ai.egg-info/entry_points.txt
  • kits/detective-ai/apps/backend/detective_ai.egg-info/requires.txt
  • kits/detective-ai/apps/backend/detective_ai.egg-info/top_level.txt
  • kits/detective-ai/apps/backend/pyproject.toml
  • kits/detective-ai/apps/backend/requirements.txt
  • kits/detective-ai/apps/backend/scenarios/.gitkeep
  • kits/detective-ai/apps/backend/scenarios/test_case/case.json
  • kits/detective-ai/apps/backend/scenarios/test_case/evidence.json
  • kits/detective-ai/apps/backend/scenarios/test_case/locations.json
  • kits/detective-ai/apps/backend/scenarios/test_case/scenario.json
  • kits/detective-ai/apps/backend/scenarios/test_case/solution.json
  • kits/detective-ai/apps/backend/scenarios/test_case/stages.json
  • kits/detective-ai/apps/backend/scenarios/test_case/suspects.json
  • kits/detective-ai/apps/backend/scenarios/test_case/timeline.json
  • kits/detective-ai/apps/backend/scenarios/test_case/victim.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/case.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/evidence.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/locations.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/scenario.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/solution.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/stages.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/suspects.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/timeline.json
  • kits/detective-ai/apps/backend/scenarios/the_midnight_archive/victim.json
  • kits/detective-ai/apps/backend/tests/__init__.py
  • kits/detective-ai/apps/backend/tests/api_smoke_test.py
  • kits/detective-ai/apps/backend/tests/conftest.py
  • kits/detective-ai/apps/backend/tests/integration/__init__.py
  • kits/detective-ai/apps/backend/tests/integration/test_api.py
  • kits/detective-ai/apps/backend/tests/integration/test_api_confidentiality.py
  • kits/detective-ai/apps/backend/tests/integration/test_e2e_gameplay.py
  • kits/detective-ai/apps/backend/tests/integration/test_gameplay_logging.py
  • kits/detective-ai/apps/backend/tests/integration/test_health.py
  • kits/detective-ai/apps/backend/tests/integration/test_player_state_api.py
  • kits/detective-ai/apps/backend/tests/unit/.gitkeep
  • kits/detective-ai/apps/backend/tests/unit/test_cli.py
  • kits/detective-ai/apps/backend/tests/unit/test_cli_ux.py
  • kits/detective-ai/apps/backend/tests/unit/test_db_init.py
  • kits/detective-ai/apps/backend/tests/unit/test_evidence_agent.py
  • kits/detective-ai/apps/backend/tests/unit/test_game_engine.py
  • kits/detective-ai/apps/backend/tests/unit/test_investigation_context.py
  • kits/detective-ai/apps/backend/tests/unit/test_investigation_tools.py
  • kits/detective-ai/apps/backend/tests/unit/test_lamatic.py
  • kits/detective-ai/apps/backend/tests/unit/test_logging.py
  • kits/detective-ai/apps/backend/tests/unit/test_models.py
  • kits/detective-ai/apps/backend/tests/unit/test_scenarios.py
  • kits/detective-ai/apps/backend/tests/unit/test_schemas.py
  • kits/detective-ai/apps/backend/tests/unit/test_solution_evaluator.py
  • kits/detective-ai/apps/backend/tests/unit/test_suspect_agent.py
  • kits/detective-ai/apps/frontend/.gitignore
  • kits/detective-ai/apps/frontend/README.md
  • kits/detective-ai/apps/frontend/index.html
  • kits/detective-ai/apps/frontend/package.json
  • kits/detective-ai/apps/frontend/src/App.css
  • kits/detective-ai/apps/frontend/src/App.tsx
  • kits/detective-ai/apps/frontend/src/api/client.ts
  • kits/detective-ai/apps/frontend/src/components/EvidenceSection.tsx
  • kits/detective-ai/apps/frontend/src/components/GameDashboard.tsx
  • kits/detective-ai/apps/frontend/src/components/InterrogationPanel.tsx
  • kits/detective-ai/apps/frontend/src/components/LandingScreen.tsx
  • kits/detective-ai/apps/frontend/src/components/MarkdownText.tsx
  • kits/detective-ai/apps/frontend/src/components/SolveForm.tsx
  • kits/detective-ai/apps/frontend/src/index.css
  • kits/detective-ai/apps/frontend/src/main.tsx
  • kits/detective-ai/apps/frontend/src/tests/frontend.test.tsx
  • kits/detective-ai/apps/frontend/tsconfig.app.json
  • kits/detective-ai/apps/frontend/tsconfig.json
  • kits/detective-ai/apps/frontend/tsconfig.node.json
  • kits/detective-ai/apps/frontend/vite.config.ts
  • kits/detective-ai/apps/package.json
  • kits/detective-ai/constitutions/default.md
  • kits/detective-ai/flows/evidence-examination.ts
  • kits/detective-ai/flows/solution-evaluation.ts
  • kits/detective-ai/flows/suspect-interrogation.ts
  • kits/detective-ai/lamatic.config.ts
  • kits/detective-ai/model-configs/evidence-examination_examine.ts
  • kits/detective-ai/model-configs/solution-evaluation_evaluate.ts
  • kits/detective-ai/model-configs/suspect-interrogation_interrogate.ts
  • kits/detective-ai/prompts/evidence-examination_examine_system.md
  • kits/detective-ai/prompts/evidence-examination_examine_user.md
  • kits/detective-ai/prompts/solution-evaluation_evaluate_system.md
  • kits/detective-ai/prompts/solution-evaluation_evaluate_user.md
  • kits/detective-ai/prompts/suspect-interrogation_interrogate_system.md
  • kits/detective-ai/prompts/suspect-interrogation_interrogate_user.md

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/detective-ai

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@YashSatyawali

Copy link
Copy Markdown
Author

Hi, I noticed that the studio-check workflow is failing at the actions/checkout@v4 step because GitHub is refusing to checkout fork PR code from the workflow_run workflow:

Refusing to check out fork pull request code from a 'workflow_run' workflow

The checkout is running with allow-unsafe-pr-checkout: false.

It looks like this is related to the repository workflow/security configuration rather than the contribution itself. Could a maintainer please verify the studio-check workflow for fork PRs?

The Node.js 20 message appears to be a separate deprecation warning.

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai review

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation failed. The kit was rejected by Lamatic Studio.

Errors

detective-ai

  • Could not parse error details.

Please fix the errors above and push a new commit to re-run validation.
Refer to CONTRIBUTING.md for guidance.

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants