Repository navigation
feat(agent-testing): fill a mock's result with the call's arguments - #1478
Conversation
A mock's resultContent may now hold {{args.name}}, filled with that top-level
argument of the call it answers. A function that says back a sentence the model
passed it (StopCompletion) could only be mocked with the case author's own
words, so assertions on that turn's output tested the case, not the agent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoRender mock results from tool-call arguments
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Problem
A function that says back a sentence the model passed it (it sets
StopCompletionand its result is the turn's reply) could only be mocked with a fixedresultContent. The turn's output was then the case author's own words, so every assertion on it,llmJudgeincluded, tested the case rather than the agent.Change
resultContentmay hold{{args.name}}, filled with that top-level argument of the call it answers (MockResultTemplate). A string argument goes in as it is, any other JSON value as its raw text, and a missing argument or non-object arguments as nothing. A result without placeholders is left untouched.ObservedToolCall.ResultContentis the filled text, as the agent saw it.Why now
The RSP phone agent's
identify_servicenow speaks the model'srestatementfollowed by a fixed address check. Its agent-test mocks use{{args.restatement}} Before we get too far, ...withstopCompletion: true, so the restatement the model wrote is whatllmJudgescores.Tests
MockFunctionExecutorTests: placeholders filled from the call's arguments, the observed result matching what the agent saw, non-object or missing arguments filling nothing, and a JSON result with no placeholders left as it is. AllAgentTestingunit tests pass (374).🤖 Generated with Claude Code