feat: implement tool calls history UI and API (fixes #27)#28
Merged
Conversation
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.
Summary
This PR implements Issue #27, adding a detailed "Call History" view to the Tool Stats page. It allows users to quickly inspect past tool invocations, their exact inputs (arguments), and the model's responses without having to dig through full session logs.
What changed:
analysis.py): Updated the/analysis/tool/{tool_id}endpoint to parsetool_call,tool_result, andtool_errorevents across all sessions. It now returns acalls_historyarray containing the parsed arguments, output payloads, status flags, and latency, strictly sorted in reverse chronological order (most recent first).ToolStats.tsx): Built out a new "Call History" UI section on the Tool Stats page. It lists the invocations elegantly, applying specific badging depending on success/error/hallucination status, and includes expandable<details>sections to inspect the raw JSON inputs and outputs.test_analysis.py): Added a comprehensive suite of backend tests that verify successful aggregations, error state handling, reverse chronological sorting, and empty state behavior.seed_tool_history.py): Added a local utility script to inject realistic dummy tool calls intoharness.dbso reviewers can easily verify the UI locally without requiring an LLM API key.Testing
cd backend && uv run pytest -v --tb=short)cd frontend && npm test)Manual Verification
cd backend && uv run python seed_tool_history.pyto seed your localharness.dbwith dummy tool history data.cd backend && uv run fastapi dev app/main.py) and frontend (cd frontend && npm run dev).http://localhost:5173/tools.summon_cattool.