

Beyond the Demo: Testing AI Features in Laravel with Pest Evals
Join us for the next PHP Talks Lagos meetup for a practical session on testing AI features in Laravel with Pest Evals. Your AI feature works in the demo. Then the model changes its wording, returns a plausible but wrong answer, skips a tool call, or behaves differently when you send the same prompt again. A test built around one saved response will miss those failures.
Laravel developers already know how to test predictable code. AI output introduces variation, so the test has to measure behavior and quality instead of expecting one exact sentence. Pest Evals brings that work into familiar Pest syntax. It combines direct assertions on structure or tool use with scored checks for relevance and safety. Other checks can measure factual correctness and semantic similarity. Agent behavior can be evaluated too.
This session takes a Laravel AI feature from a promising demo to an eval suite you can run before release. We will build checks around representative prompts, inspect why they pass or fail, and use repeated samples to expose problems that a single run can hide.
What we'll cover
What makes an eval different from a conventional unit or feature test
Writing your first Pest Eval with the familiar
expect()APIUsing deterministic checks for JSON output and response structure, plus tool calls and agent trajectories
Scoring relevance and safety, then measuring factual correctness and semantic similarity when exact matching is too brittle
Setting thresholds and repeating prompts to test consistency across multiple responses
Running evals deliberately with
pest --evalsinspecting failures, and deciding what belongs in CIManaging API cost and flaky results, with guardrails for weak test cases and judge-model bias
What to expect
A code-led explainer built around a worked Laravel AI feature and the eval suite that protects it. You will see where ordinary tests still fit and where model-based scoring helps. The session will also show how to turn product expectations into checks your team can run again after the prompt changes or when you switch a model or tool.
You will leave with a clear starting pattern for evaluating AI features before users find the failures for you.
Who should attend
Laravel developers building features that call language models or use the Laravel AI SDK
PHP engineers who already use Pest and want to test non-deterministic output
Developers who currently judge AI changes by trying a few prompts manually
Engineering leads who need clearer release criteria for model-backed features
About PHP Talks Lagos
PHP Talks Lagos is a developer community focused on practical knowledge sharing around PHP and Laravel, including modern backend development. We host regular meetups where engineers learn together and share what's worked for them.