Skip to content

feat: Assistant test scenarios, test runner, and evaluation framework #327

Description

@granludo

Summary

Add structured test scenarios per assistant — educators can define expected prompts/conversations, run them through the real completion pipeline, and evaluate the results. This is the foundation for the evaluation framework described in #172.

Motivation

Educators need to test their assistants with realistic prompts before and after making changes. Currently there's no structured way to:

  • Save a set of test prompts for an assistant
  • Run them through the real pipeline (RAG, prompt processing, LLM)
  • Track results over time
  • Record evaluations (good/bad/mixed)

This feature is also a prerequisite for the AAC test-and-evaluate skill (#326), where the agent can generate, run, and analyze tests conversationally.

Implementation

Database (Migration 15)

Three new tables:

  • assistant_test_scenarios — what to test (title, messages, expected behavior, type)
  • assistant_test_runs — what happened (input, output, token usage, model, assistant snapshot)
  • assistant_test_evaluations — was it good (verdict, notes, evaluator)

Service layer

backend/lamb/services/test_service.py:

  • Scenarios CRUD (create, list, get, update, delete)
  • Test runner: calls completion pipeline with stream=False, captures response + token usage
  • Evaluations CRUD

API endpoints

Under /creator/assistant/{id}/tests/:

  • Scenarios: POST/GET/PUT/DELETE
  • Run: POST (execute scenarios through real pipeline)
  • Results: GET (list runs with responses)
  • Evaluate: POST (submit verdict)

CLI (lamb test)

lamb test scenarios <assistant-id>       List test scenarios
lamb test add <assistant-id> <title>     Add a scenario
lamb test run <assistant-id>             Run all/specific scenarios
lamb test runs <assistant-id>            List runs with results
lamb test run-detail <run-id>            Show full input + output
lamb test evaluate <run-id>              Submit evaluation
lamb test evaluations <assistant-id>     List evaluations

Test runner

Calls the same completion endpoint as production (/creator/assistant/{id}/chat/completions) with stream=False. This ensures tests exercise the real RAG, prompt processors, and connector — no shortcuts.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions