From ec716e698f5beb7fbdbf171386723d40301a72af Mon Sep 17 00:00:00 2001 From: Carlos Escalante Date: Wed, 29 Apr 2026 22:55:53 -0600 Subject: [PATCH] Exclude SALARY and DEPOSITO from agent recent-transactions tool The 'last N transactions' answer was including salary deposits, which the user reads as expense activity. Filter income types out at the query level. Co-Authored-By: Claude Opus 4.7 (1M context) --- backend/app/agent/tools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/app/agent/tools.py b/backend/app/agent/tools.py index bbda99c..ea71b78 100644 --- a/backend/app/agent/tools.py +++ b/backend/app/agent/tools.py @@ -118,7 +118,11 @@ def get_recent_transactions( ) -> list[dict]: """Recent transactions, newest first. Use filters to narrow down. For billing-cycle scoped totals prefer get_cycle_summary.""" - q = select(Transaction) + q = select(Transaction).where( + Transaction.transaction_type.notin_( + [TransactionType.SALARY, TransactionType.DEPOSITO] + ) + ) if source: q = q.where(Transaction.source == TransactionSource(source)) if category_id is not None: