Fix tool call ordering in transcript and add timestamps (#54)#55
Merged
Conversation
The judge was incorrectly detecting data fabrication because the
transcript showed agent response text before tool call results.
Changes:
- Add called_at and responded_at timestamps to ToolCall model
- Update ADK agent to capture tool call timestamps
- Reorder transcript to show tool calls before response text
- Add timestamps to all transcript entries for clarity
New transcript format:
[ASSISTANT] @ 10:30:45.123:
-> Tool called @ 10:30:45.100: get_revenue({})
Result @ 10:30:45.200: {"revenue": 1500000}
Response: The revenue is $1.5M based on the data...
This makes it unambiguous that the agent received tool results
before generating its response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The judge LLM was incorrectly detecting data fabrication because the conversation transcript showed the agent's text response BEFORE the tool call results.
What the judge saw (incorrect ordering):
The judge thought: "The agent stated $1.5M before the tool returned that value - fabrication!"
Solution
called_at,responded_at)New format (correct ordering with timestamps):
Now it's unambiguous that:
Backwards Compatibility
called_atandresponded_atfields are optional (float | None = None)Nonedefaults)Noneby displaying "N/A"Test plan
Closes #54